From 85f6ff48e75f38f957542c719f5384522670f1e5 Mon Sep 17 00:00:00 2001 From: Roberto Fernandez Bautista Date: Tue, 12 Apr 2022 21:33:52 +0100 Subject: [PATCH] CADSTAR Sch: Clear symbol of all elements before overwriting with new one Fixes https://gitlab.com/kicad/code/kicad/-/issues/11378 --- .../sch_plugins/cadstar/cadstar_sch_archive_loader.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/eeschema/sch_plugins/cadstar/cadstar_sch_archive_loader.cpp b/eeschema/sch_plugins/cadstar/cadstar_sch_archive_loader.cpp index 01f529e9d13..b1948bd6d75 100644 --- a/eeschema/sch_plugins/cadstar/cadstar_sch_archive_loader.cpp +++ b/eeschema/sch_plugins/cadstar/cadstar_sch_archive_loader.cpp @@ -1300,6 +1300,13 @@ void CADSTAR_SCH_ARCHIVE_LOADER::loadSymDefIntoLibrary( const SYMDEF_ID& aSymdef SYMDEF_SCM symbol = Library.SymbolDefinitions.at( aSymdefID ); int gateNumber = getKiCadUnitNumberFromGate( aGateID ); + // Ensure there are no items on this unit (e.g. if we already previously loaded the symbol from + // the part definition) + std::vector drawItems = aSymbol->GetUnitDrawItems( gateNumber, 0 ); + + for( LIB_ITEM* item : drawItems ) + aSymbol->RemoveDrawItem( item ); + for( std::pair figPair : symbol.Figures ) { FIGURE fig = figPair.second;