Skip to content

Commit

Permalink
CADSTAR Sch: Clear symbol of all elements before overwriting with new…
Browse files Browse the repository at this point in the history
  • Loading branch information
Qbort committed Apr 12, 2022
1 parent 306dfef commit 85f6ff4
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions eeschema/sch_plugins/cadstar/cadstar_sch_archive_loader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<LIB_ITEM*> drawItems = aSymbol->GetUnitDrawItems( gateNumber, 0 );

for( LIB_ITEM* item : drawItems )
aSymbol->RemoveDrawItem( item );

for( std::pair<FIGURE_ID, FIGURE> figPair : symbol.Figures )
{
FIGURE fig = figPair.second;
Expand Down

0 comments on commit 85f6ff4

Please sign in to comment.