CADSTAR Schematic Archive Importer: Do not load blocks without a linked sheet

Fixes std::out_of_range error
This commit is contained in:
Roberto Fernandez Bautista 2020-12-29 23:35:57 +00:00 committed by Wayne Stambaugh
parent 728792aa3c
commit f6ec173ba7
1 changed files with 15 additions and 0 deletions

View File

@ -1593,6 +1593,21 @@ void CADSTAR_SCH_ARCHIVE_LOADER::loadChildSheets(
if( block.LayerID == aCadstarSheetID && block.Type == BLOCK::TYPE::CHILD )
{
if( block.AssocLayerID == wxT( "NO_LINK" ) )
{
if( block.Figures.size() > 0 )
{
wxLogError( wxString::Format(
_( "The block ID %s (Block name: '%s') is drawn on sheet '%s' but is "
"not linked to another sheet in the design. KiCad requires all "
"sheet symbols to be associated to a sheet, so the block was not "
"loaded." ),
block.ID, block.Name, Sheets.SheetNames.at( aCadstarSheetID ) ) );
}
continue;
}
// In KiCad you can only draw rectangular shapes whereas in Cadstar arbitrary shapes
// are allowed. We will calculate the extents of the Cadstar shape and draw a rectangle