From bfc70c820837b34f1732cd658ea400c7af197e67 Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Tue, 24 Apr 2018 17:00:29 +0200 Subject: [PATCH] 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) --- pcbnew/tools/footprint_editor_tools.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/pcbnew/tools/footprint_editor_tools.cpp b/pcbnew/tools/footprint_editor_tools.cpp index 2d6f5f8aec..e90a1e8b32 100644 --- a/pcbnew/tools/footprint_editor_tools.cpp +++ b/pcbnew/tools/footprint_editor_tools.cpp @@ -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 )