Fix an issue in footprint editor, "Create Pad from Selected Shapes" command.

If the initial pad was a custom pad converted in a usual pad + graphic items by the command:
"Explode Pad to Graphic Shapes"
the "old" primitives were not cleaned, and the new created pad contained these old primitives, regardless the new selected shapes.
(Usual case when a user want to edit a custom shape)
This commit is contained in:
jean-pierre charras 2018-04-24 17:00:29 +02:00
parent 319908b7f4
commit bfc70c8208
1 changed files with 9 additions and 1 deletions

View File

@ -302,6 +302,14 @@ int MODULE_EDITOR_TOOLS::ExplodePadToShapes( const TOOL_EVENT& aEvent )
}
pad->SetShape( pad->GetAnchorPadShape() );
// Cleanup the pad primitives data, because the initial pad was a custom
// shaped pad, and it contains primitives, that does not exist in non custom pads,
// and can create issues later:
if( pad->GetShape() != PAD_SHAPE_CUSTOM ) // should be always the case
{
pad->DeletePrimitivesList();
}
commit.Push( _("Explode pad to shapes") );
m_toolMgr->RunAction( PCB_ACTIONS::selectionClear, true );
@ -441,7 +449,7 @@ int MODULE_EDITOR_TOOLS::CreatePadFromShapes( const TOOL_EVENT& aEvent )
pad->SetPosition( wxPoint( anchor->x, anchor->y ) );
pad->AddPrimitives( shapes );
pad->ClearFlags();
bool result = pad->MergePrimitivesAsPolygon();
if( !result )