72 _(
"The selected file does not appear to be a CADSTAR parts Library file" ) );
84 std::vector<LIB_SYMBOL*> retVal;
88 std::unique_ptr<LIB_SYMBOL> loadedPart =
loadLibPart( part );
93 retVal.push_back( loadedPart.release() );
100std::unique_ptr<LIB_SYMBOL>
104 std::unique_ptr<LIB_SYMBOL> retSym;
117 wxString::Format(
_(
"Unable to find symbol %s, referenced by part %s. The "
118 "part was not loaded." ),
127 std::unique_ptr<LIB_SYMBOL> kiSymDef(
loadSymdef( symbolID )->Duplicate() );
129 if( sym.
m_Pins.size() != kiSymDef->GetPinCount() )
132 wxString::Format(
_(
"Inconsitent pin numbers in symbol %s compared to the one "
133 "defined in part %s. The part was not loaded." ),
147 wxCHECK( termID > 0 && sym.
m_Pins.size() >=
size_t( termID ),
nullptr );
148 LIB_PIN*
pin = kiSymDef->GetPin( storedPinNum );
149 size_t termIdx = size_t( termID ) - 1;
158 wxString partPinNum = wxString::Format(
"%ld", sym.
m_Pins[termIdx].m_Identifier );
159 pin->SetNumber( partPinNum );
171 wxCHECK( kiSymDef->GetUnitCount() == 1,
nullptr );
173 retSym = std::move( kiSymDef );
175 retSym->SetUnitCount( aPart.
m_Symbols.size(),
true );
177 retSym->SetName( escapedPartName );
179 retSym->GetValueField().SetText( aPart.
m_Value.value_or(
"" ) );
181 retSym->SetDescription( aPart.
m_Description.value_or(
"" ) );
183 auto addFieldIfHasValue =
184 [&](
const wxString& aFieldName,
const std::optional<std::string>& aFieldValue )
186 if( aFieldValue.has_value() )
199 wxString modelVal = wxString::Format(
"model=\"%s\"", aPart.
m_SpiceModel.value() );
226 VECTOR2I symCenter = retSym->GetBodyBoundingBox( unit, 0,
false,
false ).GetCenter();
227 symCenter.
y = -symCenter.
y;
233 for(
auto& [signalName, csPinVector] : aPart.
m_HiddenPins )
237 std::unique_ptr<LIB_PIN>
pin = std::make_unique<LIB_PIN>( retSym.get() );
239 long pinNum = csPin.m_Identifier;
240 pin->SetNumber( wxString::Format(
"%ld", pinNum ) );
241 pin->SetName( signalName );
242 pin->SetType( ELECTRICAL_PINTYPE::PT_POWER_IN );
244 pin->SetVisible(
false );
253 direction = { -direction.
y, direction.
x };
258 pin->SetPosition( symCenter + offset );
260 pin->SetShape( GRAPHIC_PINSHAPE::LINE );
261 pin->SetUnit( unit );
262 retSym->AddDrawItem(
pin.release() );
282 std::unique_ptr<LIB_SYMBOL>& aDestSym,
283 int aDestUnit,
bool aOverrideFields )
286 for(
LIB_ITEM* item : aDestSym->GetUnitDrawItems( aDestUnit, 0 ) )
287 aDestSym->RemoveDrawItem( item );
290 for(
LIB_ITEM* newItem : aSourceSym->GetUnitDrawItems( 1, 0 ) )
294 itemCopy->
SetUnit( aDestUnit );
295 aDestSym->AddDrawItem( itemCopy );
299 if( aOverrideFields )
301 std::vector<LIB_FIELD*> fieldsToCopy;
302 aSourceSym->GetFields( fieldsToCopy );
304 for(
LIB_FIELD* templateField : fieldsToCopy )
307 templateField->Copy( appliedField );
315 wxCHECK( aSchematic, );
365 m_reporter->
Report( wxString::Format(
_(
"The CADSTAR design contains variants which has "
366 "no KiCad equivalent. Only the master variant "
367 "('%s') was loaded." ),
374 m_reporter->
Report(
_(
"The CADSTAR design contains grouped items which has no KiCad "
375 "equivalent. Any grouped items have been ungrouped." ),
381 m_reporter->
Report(
_(
"The CADSTAR design contains re-use blocks which has no KiCad "
382 "equivalent. The re-use block information has been discarded during "
389 for( std::pair<LAYER_ID, SCH_SHEET*> sheetPair :
m_sheetMap )
394 BOX2I sheetBoundingBox;
409 if( field.IsVisible() )
410 bbox.
Merge( field.GetBoundingBox() );
416 wxString txt = txtItem->
GetText();
418 if( txt.Contains(
"${" ) )
425 bbox = item->GetBoundingBox();
428 sheetBoundingBox.
Merge( bbox );
441 auto roundToNearestGrid =
442 [&](
int aNumber ) ->
int
444 int error = aNumber %
grid;
445 int absError =
sign( error ) * error;
447 if( absError > (
grid / 2 ) )
448 return aNumber + (
sign( error ) *
grid ) - error;
450 return aNumber - error;
457 int longestSide = std::max( targetSheetSize.
x, targetSheetSize.
y );
458 int margin = ( (double) longestSide * 0.03 );
459 margin = roundToNearestGrid( margin );
460 targetSheetSize += margin * 2;
471 VECTOR2I sheetcentre( pageSizeIU.
x / 2, pageSizeIU.
y / 2 );
475 VECTOR2I translation = sheetcentre - itemsCentre;
476 translation.
x = roundToNearestGrid( translation.
x );
477 translation.
y = roundToNearestGrid( translation.
y );
480 std::vector<SCH_ITEM*> allItems;
483 std::back_inserter( allItems ) );
487 item->Move( translation );
495 m_reporter->
Report(
_(
"CADSTAR fonts are different to the ones in KiCad. This will likely "
496 "result in alignment issues. Please review the imported text elements "
497 "carefully and correct manually if required." ),
501 "Please review the import errors and warnings (if any)." ) );
514 constexpr long long maxDesignSizekicad = std::numeric_limits<int>::max();
516 if( designSizeXkicad > maxDesignSizekicad || designSizeYkicad > maxDesignSizekicad )
519 _(
"The design is too large and cannot be imported into KiCad. \n"
520 "Please reduce the maximum design size in CADSTAR by navigating to: \n"
521 "Design Tab -> Properties -> Design Options -> Maximum Design Size. \n"
522 "Current Design size: %.2f, %.2f millimeters. \n"
523 "Maximum permitted design size: %.2f, %.2f millimeters.\n" ),
539 if( orphanSheets.size() > 1 )
544 for(
LAYER_ID sheetID : orphanSheets )
560 else if( orphanSheets.size() > 0 )
562 LAYER_ID rootSheetID = orphanSheets.at( 0 );
564 wxFileName loadedFilePath = wxFileName(
Filename );
566 std::string filename = wxString::Format(
"%s_%02d", loadedFilePath.GetName(),
580 THROW_IO_ERROR(
_(
"The selected file is a CADSTAR symbol library. It does not contain a "
581 "schematic design so cannot be imported/opened in this way." ) );
585 THROW_IO_ERROR(
_(
"The CADSTAR schematic might be corrupt: there is no root sheet." ) );
594 BLOCK& block = blockPair.second;
597 if( block.
Type == BLOCK::TYPE::PARENT )
599 else if( block.
Type == BLOCK::TYPE::CHILD )
608 for( std::pair<TERMINAL_ID, TERMINAL> termPair : block.
Terminals )
611 wxString
name =
"YOU SHOULDN'T SEE THIS TEXT. THIS IS A BUG.";
615 if( block.
Type == BLOCK::TYPE::PARENT )
617 else if( block.
Type == BLOCK::TYPE::CHILD )
621 sheetPin->
SetShape( LABEL_FLAG_SHAPE::L_UNSPECIFIED );
642 PART_ID partID = partPair.first;
643 PART part = partPair.second;
653 GATE_ID gateID = gatePair.first;
654 PART::DEFINITION::GATE gate = gatePair.second;
657 if( symbolID.IsEmpty() )
659 m_reporter->
Report( wxString::Format(
_(
"Part definition '%s' references symbol "
660 "'%s' (alternate '%s') which could not be "
661 "found in the symbol library. The part has "
662 "not been loaded into the KiCad library." ),
685 wxString::Format(
_(
"Part definition '%s' has an incomplete definition (no"
686 " symbol definitions are associated with it). The part"
687 " has not been loaded into the KiCad library." ),
708 SYMBOL sym = symPair.second;
717 m_reporter->
Report( wxString::Format(
_(
"Symbol '%s' references part '%s' which "
718 "could not be found in the library. The "
719 "symbol was not loaded" ),
727 if( sym.
GateID.IsEmpty() )
781 partname.Replace( wxT(
"\n" ), wxT(
"\\n" ) );
782 partname.Replace( wxT(
"\r" ), wxT(
"\\r" ) );
783 partname.Replace( wxT(
"\t" ), wxT(
"\\t" ) );
784 partField->
SetText( partname );
807 wxASSERT( attrField->
GetName() == attrName );
809 attrVal.
Value.Replace( wxT(
"\n" ), wxT(
"\\n" ) );
810 attrVal.
Value.Replace( wxT(
"\r" ), wxT(
"\\r" ) );
811 attrVal.
Value.Replace( wxT(
"\t" ), wxT(
"\\t" ) );
825 _(
"Symbol ID '%s' references library symbol '%s' which could not be "
826 "found in the library. Did you export all items of the design?" ),
835 _(
"Symbol ID '%s' is a signal reference or global signal but it has too "
836 "many pins. The expected number of pins is 1 but %d were found." ),
858 wxString libPartName = libraryNetName;
864 if( libPartName != symbolInstanceNetName )
866 libPartName += wxT(
" (" ) + symbolInstanceNetName + wxT(
")" );
872 wxCHECK( templatePart, );
876 kiPart->
SetName( libPartName );
882 wxCHECK( pins.size() == 1, );
884 pins.at( 0 )->SetType( ELECTRICAL_PINTYPE::PT_POWER_IN );
885 pins.at( 0 )->SetName( symbolInstanceNetName );
937 netLabel->
SetText(
"***UNKNOWN NET****" );
951 if( libSymDef.
Alternate.Lower().Contains(
"in" ) )
952 netLabel->
SetShape( LABEL_FLAG_SHAPE::L_INPUT );
953 else if( libSymDef.
Alternate.Lower().Contains(
"bi" ) )
954 netLabel->
SetShape( LABEL_FLAG_SHAPE::L_BIDI );
955 else if( libSymDef.
Alternate.Lower().Contains(
"out" ) )
956 netLabel->
SetShape( LABEL_FLAG_SHAPE::L_OUTPUT );
958 netLabel->
SetShape( LABEL_FLAG_SHAPE::L_UNSPECIFIED );
965 screen->
Append( netLabel );
970 wxASSERT_MSG(
false,
"Unknown Symbol Variant." );
975 m_reporter->
Report( wxString::Format(
_(
"Symbol ID '%s' is of an unknown type. It is "
976 "neither a symbol or a net power / symbol. "
977 "The symbol was not loaded." ),
986 if( symbolName.empty() )
987 symbolName = wxString::Format(
"ID: %s", sym.
ID );
991 m_reporter->
Report( wxString::Format(
_(
"Symbol '%s' is scaled in the original "
992 "CADSTAR schematic but this is not supported "
993 "in KiCad. When the symbol is reloaded from "
994 "the library, it will revert to the original "
1008 BUS bus = busPair.second;
1009 bool firstPt =
true;
1012 if( bus.
LayerID != wxT(
"NO_SHEET" ) )
1015 std::shared_ptr<BUS_ALIAS> kiBusAlias = std::make_shared<BUS_ALIAS>();
1017 kiBusAlias->SetName( bus.
Name );
1018 kiBusAlias->SetParent( screen );
1026 label->
SetText( wxT(
"{" ) + busname + wxT(
"}" ) );
1077 label->
SetText( wxT(
"{" ) + busname + wxT(
"}" ) );
1092 wxString netName = net.
Name;
1093 std::map<NETELEMENT_ID, SCH_LABEL*> netlabels;
1095 if( netName.IsEmpty() )
1096 netName = wxString::Format(
"$%ld", net.
SignalNum );
1100 for( std::pair<NETELEMENT_ID, NET_SCH::SYM_TERM> terminalPair : net.
Terminals )
1102 NET_SCH::SYM_TERM netTerm = terminalPair.second;
1111 if( netTerm.HasNetLabel )
1117 netTerm.NetLabel.TextCodeID,
1118 netTerm.NetLabel.Alignment,
1119 netTerm.NetLabel.Justification,
1120 netTerm.NetLabel.OrientAngle,
1121 netTerm.NetLabel.Mirror );
1139 && netTerm.HasNetLabel )
1149 applyTextSettings( label, netTerm.NetLabel.TextCodeID, netTerm.NetLabel.Alignment,
1150 netTerm.NetLabel.Justification );
1152 netlabels.insert( { netTerm.ID, label } );
1155 m_sheetMap.at( sheet )->GetScreen()->Append( label );
1159 auto getHierarchicalLabel =
1162 if( aNode.Contains(
"BLKT" ) )
1165 BLOCK_PIN_ID blockPinID = std::make_pair( blockTerm.BlockID,
1166 blockTerm.TerminalID );
1176 for( std::pair<NETELEMENT_ID, NET_SCH::BLOCK_TERM> blockPair : net.
BlockTerminals )
1178 SCH_HIERLABEL* label = getHierarchicalLabel( blockPair.first );
1185 for( std::pair<NETELEMENT_ID, NET_SCH::BUS_TERM> busPair : net.
BusTerminals )
1187 NET_SCH::BUS_TERM busTerm = busPair.second;
1191 m_busesMap.at( bus.
ID )->Members().emplace_back( netName );
1211 if( busTerm.HasNetLabel )
1214 busTerm.NetLabel.TextCodeID,
1215 busTerm.NetLabel.Alignment,
1216 busTerm.NetLabel.Justification );
1223 netlabels.insert( { busTerm.ID, label } );
1227 for( std::pair<NETELEMENT_ID, NET_SCH::DANGLER> danglerPair : net.
Danglers )
1229 NET_SCH::DANGLER dangler = danglerPair.second;
1235 if( dangler.HasNetLabel )
1238 dangler.NetLabel.TextCodeID,
1239 dangler.NetLabel.Alignment,
1240 dangler.NetLabel.Justification );
1244 netlabels.insert( { dangler.ID, label } );
1246 m_sheetMap.at( dangler.LayerID )->GetScreen()->Append( label );
1249 for( NET_SCH::CONNECTION_SCH conn : net.
Connections )
1251 if( conn.LayerID == wxT(
"NO_SHEET" ) )
1262 if( conn.Path.size() < 1 || conn.Path.front() != start )
1263 conn.Path.insert( conn.Path.begin(), start );
1265 if( conn.Path.size() < 2 || conn.Path.back() != end )
1266 conn.Path.push_back( end );
1268 bool firstPt =
true;
1269 bool secondPt =
false;
1275 for(
POINT pt : conn.Path )
1285 std::vector<NETELEMENT_ID> nodes;
1286 nodes.push_back( conn.StartNode );
1287 nodes.push_back( conn.EndNode );
1302 int leftSide = sheetPosition.
x;
1303 int rightSide = sheetPosition.
x + sheetSize.
x;
1304 int topSide = sheetPosition.
y;
1305 int botSide = sheetPosition.
y + sheetSize.
y;
1309 sheetEdge.
Append( leftSide, topSide );
1310 sheetEdge.
Append( rightSide, topSide );
1311 sheetEdge.
Append( rightSide, botSide );
1312 sheetEdge.
Append( leftSide, botSide );
1313 sheetEdge.
Append( leftSide, topSide );
1317 if( !wireChain.
Intersect( sheetEdge, wireToSheetIntersects ) )
1322 if( node == conn.StartNode )
1323 wireChain = wireChain.
Reverse();
1327 if( node == conn.StartNode )
1328 wireChain = wireChain.
Reverse();
1334 VECTOR2I intsctPt = wireToSheetIntersects.at( 0 ).p;
1335 int intsctIndx = wireChain.
FindSegment( intsctPt );
1336 wxASSERT_MSG( intsctIndx != -1,
"Can't find intersecting segment" );
1338 if( node == conn.StartNode )
1339 wireChain.
Replace( 0, intsctIndx, intsctPt );
1341 wireChain.
Replace( intsctIndx + 1, -1, intsctPt );
1349 auto fixNetLabelsAndSheetPins =
1354 if( netlabels.find( aNetEleID ) != netlabels.end() )
1355 netlabels.at( aNetEleID )->SetTextSpinStyle( spin.
MirrorY() );
1357 SCH_HIERLABEL* sheetPin = getHierarchicalLabel( aNetEleID );
1379 fixNetLabelsAndSheetPins( wireAngle, conn.StartNode );
1388 if( !conn.ConnectionLineCode.IsEmpty() )
1393 m_sheetMap.at( conn.LayerID )->GetScreen()->Append( wire );
1400 fixNetLabelsAndSheetPins( wireAngle, conn.EndNode );
1404 for( std::pair<NETELEMENT_ID, NET_SCH::JUNCTION_SCH> juncPair : net.
Junctions )
1406 NET_SCH::JUNCTION_SCH junc = juncPair.second;
1411 m_sheetMap.at( junc.LayerID )->GetScreen()->Append( kiJunc );
1413 if( junc.HasNetLabel )
1426 m_sheetMap.at( junc.LayerID )->GetScreen()->Append( label );
1437 FIGURE fig = figPair.second;
1448 TEXT txt = textPair.second;
1458 for( std::pair<DOCUMENTATION_SYMBOL_ID, DOCUMENTATION_SYMBOL> docSymPair :
1465 m_reporter->
Report( wxString::Format(
_(
"Documentation Symbol '%s' refers to symbol "
1466 "definition ID '%s' which does not exist in "
1467 "the library. The symbol was not loaded." ),
1480 bool mirrorInvert = docSym.
Mirror;
1482 for( std::pair<FIGURE_ID, FIGURE> figPair : docSymDef.
Figures )
1484 FIGURE fig = figPair.second;
1487 centreOfTransform, mirrorInvert );
1490 for( std::pair<TEXT_ID, TEXT> textPair : docSymDef.
Texts )
1492 TEXT txt = textPair.second;
1494 txt.
Mirror = ( txt.
Mirror ) ? !mirrorInvert : mirrorInvert;
1500 scalingFactor, centreOfTransform, mirrorInvert );
1519 auto findAndReplaceTextField =
1543 std::map<wxString, wxString>& txtVars = pj->
GetTextVars();
1559 wxString varValue = txtvalue.second;
1561 txtVars.insert( { varName, varValue } );
1566 wxString varName = txtvalue.first;
1567 wxString varValue = txtvalue.second;
1569 txtVars.insert( { varName, varValue } );
1574 m_reporter->
Report(
_(
"Text Variables could not be set as there is no project attached." ),
1582 std::unique_ptr<LIB_SYMBOL>& aKiCadSymbol )
1585 LIB_FIELD* existingField = aKiCadSymbol->FindField( aFieldName );
1587 if( existingField !=
nullptr )
1588 return existingField;
1590 int newfieldID = aKiCadSymbol->GetFieldCount();
1592 newfield->
SetName( aFieldName );
1594 aKiCadSymbol->AddField( newfield );
1613 std::unique_ptr<LIB_SYMBOL> kiSym = std::make_unique<LIB_SYMBOL>( csSym.
BuildLibName() );
1614 const int gateNumber = 1;
1617 for( std::pair<FIGURE_ID, FIGURE> figPair : csSym.
Figures )
1619 FIGURE fig = figPair.second;
1635 return getKiCadLibraryPoint( aPt, csSym.Origin );
1648 shape->
SetFillMode( FILL_T::FILLED_WITH_BG_BODYCOLOR );
1650 kiSym->AddDrawItem( shape );
1657 for( std::pair<TERMINAL_ID, TERMINAL> termPair : csSym.
Terminals )
1660 wxString pinNum = wxString::Format(
"%ld", term.
ID );
1661 wxString pinName = wxEmptyString;
1662 std::unique_ptr<LIB_PIN>
pin = std::make_unique<LIB_PIN>( kiSym.get() );
1665 pin->SetType( ELECTRICAL_PINTYPE::PT_PASSIVE );
1668 pin->SetLength( 0 );
1669 pin->SetShape( GRAPHIC_PINSHAPE::LINE );
1670 pin->SetUnit( gateNumber );
1671 pin->SetNumber( pinNum );
1672 pin->SetName( pinName );
1690 pin->SetNumberTextSize( pinNumberHeight );
1691 pin->SetNameTextSize( pinNameHeight );
1693 pinNumToTerminals.insert( {
pin->GetNumber(), term.
ID } );
1694 kiSym->AddDrawItem(
pin.release() );
1702 for( std::pair<TEXT_ID, TEXT> textPair : csSym.
Texts )
1704 TEXT csText = textPair.second;
1706 std::unique_ptr<LIB_TEXT> libtext = std::make_unique<LIB_TEXT>( kiSym.get() );
1707 libtext->SetText( csText.
Text );
1708 libtext->SetUnit( gateNumber );
1710 libtext->SetMultilineAllowed(
true );
1716 if( csText.
Text.Contains(
"\n" ) )
1718 wxArrayString strings;
1720 wxPoint firstLinePos;
1722 for(
size_t ii = 0; ii < strings.size(); ++ii )
1724 BOX2I bbox = libtext->GetTextBox( ii,
true );
1727 RotatePoint( linePos, libtext->GetTextPos(), -libtext->GetTextAngle() );
1730 textLine->
SetText( strings[ii] );
1737 kiSym->AddDrawItem( textLine );
1743 libtext->SetMultilineAllowed(
false );
1744 kiSym->AddDrawItem( libtext.release() );
1766 wxCHECK( partField,
nullptr );
1782 for(
auto& [attributeId, textLocation] : csSym.
TextLocations )
1807 if( attrValue.HasLocation )
1814 m_symDefMap.insert( { aSymdefID, std::move( kiSym ) } );
1821 const PART& aCadstarPart,
1827 std::unique_ptr<LIB_SYMBOL> kiSymDef(
loadSymdef( aSymdefID )->Duplicate() );
1828 wxCHECK( kiSymDef, );
1831 std::unique_ptr<LIB_SYMBOL> tempSymbol( aSymbol );
1839 LIB_PIN*
pin = kiSymDef->GetPin( storedPinNum );
1844 if( pinNum.IsEmpty() )
1846 if( !csPin.Identifier.IsEmpty() )
1847 pinNum = csPin.Identifier;
1849 pinNum = wxString::Format(
"%ld", termID );
1851 pinNum = wxString::Format(
"%ld", csPin.ID );
1855 pin->SetNumber( pinNum );
1856 pin->SetName( pinName );
1858 pinNumMap.insert( { termID, pinNum } );
1869 tempSymbol->GetValueField().SetVisible(
false );
1878 wxString footprintRefName = wxEmptyString;
1879 wxString footprintAlternateName = wxEmptyString;
1886 wxString attributeValue = aAttributeVal.Value;
1887 attributeValue.Replace( wxT(
"\n" ), wxT(
"\\n" ) );
1888 attributeValue.Replace( wxT(
"\r" ), wxT(
"\\r" ) );
1889 attributeValue.Replace( wxT(
"\t" ), wxT(
"\\t" ) );
1895 if( attrName == wxT(
"(PartDefinitionNameStem)" ) )
1898 attributeValue.Replace( wxT(
" " ),
"_" );
1899 tempSymbol->GetReferenceField().SetText( attributeValue );
1902 else if( attrName == wxT(
"(PartDescription)" ) )
1904 tempSymbol->SetDescription( attributeValue );
1907 else if( attrName == wxT(
"(PartDefinitionReferenceName)" ) )
1909 footprintRefName = attributeValue;
1912 else if( attrName == wxT(
"(PartDefinitionAlternateName)" ) )
1914 footprintAlternateName = attributeValue;
1918 bool attrIsNew = tempSymbol->FindField( attrName ) ==
nullptr;
1921 wxASSERT( attrField->
GetName() == attrName );
1922 attrField->
SetText( aAttributeVal.Value );
1923 attrField->
SetUnit( gateNumber );
1925 const ATTRIBUTE_ID& attrid = aAttributeVal.AttributeID;
1928 if( aAttributeVal.HasLocation )
1934 else if( attrIsNew )
1944 loadLibraryField( attrVal );
1948 loadLibraryField( attrVal );
1954 tempSymbol->SetShowPinNames(
false );
1955 tempSymbol->SetShowPinNumbers(
false );
1958 aSymbol = tempSymbol.release();
1963 const wxString& aFootprintName,
1964 const wxString& aFootprintAlternate )
1966 wxString fpNameInLibrary =
generateLibName( aFootprintName, aFootprintAlternate );
1968 if( !fpNameInLibrary.IsEmpty() )
1970 wxArrayString fpFilters;
1971 fpFilters.Add( aFootprintName );
1973 if( !aFootprintAlternate.IsEmpty() )
1974 fpFilters.Add( fpNameInLibrary );
1976 aKiCadSymbol->SetFPFilters( fpFilters );
1979 aKiCadSymbol->GetFootprintField().SetText( libID.
Format() );
1988 int aLineThickness )
1990 const VERTEX* prev = &aCadstarVertices.at( 0 );
1995 for(
size_t i = 1; i < aCadstarVertices.size(); i++ )
1997 cur = &aCadstarVertices.at( i );
2008 centerPoint = ( startPoint + endPoint ) / 2;
2019 shape =
new LIB_SHAPE( aSymbol, SHAPE_T::POLY );
2031 shape =
new LIB_SHAPE( aSymbol, SHAPE_T::ARC );
2038 shape->
SetEnd( startPoint );
2043 shape->
SetEnd( endPoint );
2049 shape->
SetUnit( aGateNumber );
2068 aCadstarAttrLoc.
Mirror );
2095 int compOrientation = 0;
2097 if( aCadstarSymbol.
Mirror )
2099 compAngle = -compAngle;
2100 compOrientation += SYMBOL_ORIENTATION_T::SYM_MIRROR_Y;
2105 EDA_ANGLE test2( aComponentOrientation );
2109 m_reporter->
Report( wxString::Format(
_(
"Symbol '%s' is rotated by an angle of %.1f "
2110 "degrees in the original CADSTAR design but "
2111 "KiCad only supports rotation angles multiples "
2112 "of 90 degrees. The connecting wires will need "
2123 m_reporter->
Report( wxString::Format(
_(
"Symbol '%s' references sheet ID '%s' which does "
2124 "not exist in the design. The symbol was not "
2134 wxString gate = ( aCadstarSymbol.
GateID.IsEmpty() ) ? wxString( wxT(
"A" ) ) : aCadstarSymbol.
GateID;
2135 wxString partGateIndex = aCadstarSymbol.
PartRef.
RefID + gate;
2142 std::map<wxString, LIB_PIN*> pinNumToLibPinMap;
2144 for(
auto& term : termNumMap )
2146 wxString pinNum = term.second;
2147 pinNumToLibPinMap.insert( { pinNum,
2151 auto replacePinNumber =
2152 [&]( wxString aOldPinNum, wxString aNewPinNum )
2154 if( aOldPinNum == aNewPinNum )
2157 LIB_PIN* libpin = pinNumToLibPinMap.at( aOldPinNum );
2162 for(
auto& pinPair : aCadstarSymbol.
PinNumbers )
2164 SYMBOL::PIN_NUM
pin = pinPair.second;
2166 replacePinNumber( termNumMap.at(
pin.TerminalID ),
2167 wxString::Format(
"%ld",
pin.PinNum ) );
2171 for(
auto& pinPair : aCadstarSymbol.
PinNames )
2174 replacePinNumber( termNumMap.at(
pin.TerminalID ),
pin.NameOrLabel );
2204 if( textIsVertical )
2207 alignment =
mirrorX( alignment );
2215 aCadstarAttrLoc.
Mirror );
2222 int compOrientation = SYMBOL_ORIENTATION_T::SYM_ORIENT_0;
2229 compOrientation = SYMBOL_ORIENTATION_T::SYM_ORIENT_0;
2230 aReturnedOrientation =
ANGLE_0;
2234 compOrientation = SYMBOL_ORIENTATION_T::SYM_ORIENT_90;
2239 compOrientation = SYMBOL_ORIENTATION_T::SYM_ORIENT_180;
2244 compOrientation = SYMBOL_ORIENTATION_T::SYM_ORIENT_270;
2248 return compOrientation;
2257 auto logUnknownNetElementError =
2260 m_reporter->
Report( wxString::Format(
_(
"Net %s references unknown net element %s. "
2261 "The net was not properly loaded and may "
2262 "require manual fixing." ),
2271 if( aNetElementID.Contains(
"J" ) )
2274 return logUnknownNetElementError();
2276 return aNet.
Junctions.at( aNetElementID ).Location;
2278 else if( aNetElementID.Contains(
"P" ) )
2281 return logUnknownNetElementError();
2287 return logUnknownNetElementError();
2294 return logUnknownNetElementError();
2300 VECTOR2I pinOffset = libpinPosition - libOrigin;
2304 VECTOR2I pinPosition = symbolOrigin + pinOffset;
2308 pinPosition.
x = ( 2 * symbolOrigin.
x ) - pinPosition.
x;
2313 RotatePoint( pinPosition, symbolOrigin, -adjustedOrientation );
2316 retval.
x = pinPosition.
x;
2317 retval.
y = pinPosition.
y;
2321 else if( aNetElementID.Contains(
"BT" ) )
2324 return logUnknownNetElementError();
2326 return aNet.
BusTerminals.at( aNetElementID ).SecondPoint;
2328 else if( aNetElementID.Contains(
"BLKT" ) )
2331 return logUnknownNetElementError();
2337 return logUnknownNetElementError();
2339 return Schematic.
Blocks.at( blockid ).Terminals.at( termid ).Position;
2341 else if( aNetElementID.Contains(
"D" ) )
2344 return logUnknownNetElementError();
2346 return aNet.
Danglers.at( aNetElementID ).Position;
2350 return logUnknownNetElementError();
2357 wxString netname = aNet.
Name;
2359 if( netname.IsEmpty() )
2360 netname = wxString::Format(
"$%ld", aNet.
SignalNum );
2372 const double& aScalingFactor,
2374 const bool& aMirrorInvert )
2379 const VERTEX* prev = &aCadstarVertices.at( 0 );
2383 "First vertex should always be a point vertex" );
2385 auto pointTransform =
2389 aScalingFactor, aTransformCentre, aMirrorInvert );
2392 for(
size_t ii = 1; ii < aCadstarVertices.size(); ii++ )
2394 cur = &aCadstarVertices.at( ii );
2396 VECTOR2I transformedStartPoint = pointTransform( prev->
End );
2397 VECTOR2I transformedEndPoint = pointTransform( cur->
End );
2419 segment->
SetLayer( aKiCadSchLayerID );
2431 wxFAIL_MSG(
"Unknown CADSTAR Vertex type" );
2441 const LAYER_ID& aCadstarSheetIDOverride,
2445 const double& aScalingFactor,
2447 const bool& aMirrorInvert )
2450 aCadstarSheetIDOverride, aKiCadSchLayerID, aMoveVector, aRotation,
2451 aScalingFactor, aTransformCentre, aMirrorInvert );
2456 aKiCadSchLayerID, aMoveVector, aRotation, aScalingFactor,
2457 aTransformCentre, aMirrorInvert );
2468 "Sheet already loaded!" );
2471 aParentSheet.
Last(),
2487 wxString loadedFilename = wxFileName(
Filename ).GetName();
2488 std::string filename = wxString::Format(
"%s_%02d", loadedFilename, sheetNum ).ToStdString();
2493 filenameField.
SetText( filename );
2500 wxString pageNumStr = wxString::Format(
"%d",
getSheetNumber( aCadstarSheetID ) );
2505 m_sheetMap.insert( { aCadstarSheetID, sheet } );
2515 "FIXME! Parent sheet should be loaded before attempting to load subsheets" );
2519 BLOCK& block = blockPair.second;
2521 if( block.
LayerID == aCadstarSheetID && block.
Type == BLOCK::TYPE::CHILD )
2525 if( block.
Figures.size() > 0 )
2528 "is drawn on sheet '%s' but is not "
2529 "linked to another sheet in the "
2530 "design. KiCad requires all sheet "
2531 "symbols to be associated to a sheet, "
2532 "so the block was not loaded." ),
2544 std::pair<VECTOR2I, VECTOR2I> blockExtents;
2546 if( block.
Figures.size() > 0 )
2552 THROW_IO_ERROR( wxString::Format(
_(
"The CADSTAR schematic might be corrupt: "
2553 "Block %s references a child sheet but has no "
2554 "Figure defined." ),
2567 field.SetVisible(
false );
2614 std::vector<LAYER_ID> childSheets, orphanSheets;
2619 BLOCK& block = blockPair.second;
2622 if( block.
Type == BLOCK::TYPE::CHILD )
2623 childSheets.push_back( assocSheetID );
2629 if( std::find( childSheets.begin(), childSheets.end(), sheetID ) == childSheets.end() )
2630 orphanSheets.push_back( sheetID );
2633 return orphanSheets;
2643 if( sheetID == aCadstarSheetID )
2655 wxCHECK_MSG( aItem, ,
"aItem is null" );
2657 if( aCadstarSheetID ==
"ALL_SHEETS" )
2663 LAYER_ID sheetID = sheetPair.first;
2670 aItem = duplicateItem;
2672 else if( aCadstarSheetID ==
"NO_SHEET" )
2674 wxASSERT_MSG(
false,
2675 "Trying to add an item to NO_SHEET? This might be a documentation symbol." );
2681 m_sheetMap.at( aCadstarSheetID )->GetScreen()->Append( aItem );
2686 wxASSERT_MSG(
false,
"Unknown Sheet ID." );
2694 const wxString& aSymDefAlternate )
2705 wxString refKey = symdef.ReferenceName.Lower();
2706 wxString altKey = symdef.Alternate.Lower();
2718 else if( altKey.IsEmpty() )
2726 wxString refKeyToFind = aSymdefName.Lower();
2727 wxString altKeyToFind = aSymDefAlternate.Lower();
2769 PLOT_DASH_TYPE::SOLID );
2779 default:
return PLOT_DASH_TYPE::DEFAULT;
2808 aCadstarAttributeID );
2834CADSTAR_SCH_ARCHIVE_LOADER::PART::DEFINITION::PIN
2838 for( std::pair<PART_DEFINITION_PIN_ID, PART::DEFINITION::PIN> pinPair :
2841 PART::DEFINITION::PIN partPin = pinPair.second;
2843 if( partPin.TerminalGate == aGateID && partPin.TerminalPin == aTerminalID )
2847 return PART::DEFINITION::PIN();
2855 case CADSTAR_PIN_TYPE::UNCOMMITTED:
return ELECTRICAL_PINTYPE::PT_PASSIVE;
2856 case CADSTAR_PIN_TYPE::INPUT:
return ELECTRICAL_PINTYPE::PT_INPUT;
2857 case CADSTAR_PIN_TYPE::OUTPUT_OR:
return ELECTRICAL_PINTYPE::PT_OPENCOLLECTOR;
2858 case CADSTAR_PIN_TYPE::OUTPUT_NOT_OR:
return ELECTRICAL_PINTYPE::PT_OUTPUT;
2859 case CADSTAR_PIN_TYPE::OUTPUT_NOT_NORM_OR:
return ELECTRICAL_PINTYPE::PT_OUTPUT;
2860 case CADSTAR_PIN_TYPE::POWER:
return ELECTRICAL_PINTYPE::PT_POWER_IN;
2861 case CADSTAR_PIN_TYPE::GROUND:
return ELECTRICAL_PINTYPE::PT_POWER_IN;
2862 case CADSTAR_PIN_TYPE::TRISTATE_BIDIR:
return ELECTRICAL_PINTYPE::PT_BIDI;
2863 case CADSTAR_PIN_TYPE::TRISTATE_INPUT:
return ELECTRICAL_PINTYPE::PT_INPUT;
2864 case CADSTAR_PIN_TYPE::TRISTATE_DRIVER:
return ELECTRICAL_PINTYPE::PT_OUTPUT;
2867 return ELECTRICAL_PINTYPE::PT_UNSPECIFIED;
2872 if( aCadstarGateID.IsEmpty() )
2875 return (
int) aCadstarGateID.Upper().GetChar( 0 ) - (int) wxUniChar(
'A' ) + 1;
2918 switch( aCadstarAlignment )
2937 default: wxFAIL_MSG(
"Unknown Cadstar Alignment" );
return aCadstarAlignment;
2945 switch( aCadstarAlignment )
2959 default: wxFAIL_MSG(
"Unknown Cadstar Alignment" );
return aCadstarAlignment;
2969 aKiCadTextItem->
SetText( escapedText );
2980 if( textWidth == 0 )
2996 const long long aCadstarOrientAngle,
3005 ALIGNMENT textAlignment = aCadstarAlignment;
3011 textAlignment =
mirrorX( aCadstarAlignment );
3016 switch( aAlignment )
3071 wxCHECK( textEdaItem, );
3073 switch( textEdaItem->
Type() )
3099 textAlignment =
rotate180( textAlignment );
3103 textAlignment =
rotate180( textAlignment );
3105 default: wxFAIL_MSG(
"Unknown Quadrant" );
3109 setAlignment( aKiCadTextItem, textAlignment );
3118 setAlignment( aKiCadTextItem, textAlignment );
3120 int off =
static_cast<SCH_TEXT*
>( aKiCadTextItem )->GetTextOffset();
3142 static_cast<SCH_TEXT*
>( aKiCadTextItem )->SetTextSpinStyle( spin );
3146 wxFAIL_MSG(
"Unexpected item type" );
3165 aCadstarTextElement.
Mirror );
3172 long long aScalingFactorNumerator,
3173 long long aScalingFactorDenominator )
3177 if( aScalingFactorNumerator == aScalingFactorDenominator )
3181 [&](
int aLength ) ->
int
3183 return( aLength * aScalingFactorNumerator ) / aScalingFactorDenominator;
3189 return VECTOR2I( scaleLen( aCoord.x ), scaleLen( aCoord.y ) );
3195 return VECTOR2I( scaleLen( aSize.x ), scaleLen( aSize.y ) );
3202 switch( item.Type() )
3204 case KICAD_T::LIB_SHAPE_T:
3208 if( shape.
GetShape() == SHAPE_T::ARC )
3214 else if( shape.
GetShape() == SHAPE_T::POLY )
3224 case KICAD_T::LIB_PIN_T:
3228 pin.SetPosition( scalePt(
pin.GetPosition() ) );
3229 pin.SetLength( scaleLen(
pin.GetLength() ) );
3233 case KICAD_T::LIB_TEXT_T:
3269 if( aGateNumber > 0 && shape.
GetUnit() != aGateNumber )
3272 if( shape.
GetShape() != SHAPE_T::POLY )
3282 if( pt0 != pt1 && uniqueSegments.count( pt0 ) == 0 && uniqueSegments.count( pt1 ) == 0 )
3285 if( pt0.
x == pt1.
x || pt0.
y == pt1.
y )
3287 uniqueSegments.insert( { pt0, poly } );
3288 uniqueSegments.insert( { pt1, poly } );
3295 aSymbolToFix->
GetPins( pins, aGateNumber );
3297 for(
auto&
pin : pins )
3299 auto setPinOrientation =
3306 pin->SetOrientation(
'R' );
3308 pin->SetOrientation(
'U' );
3310 pin->SetOrientation(
'L' );
3312 pin->SetOrientation(
'D' );
3315 if( uniqueSegments.count(
pin->GetPosition() ) )
3321 if( otherPt ==
pin->GetPosition() )
3322 otherPt = poly.
CPoint( 1 );
3333std::pair<VECTOR2I, VECTOR2I>
3341 if( upperLeft.
x > v.
End.
x )
3342 upperLeft.
x = v.
End.
x;
3344 if( upperLeft.
y < v.
End.
y )
3345 upperLeft.
y = v.
End.
y;
3347 if( lowerRight.
x < v.
End.
x )
3348 lowerRight.
x = v.
End.
x;
3350 if( lowerRight.
y > v.
End.
y )
3351 lowerRight.
y = v.
End.
y;
3358 if( upperLeft.
x > v.
End.
x )
3359 upperLeft.
x = v.
End.
x;
3361 if( upperLeft.
y < v.
End.
y )
3362 upperLeft.
y = v.
End.
y;
3364 if( lowerRight.
x < v.
End.
x )
3365 lowerRight.
x = v.
End.
x;
3367 if( lowerRight.
y > v.
End.
y )
3368 lowerRight.
y = v.
End.
y;
3375 VECTOR2I size = lowerRightKiCad - upperLeftKiCad;
3377 return { upperLeftKiCad,
VECTOR2I( abs( size.
x ), abs( size.
y ) ) };
3407 const double& aScalingFactor,
3409 const bool& aMirrorInvert )
3413 if( aScalingFactor != 1.0 )
3416 retVal -= aTransformCentre;
3417 retVal.
x =
KiROUND( retVal.
x * aScalingFactor );
3418 retVal.
y =
KiROUND( retVal.
y * aScalingFactor );
3419 retVal += aTransformCentre;
3423 MIRROR( retVal.
x, aTransformCentre.
x );
3425 if( !aRotation.
IsZero() )
3426 RotatePoint( retVal, aTransformCentre, aRotation );
3428 if( aMoveVector !=
VECTOR2I{ 0, 0 } )
3429 retVal += aMoveVector;
3437 return sqrt( ( (
double) aPoint.
x * (
double) aPoint.
x )
3438 + ( (
double) aPoint.
y * (
double) aPoint.
y ) );
constexpr EDA_IU_SCALE schIUScale
constexpr double SCH_IU_PER_MM
CADSTAR_PIN_TYPE
file: cadstar_archive_objects.h Contains common object definitions
#define SYMBOL_NAME_ATTRID
Symbol Name attribute ID - used for placement of designators on the schematic.
#define SIGNALNAME_ORIGIN_ATTRID
#define LINK_ORIGIN_ATTRID
const wxString PartAcceptanceFieldName
const wxString PartNumberFieldName
const wxString PartNameFieldName
const wxString PartVersionFieldName
Loads a csa file into a KiCad SCHEMATIC object.
coord_type GetTop() const
coord_type GetRight() const
coord_type GetLeft() const
const Vec & GetSize() const
coord_type GetBottom() const
BOX2< Vec > & Merge(const BOX2< Vec > &aRect)
Modify the position and size of the rectangle in order to contain aRect.
@ ANTICLOCKWISE_SEMICIRCLE
static wxString EscapeFieldText(const wxString &aFieldText)
@ FRACTIONALGRID
Param1 = Units, Param2 = Divisor.
static const long FONT_BOLD
static const std::map< TEXT_FIELD_NAME, wxString > CADSTAR_TO_KICAD_FIELDS
Map between CADSTAR fields and KiCad text variables.
long TERMINAL_ID
Terminal is the pin identifier in the schematic.
TEXT_FIELD_NAME
These are special fields in text objects enclosed between the tokens '<@' and '>' such as <@[FIELD_NA...
ALIGNMENT
From CADSTAR Help: "Text Alignment enables you to define the position of an alignment origin for all ...
@ NO_ALIGNMENT
NO_ALIGNMENT has different meaning depending on the object type.
static const long UNDEFINED_VALUE
static wxString generateLibName(const wxString &aRefName, const wxString &aAlternateName)
wxString LAYER_ID
ID of a Sheet (if schematic) or board Layer (if PCB)
static void FixTextPositionNoAlignment(EDA_TEXT *aKiCadTextItem)
Corrects the position of a text element that had NO_ALIGNMENT in CADSTAR.
@ OUTLINE
Unfilled closed shape.
@ OPENSHAPE
Unfilled open shape. Cannot have cutouts.
@ SOLID
Filled closed shape (solid fill).
@ HATCHED
Filled closed shape (hatch fill).
static const double TXT_HEIGHT_RATIO
CADSTAR fonts are drawn on a 24x24 integer matrix, where the each axis goes from 0 to 24.
void checkPoint()
Updates m_progressReporter or throws if user cancelled.
static wxString HandleTextOverbar(wxString aCadstarString)
Convert a string with CADSTAR overbar characters to equivalent in KiCad.
JUSTIFICATION
From CADSTAR Help: "Multi Line Text can also be justified as Left, Centre or Right.
PROGRESS_REPORTER * m_progressReporter
bool CheckFileHeader(const std::filesystem::path &aPath) const
CADSTAR_PARTS_LIB_MODEL ReadFile(const std::filesystem::path &aPath) const
void Load(SCHEMATIC *aSchematic, SCH_SHEET *aRootSheet)
Loads a CADSTAR Schematic Archive file into the KiCad SCHEMATIC object given.
ROUTECODE getRouteCode(const ROUTECODE_ID &aCadstarRouteCodeID)
std::map< BLOCK_PIN_ID, SCH_HIERLABEL * > m_sheetPinMap
Cadstar->KiCad Sheet Pins.
const int SMALL_LABEL_SIZE
VECTOR2I applyTransform(const VECTOR2I &aPoint, const VECTOR2I &aMoveVector={ 0, 0 }, const EDA_ANGLE &aRotation=ANGLE_0, const double &aScalingFactor=1.0, const VECTOR2I &aTransformCentre={ 0, 0 }, const bool &aMirrorInvert=false)
std::map< SYMBOL_ID, SCH_GLOBALLABEL * > m_globalLabelsMap
Cadstar->KiCad Global Labels.
SCH_SYMBOL * loadSchematicSymbol(const SYMBOL &aCadstarSymbol, const LIB_SYMBOL &aKiCadPart, EDA_ANGLE &aComponentOrientation)
void applyTextSettings(EDA_TEXT *aKiCadTextItem, const TEXTCODE_ID &aCadstarTextCodeID, const ALIGNMENT &aCadstarAlignment, const JUSTIFICATION &aCadstarJustification, const long long aCadstarOrientAngle=0, bool aMirrored=false)
wxString getAttributeName(const ATTRIBUTE_ID &aCadstarAttributeID)
std::vector< LIB_SYMBOL * > m_loadedSymbols
Loaded symbols so far.
PART getPart(const PART_ID &aCadstarPartID)
static LIB_FIELD * addNewFieldToSymbol(const wxString &aFieldName, std::unique_ptr< LIB_SYMBOL > &aKiCadSymbol)
std::vector< LAYER_ID > findOrphanSheets()
std::map< BUS_ID, std::shared_ptr< BUS_ALIAS > > m_busesMap
Cadstar->KiCad Buses.
int getSheetNumber(LAYER_ID aCadstarSheetID)
SCH_TEXT * getKiCadSchText(const TEXT &aCadstarTextElement)
std::map< TERMINAL_ID, wxString > TERMINAL_TO_PINNUM_MAP
Map between a terminal ID in a symbol definition to the pin number that should be imported into KiCad...
wxString getNetName(const NET_SCH &aNet)
std::pair< BLOCK_ID, TERMINAL_ID > BLOCK_PIN_ID
std::map< SYMBOL_ID, SCH_SYMBOL * > m_powerSymMap
Cadstar->KiCad Power Symbols.
std::pair< PART_ID, GATE_ID > PART_GATE_ID
void loadLibrarySymbolShapeVertices(const std::vector< VERTEX > &aCadstarVertices, VECTOR2I aSymbolOrigin, LIB_SYMBOL *aSymbol, int aGateNumber, int aLineThickness)
void loadDocumentationSymbols()
VECTOR2I getKiCadLibraryPoint(const VECTOR2I &aCadstarPoint, const VECTOR2I &aCadstarCentre)
PART::DEFINITION::PIN getPartDefinitionPin(const PART &aCadstarPart, const GATE_ID &aGateID, const TERMINAL_ID &aTerminalID)
std::map< wxString, TERMINAL_ID > PINNUM_TO_TERMINAL_MAP
std::map< SYMDEF_ID, PINNUM_TO_TERMINAL_MAP > m_symDefTerminalsMap
int getTextHeightFromTextCode(const TEXTCODE_ID &aCadstarTextCodeID)
TEXT_SPIN_STYLE getSpinStyle(const long long &aCadstarOrientation, bool aMirror)
double getPolarRadius(const VECTOR2I &aPoint)
void setFootprintOnSymbol(std::unique_ptr< LIB_SYMBOL > &aKiCadSymbol, const wxString &aFootprintName, const wxString &aFootprintAlternate)
void applyTextCodeIfExists(EDA_TEXT *aKiCadTextItem, const TEXTCODE_ID &aCadstarTextCodeID)
void copySymbolItems(std::unique_ptr< LIB_SYMBOL > &aSourceSym, std::unique_ptr< LIB_SYMBOL > &aDestSym, int aDestUnit, bool aOverrideFields=true)
int getLineThickness(const LINECODE_ID &aCadstarLineCodeID)
TEXTCODE getTextCode(const TEXTCODE_ID &aCadstarTextCodeID)
std::map< wxString, LIB_SYMBOL * > m_powerSymLibMap
NetName->KiCad Power Lib Symbol.
PLOT_DASH_TYPE getLineStyle(const LINECODE_ID &aCadstarLineCodeID)
std::map< std::pair< wxString, wxString >, SYMDEF_ID > m_SymDefNamesCache
Cache storing symbol names and alternates to symdef IDs.
std::map< PART_ID, TERMINAL_TO_PINNUM_MAP > m_pinNumsMap
Cadstar Part->KiCad Pin number map.
void loadHierarchicalSheetPins()
void loadSheetAndChildSheets(LAYER_ID aCadstarSheetID, const VECTOR2I &aPosition, VECTOR2I aSheetSize, const SCH_SHEET_PATH &aParentSheet)
std::vector< LIB_SYMBOL * > LoadPartsLib(const wxString &aFilename)
ELECTRICAL_PINTYPE getKiCadPinType(const CADSTAR_PIN_TYPE &aPinType)
wxString m_footprintLibName
Name of the footprint library to prepend all footprints with.
void loadItemOntoKiCadSheet(LAYER_ID aCadstarSheetID, SCH_ITEM *aItem)
int getKiCadLength(long long aCadstarLength)
std::map< PART_ID, LIB_SYMBOL * > m_partMap
Cadstar->KiCad Parts.
bool isAttributeVisible(const ATTRIBUTE_ID &aCadstarAttributeID)
VECTOR2I getKiCadPoint(const VECTOR2I &aCadstarPoint)
EDA_ANGLE getAngle(const long long &aCadstarAngle)
const double ARC_ACCURACY
std::map< wxString, SYMDEF_ID > m_DefaultSymDefNamesCache
Cache storing symbol names (default alternate) to symdef IDs.
void loadSymbolGateAndPartFields(const SYMDEF_ID &aSymdefID, const PART &aCadstarPart, const GATE_ID &aGateID, LIB_SYMBOL *aSymbol)
void loadFigure(const FIGURE &aCadstarFigure, const LAYER_ID &aCadstarSheetIDOverride, SCH_LAYER_ID aKiCadSchLayerID, const VECTOR2I &aMoveVector={ 0, 0 }, const EDA_ANGLE &aRotation=ANGLE_0, const double &aScalingFactor=1.0, const VECTOR2I &aTransformCentre={ 0, 0 }, const bool &aMirrorInvert=false)
std::map< PART_GATE_ID, SYMDEF_ID > m_partSymbolsMap
Map holding the symbols loaded so far for a particular PART_ID and GATE_ID.
void applyToLibraryFieldAttribute(const ATTRIBUTE_LOCATION &aCadstarAttrLoc, VECTOR2I aSymbolOrigin, LIB_FIELD *aKiCadField)
LIB_SYMBOL * getScaledLibPart(const LIB_SYMBOL *aSymbol, long long aScalingFactorNumerator, long long aScalingFactorDenominator)
SYMDEF_ID getSymDefFromName(const wxString &aSymdefName, const wxString &aSymDefAlternate)
std::pair< VECTOR2I, VECTOR2I > getFigureExtentsKiCad(const FIGURE &aCadstarFigure)
std::map< LAYER_ID, SCH_SHEET * > m_sheetMap
Cadstar->KiCad Sheets.
POINT getLocationOfNetElement(const NET_SCH &aNet, const NETELEMENT_ID &aNetElementID)
void fixUpLibraryPins(LIB_SYMBOL *aSymbolToFix, int aGateNumber)
std::map< SYMDEF_ID, std::unique_ptr< const LIB_SYMBOL > > m_symDefMap
Cadstar->KiCad Lib Symbols loaded so far.
std::unique_ptr< LIB_SYMBOL > loadLibPart(const CADSTAR_PART_ENTRY &aPart)
ALIGNMENT rotate180(const ALIGNMENT &aCadstarAlignment)
long long getCadstarAngle(const EDA_ANGLE &aAngle)
void loadChildSheets(LAYER_ID aCadstarSheetID, const SCH_SHEET_PATH &aSheet)
VECTOR2I m_designCenter
Required for calculating the offset to apply to the Cadstar design so that it fits in the KiCad canva...
ALIGNMENT mirrorX(const ALIGNMENT &aCadstarAlignment)
int getComponentOrientation(const EDA_ANGLE &aOrientAngle, EDA_ANGLE &aReturnedOrientation)
void loadShapeVertices(const std::vector< VERTEX > &aCadstarVertices, LINECODE_ID aCadstarLineCodeID, LAYER_ID aCadstarSheetID, SCH_LAYER_ID aKiCadSchLayerID, const VECTOR2I &aMoveVector={ 0, 0 }, const EDA_ANGLE &aRotation=ANGLE_0, const double &aScalingFactor=1.0, const VECTOR2I &aTransformCentre={ 0, 0 }, const bool &aMirrorInvert=false)
const LIB_SYMBOL * loadSymdef(const SYMDEF_ID &aSymdefID)
int getKiCadUnitNumberFromGate(const GATE_ID &aCadstarGateID)
void loadSymbolFieldAttribute(const ATTRIBUTE_LOCATION &aCadstarAttrLoc, const EDA_ANGLE &aComponentOrientation, bool aIsMirrored, SCH_FIELD *aKiCadField)
void loadSchematicSymbolInstances()
ASSIGNMENTS_SCM Assignments
CADSTAR_SCHEMATIC Schematic
int KiCadUnitDivider
Use this value to convert units in this CSA file to KiCad units.
PARTNAMECOL SymbolPartNameColor
void Parse()
Parses the file.
A base class for most all the KiCad significant classes used in schematics and boards.
virtual const BOX2I GetBoundingBox() const
Return the orthogonal bounding box of this object for display purposes.
KICAD_T Type() const
Returns the type of object.
virtual void SetParent(EDA_ITEM *aParent)
EDA_ITEM * GetParent() const
SHAPE_POLY_SET & GetPolyShape()
void SetPolyShape(const SHAPE_POLY_SET &aShape)
const VECTOR2I & GetEnd() const
Return the ending point of the graphic.
void SetStart(const VECTOR2I &aStart)
const VECTOR2I & GetStart() const
Return the starting point of the graphic.
void SetEnd(const VECTOR2I &aEnd)
void SetArcGeometry(const VECTOR2I &aStart, const VECTOR2I &aMid, const VECTOR2I &aEnd)
Set the three controlling points for an arc.
void SetFillMode(FILL_T aFill)
A mix-in class (via multiple inheritance) that handles texts such as labels, parts,...
int GetTextHeight() const
const EDA_ANGLE & GetTextAngle() const
virtual const wxString & GetText() const
Return the string associated with the text object.
void SetTextPos(const VECTOR2I &aPoint)
void SetVertJustify(GR_TEXT_V_ALIGN_T aType)
void SetTextWidth(int aWidth)
virtual void SetVisible(bool aVisible)
void SetTextThickness(int aWidth)
The TextThickness is that set by the user.
void SetTextHeight(int aHeight)
void SetTextSize(const VECTOR2I &aNewSize)
virtual void SetText(const wxString &aText)
virtual void SetTextAngle(const EDA_ANGLE &aAngle)
int GetTextThickness() const
void SetItalic(bool aItalic)
void SetMultilineAllowed(bool aAllow)
VECTOR2I GetTextSize() const
void SetHorizJustify(GR_TEXT_H_ALIGN_T aType)
iterator end()
Returns a read/write iterator that points to one past the last element in the EE_RTREE.
iterator begin()
Returns a read/write iterator that points to the first element in the EE_RTREE N.B.
Field object used in symbol libraries.
void SetName(const wxString &aName)
Set a user definable field name to aName.
wxString GetName(bool aUseDefaultName=true) const
Return the field name (not translated).
A logical library item identifier and consists of various portions much like a URI.
int SetLibItemName(const UTF8 &aLibItemName)
Override the library item name portion of the LIB_ID to aLibItemName.
The base class for drawable items used by schematic library symbols.
void SetPosition(const VECTOR2I &aPosition) override
void SetNumber(const wxString &aNumber)
void SetStroke(const STROKE_PARAMS &aStroke)
void AddPoint(const VECTOR2I &aPosition)
void SetPosition(const VECTOR2I &aPosition) override
VECTOR2I GetPosition() const override
Define a library symbol object.
void SetShowPinNames(bool aShow)
Set or clear the pin name visibility flag.
LIB_FIELD & GetReferenceField()
Return reference to the reference designator field.
void SetUnitCount(int aCount, bool aDuplicateDrawItems=true)
Set the units per symbol count.
void SetShowPinNumbers(bool aShow)
Set or clear the pin number visibility flag.
LIB_ITEMS_CONTAINER & GetDrawItems()
Return a reference to the draw item list.
wxString GetName() const override
void AddDrawItem(LIB_ITEM *aItem, bool aSort=true)
Add a new draw aItem to the draw object list and sort according to aSort.
LIB_FIELD & GetValueField()
Return reference to the value field.
std::vector< LIB_PIN * > GetAllLibPins() const
Return a list of pin pointers for all units / converts.
void GetPins(LIB_PINS &aList, int aUnit=0, int aConvert=0) const
Return a list of pin object pointers from the draw item list.
virtual void SetName(const wxString &aName)
Define a symbol library graphical text item.
VECTOR2I GetPosition() const override
ITERATOR_BASE< LIB_ITEM, MULTIVECTOR< LIB_ITEM, FIRST_TYPE_VAL, LAST_TYPE_VAL >, typename ITEM_PTR_VECTOR::iterator > ITERATOR
The const iterator.
ITERATOR end(int aType=UNDEFINED_TYPE)
ITERATOR begin(int aType=UNDEFINED_TYPE)
Describe the page size and margins of a paper page on which to eventually print or plot.
void SetWidthMils(int aWidthInMils)
void SetHeightMils(int aHeightInMils)
const VECTOR2I GetSizeIU(double aIUScale) const
Gets the page size in internal units.
virtual void SetNumPhases(int aNumPhases)=0
Set the number of phases.
virtual void BeginPhase(int aPhase)=0
Initialize the aPhase virtual zone of the dialog progress bar.
virtual void SetMaxProgress(int aMaxProgress)=0
Fix the value that gives the 100 percent progress bar length (inside the current virtual zone).
Container for project specific data.
virtual const wxString GetProjectPath() const
Return the full path of the project.
virtual std::map< wxString, wxString > & GetTextVars() const
virtual REPORTER & Report(const wxString &aText, SEVERITY aSeverity=RPT_SEVERITY_UNDEFINED)=0
Report a string with a given severity.
Holds all the data relating to one schematic.
PROJECT & Prj() const override
Return a reference to the project this schematic is part of.
void SetSize(const VECTOR2I &aSize)
Class for a wire to bus entry.
Instances are attached to a symbol or sheet and provide a place for the symbol's value,...
wxString GetName(bool aUseDefaultName=true) const
Return the field name (not translated).
void SetPosition(const VECTOR2I &aPosition) override
void SetTextSpinStyle(TEXT_SPIN_STYLE aSpinStyle) override
Set a spin or rotation angle, along with specific horizontal and vertical justification styles with e...
void SetTextSpinStyle(TEXT_SPIN_STYLE aSpinStyle) override
Set a spin or rotation angle, along with specific horizontal and vertical justification styles with e...
Base class for any item which can be embedded within the SCHEMATIC container class,...
void SetLayer(SCH_LAYER_ID aLayer)
Set the layer this item is on.
SCH_ITEM * Duplicate(bool doClone=false) const
Routine to create a new copy of given item.
void SetPosition(const VECTOR2I &aPosition) override
void SetPosition(const VECTOR2I &aPosition) override
void SetShape(LABEL_FLAG_SHAPE aShape) override
void AutoplaceFields(SCH_SCREEN *aScreen, bool aManual) override
Segment description base class to describe items which have 2 end points (track, wire,...
void SetStartPoint(const VECTOR2I &aPosition)
void SetLineWidth(const int aSize)
VECTOR2I GetEndPoint() const
VECTOR2I GetStartPoint() const
void SetLineStyle(const PLOT_DASH_TYPE aStyle)
void SetEndPoint(const VECTOR2I &aPosition)
const PAGE_INFO & GetPageSettings() const
void Append(SCH_ITEM *aItem, bool aUpdateLibSymbol=true)
void AddBusAlias(std::shared_ptr< BUS_ALIAS > aAlias)
Add a bus alias definition (and transfers ownership of the pointer).
void SetPageSettings(const PAGE_INFO &aPageSettings)
EE_RTREE & Items()
Gets the full RTree, usually for iterating.
void SetFileName(const wxString &aFileName)
Set the file name for this screen to aFileName.
void Update(SCH_ITEM *aItem, bool aUpdateLibSymbol=true)
Update aItem's bounding box in the tree.
Handle access to a stack of flattened SCH_SHEET objects by way of a path for creating a flattened sch...
void SetPageNumber(const wxString &aPageNumber)
Set the sheet instance user definable page number.
SCH_SHEET * Last() const
Return a pointer to the last SCH_SHEET of the list.
void push_back(SCH_SHEET *aSheet)
Forwarded method from std::vector.
Define a sheet pin (label) used in sheets to create hierarchical schematics.
Sheet symbol placed in a schematic, and is the entry point for a sub schematic.
void AddPin(SCH_SHEET_PIN *aSheetPin)
Add aSheetPin to the sheet.
std::vector< SCH_FIELD > & GetFields()
bool LocatePathOfScreen(SCH_SCREEN *aScreen, SCH_SHEET_PATH *aList)
Search the existing hierarchy for an instance of screen loaded from aFileName.
SCH_SCREEN * GetScreen() const
VECTOR2I GetPosition() const override
void SetFields(const std::vector< SCH_FIELD > &aFields)
Set multiple schematic fields.
void SetScreen(SCH_SCREEN *aScreen)
Set the SCH_SCREEN associated with this sheet to aScreen.
void AutoplaceFields(SCH_SCREEN *aScreen, bool aManual) override
static bool ClassOf(const EDA_ITEM *aItem)
void SetPosition(const VECTOR2I &aPosition) override
int GetFieldCount() const
Return the number of fields in this symbol.
SCH_FIELD * FindField(const wxString &aFieldName, bool aIncludeDefaultFields=true)
Search for a SCH_FIELD with aFieldName.
SCH_FIELD * GetField(MANDATORY_FIELD_T aFieldType)
Return a mandatory field in this symbol.
void UpdatePins()
Updates the cache of SCH_PIN objects for each pin.
void SetRef(const SCH_SHEET_PATH *aSheet, const wxString &aReference)
Set the reference for the given sheet path for this symbol.
void SetOrientation(int aOrientation)
Compute the new transform matrix based on aOrientation for the symbol which is applied to the current...
SCH_FIELD * AddField(const SCH_FIELD &aField)
Add a field to the symbol.
BOX2I GetBodyAndPinsBoundingBox() const
Return a bounding box for the symbol body and pins but not the fields.
void GetFields(std::vector< SCH_FIELD * > &aVector, bool aVisibleOnly)
Populate a std::vector with SCH_FIELDs.
std::unique_ptr< LIB_SYMBOL > & GetLibSymbolRef()
VECTOR2I GetPosition() const override
void SetPosition(const VECTOR2I &aPosition) override
const BOX2I GetBoundingBox() const override
Return the orthogonal bounding box of this object for display purposes.
virtual void SetTextSpinStyle(TEXT_SPIN_STYLE aSpinStyle)
Set a spin or rotation angle, along with specific horizontal and vertical justification styles with e...
const VECTOR2I & GetArcMid() const
const VECTOR2I & GetP1() const
const VECTOR2I & GetP0() const
Represent a polyline containing arcs as well as line segments: A chain of connected line and/or arc s...
const SHAPE_LINE_CHAIN Reverse() const
Reverse point order in the line chain.
void SetPoint(int aIndex, const VECTOR2I &aPos)
Move a point to a specific location.
int FindSegment(const VECTOR2I &aP, int aThreshold=1) const
Search for segment containing point aP.
int Intersect(const SEG &aSeg, INTERSECTIONS &aIp) const
Find all intersection points between our line chain and the segment aSeg.
void Replace(int aStartIndex, int aEndIndex, const VECTOR2I &aP)
Replace points with indices in range [start_index, end_index] with a single point aP.
virtual size_t GetPointCount() const override
void Append(int aX, int aY, bool aAllowDuplication=false)
Append a new point at the end of the line chain.
const VECTOR2I & CPoint(int aIndex) const
Return a reference to a given point in the line chain.
const VECTOR2I NearestPoint(const VECTOR2I &aP, bool aAllowInternalShapePoints=true) const
Find a point on the line chain that is closest to point aP.
std::vector< INTERSECTION > INTERSECTIONS
const std::vector< VECTOR2I > & CPoints() const
SHAPE_LINE_CHAIN & Outline(int aIndex)
Return the reference to aIndex-th outline in the set.
Simple container to manage line stroke parameters.
TEXT_SPIN_STYLE MirrorY()
Mirror the label spin style across the Y axis or simply swaps left and right.
TEXT_SPIN_STYLE RotateCCW()
TEXT_SPIN_STYLE MirrorX()
Mirror the label spin style across the X axis or simply swaps up and bottom.
T EuclideanNorm() const
Compute the Euclidean norm of the vector, which is defined as sqrt(x ** 2 + y ** 2).
#define DEFAULT_WIRE_WIDTH_MILS
The default bus width in mils. (can be changed in preference menu)
static constexpr EDA_ANGLE & ANGLE_180
static constexpr EDA_ANGLE & ANGLE_HORIZONTAL
static constexpr EDA_ANGLE & ANGLE_VERTICAL
static constexpr EDA_ANGLE & ANGLE_45
static constexpr EDA_ANGLE & ANGLE_90
static constexpr EDA_ANGLE & ANGLE_0
static constexpr EDA_ANGLE & ANGLE_270
static constexpr EDA_ANGLE & ANGLE_135
const std::string KiCadSchematicFileExtension
#define THROW_IO_ERROR(msg)
SCH_LAYER_ID
Eeschema drawing layers.
std::vector< LIB_PIN * > LIB_PINS
Helper for defining a list of pin object pointers.
This file contains miscellaneous commonly used macros and functions.
#define KI_FALLTHROUGH
The KI_FALLTHROUGH macro is to be used when switch statement cases should purposely fallthrough from ...
void MIRROR(T &aPoint, const T &aMirrorRef)
Updates aPoint with the mirror of aPoint relative to the aMirrorRef.
bool contains(const _Container &__container, _Value __value)
Returns true if the container contains the given value.
ELECTRICAL_PINTYPE
The symbol library pin object electrical types used in ERC tests.
Definition of the SCH_SHEET_PATH and SCH_SHEET_LIST classes for Eeschema.
std::vector< SCH_FIELD > SCH_FIELDS
A container for several SCH_FIELD items.
#define SIM_DEVICE_TYPE_FIELD
void wxStringSplit(const wxString &aText, wxArrayString &aStrings, wxChar aSplitter)
Split aString to a string list separated at aSplitter.
bool ReplaceIllegalFileNameChars(std::string *aName, int aReplaceChar)
Checks aName for illegal file name characters.
wxString EscapeString(const wxString &aSource, ESCAPE_CONTEXT aContext)
The Escape/Unescape routines use HTML-entity-reference-style encoding to handle characters which are:...
PLOT_DASH_TYPE
Dashed line types.
std::map< ATTRIBUTE_ID, ATTRCOL > AttributeColors
JUSTIFICATION Justification
Note: Justification has no effect on single lines of text.
ALIGNMENT Alignment
In CADSTAR The default alignment for a TEXT object (when "(No Alignment()" is selected) Bottom Left o...
ATTRIBUTE_LOCATION AttributeLocation
bool HasLocation
Flag to know if this ATTRIBUTE_VALUE has a location i.e.
std::map< LINECODE_ID, LINECODE > LineCodes
std::map< ATTRIBUTE_ID, ATTRNAME > AttributeNames
std::map< ROUTECODE_ID, ROUTECODE > RouteCodes
std::map< TEXTCODE_ID, TEXTCODE > TextCodes
Represents a cutout in a closed shape (e.g.
std::vector< VERTEX > Vertices
long ScaleRatioNumerator
Documentation symbols can be arbitrarily scaled when added to a design.
long ScaleRatioDenominator
Documentation symbols can be arbitrarily scaled when added to a design.
POINT Origin
Origin of the component (this is used as the reference point when placing the component in the design...
LAYER_ID LayerID
Move all objects in the Symdef to this layer.
DOCUMENTATION_SYMBOL_ID ID
SYMDEF_ID SymdefID
Normally documentation symbols only have TEXT, FIGURE and TEXT_LOCATION objects which are all drawn o...
long Modifier1
It seems this is related to weight. 400=Normal, 700=Bold.
GRID ScreenGrid
From CADSTAR Help: "There is one Screen Grid, which is visible as dots on the screen.
long Param1
Either Units or X step, depending on Type (see GRID_TYPE for more details)
long Param2
Either Divisor or Y step, depending on Type (see GRID_TYPE for more details)
wxString Name
This is undefined (wxEmptyString) if the net is unnamed.
long SignalNum
This is undefined if the net has been given a name.
std::map< TEXT_FIELD_NAME, wxString > TextFieldToValuesMap
Values for the text field elements used in the CADSTAR design extracted from the text element instanc...
std::map< wxString, wxString > FilenamesToTextMap
CADSTAR doesn't have user defined text fields but does allow loading text from a file.
std::set< TEXT_FIELD_NAME > InconsistentTextFields
Text fields need to be updated in CADSTAR and it is possible that they are not consistent across text...
std::map< PART_ID, PART > PartDefinitions
bool HidePinNames
Specifies whether to display the pin names/identifier in the schematic symbol or not.
std::map< GATE_ID, GATE > GateSymbols
std::map< ATTRIBUTE_ID, ATTRIBUTE_VALUE > AttributeValues
Some attributes are defined within the part definition, whilst others are defined in the part.
std::map< PART_DEFINITION_PIN_ID, PIN > Pins
std::map< ATTRIBUTE_ID, ATTRIBUTE_VALUE > AttributeValues
Some attributes are defined within the part definition, whilst others are defined in the part itself.
Represents a point in x,y coordinates.
SHAPE_POLY_SET ConvertToPolySet(const std::function< VECTOR2I(const VECTOR2I &)> aCadstarToKicadPointCallback, double aAccuracy) const
std::vector< VERTEX > Vertices
std::vector< CUTOUT > Cutouts
Not Applicable to OPENSHAPE Type.
std::map< FIGURE_ID, FIGURE > Figures
std::map< ATTRIBUTE_ID, TEXT_LOCATION > TextLocations
This contains location of any attributes, including designator position.
POINT Origin
Origin of the component (this is used as the reference point when placing the component in the design...
wxString Alternate
This is in addition to ReferenceName.
std::map< TEXT_ID, TEXT > Texts
std::map< ATTRIBUTE_ID, ATTRIBUTE_VALUE > AttributeValues
These attributes might also have a location.
wxString BuildLibName() const
long Width
Defaults to 0 if using system fonts or, if using CADSTAR font, default to equal height (1:1 aspect ra...
Corresponds to CADSTAR "origin".
ALIGNMENT Alignment
In CADSTAR The default alignment for a TEXT object (when "(No Alignment()" is selected) Bottom Left o...
JUSTIFICATION Justification
Note: Justification has no effect on single lines of text.
std::map< VARIANT_ID, VARIANT > Variants
< Nodename = "VARIANT" or "VMASTER" (master variant
Represents a vertex in a shape.
SHAPE_ARC BuildArc(const VECTOR2I &aPrevPoint, const std::function< VECTOR2I(const VECTOR2I &)> aCadstarToKicadPointCallback) const
CADSTAR Parts Library (*.lib) model - a data structure describing the contents of the file format.
std::vector< CADSTAR_PART_ENTRY > m_PartEntries
std::string m_ComponentStem
std::map< std::string, std::vector< CADSTAR_PART_PIN > > m_HiddenPins
Pins with an implied electrical connection to a net, not part of any symbol (Note: we probably will n...
std::map< std::string, CADSTAR_ATTRIBUTE_VALUE > m_SchAttributes
Dollar sign ($) line $[!]<SCM Attribute name>(<Attribute value>) Attributes related to the schematic ...
std::map< std::string, CADSTAR_ATTRIBUTE_VALUE > m_SchAndPcbAttributes
At symbol (@) line [@[!]<SCM/PCB Attribute name>(<Attribute value>)] Attributes related to the PCB co...
std::vector< CADSTAR_PART_SYMBOL_ENTRY > m_Symbols
Symbols that form this part.
std::map< std::string, std::string > m_UserAttributes
Star (*) line *<User-defined name> This line is ignored by CADSTAR.
std::map< long, std::string > m_PinNamesMap
Map of pin identifiers to alphanumeric pin names Pin names can be a maximum of 10 characters (Typical...
std::optional< std::string > m_AcceptancePartName
std::optional< std::string > m_Pcb_alternate
std::optional< std::string > m_Version
std::optional< std::string > m_Description
std::optional< std::string > m_Number
std::string m_Pcb_component
std::optional< std::string > m_SpiceModel
std::map< std::string, CADSTAR_ATTRIBUTE_VALUE > m_PcbAttributes
Percentage sign (%) line %[!]<PCB Attribute name>(<Attribute value>) Attributes related to the PCB co...
std::optional< std::string > m_Value
std::map< std::string, CADSTAR_ATTRIBUTE_VALUE > m_PartAttributes
Tilde (~) line ~[!]<Parts Library Attribute Name>(<Attribute Value>) Attributes related to the Part i...
std::vector< CADSTAR_PART_PIN > m_Pins
std::optional< std::string > m_SymbolAlternateName
TYPE Type
Determines what the associated layer is, whether parent, child or clone.
ATTRIBUTE_LOCATION BlockLabel
LAYER_ID LayerID
The sheet block is on (TODO: verify this is true)
LAYER_ID AssocLayerID
Parent or Child linked sheet.
std::map< TERMINAL_ID, TERMINAL > Terminals
std::map< FIGURE_ID, FIGURE > Figures
LAYER_ID LayerID
Sheet on which bus is located.
std::map< SYMBOL_ID, SYMBOL > Symbols
std::map< REUSEBLOCK_ID, REUSEBLOCK > ReuseBlocks
VARIANT_HIERARCHY VariantHierarchy
std::map< DOCUMENTATION_SYMBOL_ID, DOCUMENTATION_SYMBOL > DocumentationSymbols
std::map< FIGURE_ID, FIGURE > Figures
std::map< TEXT_ID, TEXT > Texts
std::map< BLOCK_ID, BLOCK > Blocks
std::map< BUS_ID, BUS > Buses
std::map< GROUP_ID, GROUP > Groups
std::map< NET_ID, NET_SCH > Nets
ATTRIBUTE_LOCATION AttrLoc
std::map< SYMDEF_ID, SYMDEF_SCM > SymbolDefinitions
std::map< NETELEMENT_ID, DANGLER > Danglers
std::map< NETELEMENT_ID, SYM_TERM > Terminals
std::vector< CONNECTION_SCH > Connections
std::map< NETELEMENT_ID, BUS_TERM > BusTerminals
std::map< NETELEMENT_ID, BLOCK_TERM > BlockTerminals
std::map< NETELEMENT_ID, JUNCTION_SCH > Junctions
ATTRIBUTE_LOCATION AttrLoc
std::vector< LAYER_ID > SheetOrder
A vector to also store the order in which sheets are to be displayed.
std::map< LAYER_ID, SHEET_NAME > SheetNames
LAYER_ID LayerID
Sheet on which symbol is located.
SYMBOL_ID VariantParentSymbolID
std::map< ATTRIBUTE_ID, ATTRIBUTE_VALUE > AttributeValues
GATE_ID GateID
The gate this symbol represents within the associated Part.
long ScaleRatioNumerator
Symbols can be arbitrarily scaled in CADSTAR.
std::map< TERMINAL_ID, SYMPINNAME_LABEL > PinNames
Identifier of the pin in the PCB Equivalent to KiCad's Pin Number.
std::map< TERMINAL_ID, PIN_NUM > PinNumbers
This seems to only appear in older designs and is similar to PinNames but only allowing numerical val...
long ScaleRatioDenominator
SYMBOLVARIANT SymbolVariant
std::map< TERMINAL_ID, PIN_NUM_LABEL_LOC > PinLabelLocations
std::map< TERMINAL_ID, PIN_NUM_LABEL_LOC > PinNumberLocations
std::map< TERMINAL_ID, TERMINAL > Terminals
POINT Position
Pad position within the component's coordinate frame.
constexpr int IUToMils(int iu) const
constexpr int MilsToIU(int mils) const
@ VALUE_FIELD
Field Value of part, i.e. "3.3K".
@ REFERENCE_FIELD
Field Reference of part, i.e. "IC21".
void RotatePoint(int *pX, int *pY, const EDA_ANGLE &aAngle)
constexpr ret_type KiROUND(fp_type v)
Round a floating point number to an integer using "round halfway cases away from zero".
int LexicographicalCompare(const VECTOR2< T > &aA, const VECTOR2< T > &aB)
Definition of file extensions used in Kicad.