From 76bd892f935c5bdcf261ffdb3818dea53d82bf45 Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Tue, 16 Jan 2024 16:23:12 +0100 Subject: [PATCH] Fix not working Duplicate command in FP editor Fixes #16594 https://gitlab.com/kicad/code/kicad/-/issues/16594 --- pcbnew/tools/edit_tool.cpp | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/pcbnew/tools/edit_tool.cpp b/pcbnew/tools/edit_tool.cpp index c51e015fad..eefb6b6b65 100644 --- a/pcbnew/tools/edit_tool.cpp +++ b/pcbnew/tools/edit_tool.cpp @@ -2,7 +2,7 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2013-2023 CERN - * Copyright (C) 2017-2023 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 2017-2024 KiCad Developers, see AUTHORS.txt for contributors. * @author Maciej Suminski * @author Tomasz Wlostowski * @@ -2445,6 +2445,15 @@ int EDIT_TOOL::Duplicate( const TOOL_EVENT& aEvent ) if( m_isFootprintEditor ) { FOOTPRINT* parentFootprint = editFrame->GetBoard()->GetFirstFootprint(); + + // PCB_FIELD items are specific items (not only graphic, but are properies ) + // and cannot be duplicated like other footprint items. So skip it: + if( orig_item->Type() == PCB_FIELD_T ) + { + orig_item->ClearSelected(); + continue; + } + dupe_item = parentFootprint->DuplicateItem( orig_item ); if( increment && dupe_item->Type() == PCB_PAD_T @@ -2456,6 +2465,10 @@ int EDIT_TOOL::Duplicate( const TOOL_EVENT& aEvent ) padTool->SetLastPadNumber( padNumber ); static_cast( dupe_item )->SetNumber( padNumber ); } + + dupe_item->ClearSelected(); + new_items.push_back( dupe_item ); + commit.Add( dupe_item ); } else if( /*FOOTPRINT* parentFootprint =*/ orig_item->GetParentFootprint() ) {