70 _(
"The selected file does not appear to be a CADSTAR parts Library file" ) );
82 std::vector<LIB_SYMBOL*> retVal;
86 std::unique_ptr<LIB_SYMBOL> loadedPart =
loadLibPart( part );
91 retVal.push_back( loadedPart.release() );
98std::unique_ptr<LIB_SYMBOL>
102 std::unique_ptr<LIB_SYMBOL> retSym;
115 wxString::Format(
_(
"Unable to find symbol %s, referenced by part %s. The "
116 "part was not loaded." ),
125 std::unique_ptr<LIB_SYMBOL> kiSymDef(
loadSymdef( symbolID )->Duplicate() );
127 if( (
int)sym.
m_Pins.size() != kiSymDef->GetPinCount() )
130 wxString::Format(
_(
"Inconsistent pin numbers in symbol %s compared to the one "
131 "defined in part %s. The part was not loaded." ),
145 wxCHECK( termID > 0 && sym.
m_Pins.size() >=
size_t( termID ),
nullptr );
146 SCH_PIN*
pin = kiSymDef->GetPin( storedPinNum );
147 size_t termIdx = size_t( termID ) - 1;
156 wxString partPinNum = wxString::Format(
"%ld", sym.
m_Pins[termIdx].m_Identifier );
157 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<SCH_PIN>
pin = std::make_unique<SCH_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(
SCH_ITEM* item : aDestSym->GetUnitDrawItems( aDestUnit, 0 ) )
287 aDestSym->RemoveDrawItem( item );
290 for(
SCH_ITEM* newItem : aSourceSym->GetUnitDrawItems( 1, 0 ) )
294 itemCopy->
SetUnit( aDestUnit );
295 aDestSym->AddDrawItem( itemCopy );
299 if( aOverrideFields )
301 std::vector<SCH_FIELD*> fieldsToCopy;
302 aSourceSym->GetFields( fieldsToCopy );
304 for(
SCH_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(
"}" ) );
1075 label->
SetText( wxT(
"{" ) + busname + wxT(
"}" ) );
1090 wxString netName = net.
Name;
1091 std::map<NETELEMENT_ID, SCH_LABEL*> netlabels;
1093 if( netName.IsEmpty() )
1094 netName = wxString::Format(
"$%ld", net.
SignalNum );
1098 for( std::pair<NETELEMENT_ID, NET_SCH::SYM_TERM> terminalPair : net.
Terminals )
1100 NET_SCH::SYM_TERM netTerm = terminalPair.second;
1109 if( netTerm.HasNetLabel )
1114 applyTextSettings( val, netTerm.NetLabel.TextCodeID, netTerm.NetLabel.Alignment,
1115 netTerm.NetLabel.Justification, netTerm.NetLabel.OrientAngle,
1116 netTerm.NetLabel.Mirror );
1134 && netTerm.HasNetLabel )
1144 applyTextSettings( label, netTerm.NetLabel.TextCodeID, netTerm.NetLabel.Alignment,
1145 netTerm.NetLabel.Justification );
1147 netlabels.insert( { netTerm.ID, label } );
1150 m_sheetMap.at( sheet )->GetScreen()->Append( label );
1154 auto getHierarchicalLabel =
1157 if( aNode.Contains(
"BLKT" ) )
1160 BLOCK_PIN_ID blockPinID = std::make_pair( blockTerm.BlockID,
1161 blockTerm.TerminalID );
1171 for( std::pair<NETELEMENT_ID, NET_SCH::BLOCK_TERM> blockPair : net.
BlockTerminals )
1173 SCH_HIERLABEL* label = getHierarchicalLabel( blockPair.first );
1180 for( std::pair<NETELEMENT_ID, NET_SCH::BUS_TERM> busPair : net.
BusTerminals )
1182 NET_SCH::BUS_TERM busTerm = busPair.second;
1186 m_busesMap.at( bus.
ID )->Members().emplace_back( netName );
1206 if( busTerm.HasNetLabel )
1208 applyTextSettings( label, busTerm.NetLabel.TextCodeID, busTerm.NetLabel.Alignment,
1209 busTerm.NetLabel.Justification );
1216 netlabels.insert( { busTerm.ID, label } );
1220 for( std::pair<NETELEMENT_ID, NET_SCH::DANGLER> danglerPair : net.
Danglers )
1222 NET_SCH::DANGLER dangler = danglerPair.second;
1228 if( dangler.HasNetLabel )
1230 applyTextSettings( label, dangler.NetLabel.TextCodeID, dangler.NetLabel.Alignment,
1231 dangler.NetLabel.Justification );
1235 netlabels.insert( { dangler.ID, label } );
1237 m_sheetMap.at( dangler.LayerID )->GetScreen()->Append( label );
1240 for( NET_SCH::CONNECTION_SCH conn : net.
Connections )
1242 if( conn.LayerID == wxT(
"NO_SHEET" ) )
1253 if( conn.Path.size() < 1 || conn.Path.front() != start )
1254 conn.Path.insert( conn.Path.begin(), start );
1256 if( conn.Path.size() < 2 || conn.Path.back() != end )
1257 conn.Path.push_back( end );
1259 bool firstPt =
true;
1260 bool secondPt =
false;
1266 for(
POINT pt : conn.Path )
1276 std::vector<NETELEMENT_ID> nodes;
1277 nodes.push_back( conn.StartNode );
1278 nodes.push_back( conn.EndNode );
1293 int leftSide = sheetPosition.
x;
1294 int rightSide = sheetPosition.
x + sheetSize.
x;
1295 int topSide = sheetPosition.
y;
1296 int botSide = sheetPosition.
y + sheetSize.
y;
1300 sheetEdge.
Append( leftSide, topSide );
1301 sheetEdge.
Append( rightSide, topSide );
1302 sheetEdge.
Append( rightSide, botSide );
1303 sheetEdge.
Append( leftSide, botSide );
1304 sheetEdge.
Append( leftSide, topSide );
1308 if( !wireChain.
Intersect( sheetEdge, wireToSheetIntersects ) )
1313 if( node == conn.StartNode )
1314 wireChain = wireChain.
Reverse();
1318 if( node == conn.StartNode )
1319 wireChain = wireChain.
Reverse();
1325 VECTOR2I intsctPt = wireToSheetIntersects.at( 0 ).p;
1326 int intsctIndx = wireChain.
FindSegment( intsctPt );
1327 wxASSERT_MSG( intsctIndx != -1,
"Can't find intersecting segment" );
1329 if( node == conn.StartNode )
1330 wireChain.
Replace( 0, intsctIndx, intsctPt );
1332 wireChain.
Replace( intsctIndx + 1, -1, intsctPt );
1340 auto fixNetLabelsAndSheetPins =
1345 if( netlabels.find( aNetEleID ) != netlabels.end() )
1346 netlabels.at( aNetEleID )->SetSpinStyle( spin.
MirrorY() );
1348 SCH_HIERLABEL* sheetPin = getHierarchicalLabel( aNetEleID );
1370 fixNetLabelsAndSheetPins( wireAngle, conn.StartNode );
1379 if( !conn.ConnectionLineCode.IsEmpty() )
1384 m_sheetMap.at( conn.LayerID )->GetScreen()->Append( wire );
1391 fixNetLabelsAndSheetPins( wireAngle, conn.EndNode );
1395 for( std::pair<NETELEMENT_ID, NET_SCH::JUNCTION_SCH> juncPair : net.
Junctions )
1397 NET_SCH::JUNCTION_SCH junc = juncPair.second;
1402 m_sheetMap.at( junc.LayerID )->GetScreen()->Append( kiJunc );
1404 if( junc.HasNetLabel )
1418 m_sheetMap.at( junc.LayerID )->GetScreen()->Append( label );
1429 FIGURE fig = figPair.second;
1440 TEXT txt = textPair.second;
1450 for( std::pair<DOCUMENTATION_SYMBOL_ID, DOCUMENTATION_SYMBOL> docSymPair :
1457 m_reporter->
Report( wxString::Format(
_(
"Documentation Symbol '%s' refers to symbol "
1458 "definition ID '%s' which does not exist in "
1459 "the library. The symbol was not loaded." ),
1472 bool mirrorInvert = docSym.
Mirror;
1474 for( std::pair<FIGURE_ID, FIGURE> figPair : docSymDef.
Figures )
1476 FIGURE fig = figPair.second;
1479 centreOfTransform, mirrorInvert );
1482 for( std::pair<TEXT_ID, TEXT> textPair : docSymDef.
Texts )
1484 TEXT txt = textPair.second;
1486 txt.
Mirror = ( txt.
Mirror ) ? !mirrorInvert : mirrorInvert;
1492 scalingFactor, centreOfTransform, mirrorInvert );
1511 auto findAndReplaceTextField =
1535 std::map<wxString, wxString>& txtVars = pj->
GetTextVars();
1551 wxString varValue = txtvalue.second;
1553 txtVars.insert( { varName, varValue } );
1558 wxString varName = txtvalue.first;
1559 wxString varValue = txtvalue.second;
1561 txtVars.insert( { varName, varValue } );
1566 m_reporter->
Report(
_(
"Text Variables could not be set as there is no project attached." ),
1574 std::unique_ptr<LIB_SYMBOL>& aKiCadSymbol )
1577 SCH_FIELD* existingField = aKiCadSymbol->FindField( aFieldName );
1579 if( existingField !=
nullptr )
1580 return existingField;
1582 int newfieldID = aKiCadSymbol->GetFieldCount();
1584 newfield->
SetName( aFieldName );
1586 aKiCadSymbol->AddField( newfield );
1605 std::unique_ptr<LIB_SYMBOL> kiSym = std::make_unique<LIB_SYMBOL>( csSym.
BuildLibName() );
1606 const int gateNumber = 1;
1609 for( std::pair<FIGURE_ID, FIGURE> figPair : csSym.
Figures )
1611 FIGURE fig = figPair.second;
1628 return getKiCadLibraryPoint( aPt, csSym.Origin );
1641 shape->
SetFillMode( FILL_T::FILLED_WITH_BG_BODYCOLOR );
1643 kiSym->AddDrawItem( shape );
1650 for( std::pair<TERMINAL_ID, TERMINAL> termPair : csSym.
Terminals )
1653 wxString pinNum = wxString::Format(
"%ld", term.
ID );
1654 wxString pinName = wxEmptyString;
1655 std::unique_ptr<SCH_PIN>
pin = std::make_unique<SCH_PIN>( kiSym.get() );
1658 pin->SetType( ELECTRICAL_PINTYPE::PT_PASSIVE );
1661 pin->SetLength( 0 );
1662 pin->SetShape( GRAPHIC_PINSHAPE::LINE );
1663 pin->SetUnit( gateNumber );
1664 pin->SetNumber( pinNum );
1665 pin->SetName( pinName );
1683 pin->SetNumberTextSize( pinNumberHeight );
1684 pin->SetNameTextSize( pinNameHeight );
1686 pinNumToTerminals.insert( {
pin->GetNumber(), term.
ID } );
1687 kiSym->AddDrawItem(
pin.release() );
1695 for( std::pair<TEXT_ID, TEXT> textPair : csSym.
Texts )
1697 TEXT csText = textPair.second;
1699 auto libtext = std::make_unique<SCH_TEXT>( pos, csText.
Text,
LAYER_DEVICE );
1701 libtext->SetUnit( gateNumber );
1703 libtext->SetMultilineAllowed(
true );
1709 if( csText.
Text.Contains(
"\n" ) )
1711 wxArrayString strings;
1713 wxPoint firstLinePos;
1715 for(
size_t ii = 0; ii < strings.size(); ++ii )
1717 BOX2I bbox = libtext->GetTextBox( ii,
true );
1720 RotatePoint( linePos, libtext->GetTextPos(), -libtext->GetTextAngle() );
1723 textLine->
SetText( strings[ii] );
1730 kiSym->AddDrawItem( textLine );
1736 libtext->SetMultilineAllowed(
false );
1737 kiSym->AddDrawItem( libtext.release() );
1759 wxCHECK( partField,
nullptr );
1775 for(
auto& [attributeId, textLocation] : csSym.
TextLocations )
1800 if( attrValue.HasLocation )
1807 m_symDefMap.insert( { aSymdefID, std::move( kiSym ) } );
1814 const PART& aCadstarPart,
1820 std::unique_ptr<LIB_SYMBOL> kiSymDef(
loadSymdef( aSymdefID )->Duplicate() );
1821 wxCHECK( kiSymDef, );
1824 std::unique_ptr<LIB_SYMBOL> tempSymbol( aSymbol );
1832 SCH_PIN*
pin = kiSymDef->GetPin( storedPinNum );
1837 if( pinNum.IsEmpty() )
1839 if( !csPin.Identifier.IsEmpty() )
1840 pinNum = csPin.Identifier;
1842 pinNum = wxString::Format(
"%ld", termID );
1844 pinNum = wxString::Format(
"%ld", csPin.ID );
1848 pin->SetNumber( pinNum );
1849 pin->SetName( pinName );
1851 pinNumMap.insert( { termID, pinNum } );
1862 tempSymbol->GetValueField().SetVisible(
false );
1871 wxString footprintRefName = wxEmptyString;
1872 wxString footprintAlternateName = wxEmptyString;
1879 wxString attributeValue = aAttributeVal.Value;
1880 attributeValue.Replace( wxT(
"\n" ), wxT(
"\\n" ) );
1881 attributeValue.Replace( wxT(
"\r" ), wxT(
"\\r" ) );
1882 attributeValue.Replace( wxT(
"\t" ), wxT(
"\\t" ) );
1888 if( attrName == wxT(
"(PartDefinitionNameStem)" ) )
1891 attributeValue.Replace( wxT(
" " ),
"_" );
1892 tempSymbol->GetReferenceField().SetText( attributeValue );
1895 else if( attrName == wxT(
"(PartDescription)" ) )
1897 tempSymbol->SetDescription( attributeValue );
1900 else if( attrName == wxT(
"(PartDefinitionReferenceName)" ) )
1902 footprintRefName = attributeValue;
1905 else if( attrName == wxT(
"(PartDefinitionAlternateName)" ) )
1907 footprintAlternateName = attributeValue;
1911 bool attrIsNew = tempSymbol->FindField( attrName ) ==
nullptr;
1914 wxASSERT( attrField->
GetName() == attrName );
1915 attrField->
SetText( aAttributeVal.Value );
1916 attrField->
SetUnit( gateNumber );
1918 const ATTRIBUTE_ID& attrid = aAttributeVal.AttributeID;
1921 if( aAttributeVal.HasLocation )
1927 else if( attrIsNew )
1937 loadLibraryField( attrVal );
1941 loadLibraryField( attrVal );
1947 tempSymbol->SetShowPinNames(
false );
1948 tempSymbol->SetShowPinNumbers(
false );
1951 aSymbol = tempSymbol.release();
1956 const wxString& aFootprintName,
1957 const wxString& aFootprintAlternate )
1959 wxString fpNameInLibrary =
generateLibName( aFootprintName, aFootprintAlternate );
1961 if( !fpNameInLibrary.IsEmpty() )
1963 wxArrayString fpFilters;
1964 fpFilters.Add( aFootprintName );
1966 if( !aFootprintAlternate.IsEmpty() )
1967 fpFilters.Add( fpNameInLibrary );
1969 aKiCadSymbol->SetFPFilters( fpFilters );
1972 aKiCadSymbol->GetFootprintField().SetText( libID.
Format() );
1981 int aLineThickness )
1983 const VERTEX* prev = &aCadstarVertices.at( 0 );
1988 for(
size_t i = 1; i < aCadstarVertices.size(); i++ )
1990 cur = &aCadstarVertices.at( i );
2001 centerPoint = ( startPoint + endPoint ) / 2;
2031 shape->
SetEnd( startPoint );
2036 shape->
SetEnd( endPoint );
2042 shape->
SetUnit( aGateNumber );
2061 aCadstarAttrLoc.
Mirror,
true );
2088 int compOrientation = 0;
2090 if( aCadstarSymbol.
Mirror )
2092 compAngle = -compAngle;
2093 compOrientation += SYMBOL_ORIENTATION_T::SYM_MIRROR_Y;
2098 EDA_ANGLE test2( aComponentOrientation );
2102 m_reporter->
Report( wxString::Format(
_(
"Symbol '%s' is rotated by an angle of %.1f "
2103 "degrees in the original CADSTAR design but "
2104 "KiCad only supports rotation angles multiples "
2105 "of 90 degrees. The connecting wires will need "
2116 m_reporter->
Report( wxString::Format(
_(
"Symbol '%s' references sheet ID '%s' which does "
2117 "not exist in the design. The symbol was not "
2127 wxString gate = ( aCadstarSymbol.
GateID.IsEmpty() ) ? wxString( wxT(
"A" ) ) : aCadstarSymbol.
GateID;
2128 wxString partGateIndex = aCadstarSymbol.
PartRef.
RefID + gate;
2135 std::map<wxString, SCH_PIN*> pinNumToLibPinMap;
2137 for(
auto& term : termNumMap )
2139 wxString pinNum = term.second;
2140 pinNumToLibPinMap.insert( { pinNum,
2144 auto replacePinNumber =
2145 [&]( wxString aOldPinNum, wxString aNewPinNum )
2147 if( aOldPinNum == aNewPinNum )
2150 SCH_PIN* libpin = pinNumToLibPinMap.at( aOldPinNum );
2155 for(
auto& pinPair : aCadstarSymbol.
PinNumbers )
2157 SYMBOL::PIN_NUM
pin = pinPair.second;
2159 replacePinNumber( termNumMap.at(
pin.TerminalID ),
2160 wxString::Format(
"%ld",
pin.PinNum ) );
2164 for(
auto& pinPair : aCadstarSymbol.
PinNames )
2167 replacePinNumber( termNumMap.at(
pin.TerminalID ),
pin.NameOrLabel );
2197 if( textIsVertical )
2200 alignment =
mirrorX( alignment );
2206 aCadstarAttrLoc.
Mirror );
2213 int compOrientation = SYMBOL_ORIENTATION_T::SYM_ORIENT_0;
2220 compOrientation = SYMBOL_ORIENTATION_T::SYM_ORIENT_0;
2221 aReturnedOrientation =
ANGLE_0;
2225 compOrientation = SYMBOL_ORIENTATION_T::SYM_ORIENT_90;
2230 compOrientation = SYMBOL_ORIENTATION_T::SYM_ORIENT_180;
2235 compOrientation = SYMBOL_ORIENTATION_T::SYM_ORIENT_270;
2239 return compOrientation;
2248 auto logUnknownNetElementError =
2251 m_reporter->
Report( wxString::Format(
_(
"Net %s references unknown net element %s. "
2252 "The net was not properly loaded and may "
2253 "require manual fixing." ),
2262 if( aNetElementID.Contains(
"J" ) )
2265 return logUnknownNetElementError();
2267 return aNet.
Junctions.at( aNetElementID ).Location;
2269 else if( aNetElementID.Contains(
"P" ) )
2272 return logUnknownNetElementError();
2278 return logUnknownNetElementError();
2285 return logUnknownNetElementError();
2291 VECTOR2I pinOffset = libpinPosition - libOrigin;
2295 VECTOR2I pinPosition = symbolOrigin + pinOffset;
2299 pinPosition.
x = ( 2 * symbolOrigin.
x ) - pinPosition.
x;
2304 RotatePoint( pinPosition, symbolOrigin, -adjustedOrientation );
2307 retval.
x = pinPosition.
x;
2308 retval.
y = pinPosition.
y;
2312 else if( aNetElementID.Contains(
"BT" ) )
2315 return logUnknownNetElementError();
2317 return aNet.
BusTerminals.at( aNetElementID ).SecondPoint;
2319 else if( aNetElementID.Contains(
"BLKT" ) )
2322 return logUnknownNetElementError();
2328 return logUnknownNetElementError();
2330 return Schematic.
Blocks.at( blockid ).Terminals.at( termid ).Position;
2332 else if( aNetElementID.Contains(
"D" ) )
2335 return logUnknownNetElementError();
2337 return aNet.
Danglers.at( aNetElementID ).Position;
2341 return logUnknownNetElementError();
2348 wxString netname = aNet.
Name;
2350 if( netname.IsEmpty() )
2351 netname = wxString::Format(
"$%ld", aNet.
SignalNum );
2363 const double& aScalingFactor,
2365 const bool& aMirrorInvert )
2370 const VERTEX* prev = &aCadstarVertices.at( 0 );
2374 "First vertex should always be a point vertex" );
2376 auto pointTransform =
2380 aScalingFactor, aTransformCentre, aMirrorInvert );
2383 for(
size_t ii = 1; ii < aCadstarVertices.size(); ii++ )
2385 cur = &aCadstarVertices.at( ii );
2387 VECTOR2I transformedStartPoint = pointTransform( prev->
End );
2388 VECTOR2I transformedEndPoint = pointTransform( cur->
End );
2410 segment->
SetLayer( aKiCadSchLayerID );
2422 wxFAIL_MSG(
"Unknown CADSTAR Vertex type" );
2431 const LAYER_ID& aCadstarSheetIDOverride,
2435 const double& aScalingFactor,
2437 const bool& aMirrorInvert )
2440 aCadstarSheetIDOverride, aKiCadSchLayerID, aMoveVector, aRotation,
2441 aScalingFactor, aTransformCentre, aMirrorInvert );
2446 aKiCadSchLayerID, aMoveVector, aRotation, aScalingFactor,
2447 aTransformCentre, aMirrorInvert );
2458 "Sheet already loaded!" );
2461 aParentSheet.
Last(),
2477 wxString loadedFilename = wxFileName(
Filename ).GetName();
2478 std::string filename = wxString::Format(
"%s_%02d", loadedFilename, sheetNum ).ToStdString();
2483 filenameField.
SetText( filename );
2490 wxString pageNumStr = wxString::Format(
"%d",
getSheetNumber( aCadstarSheetID ) );
2495 m_sheetMap.insert( { aCadstarSheetID, sheet } );
2505 "FIXME! Parent sheet should be loaded before attempting to load subsheets" );
2509 BLOCK& block = blockPair.second;
2511 if( block.
LayerID == aCadstarSheetID && block.
Type == BLOCK::TYPE::CHILD )
2515 if( block.
Figures.size() > 0 )
2518 "is drawn on sheet '%s' but is not "
2519 "linked to another sheet in the "
2520 "design. KiCad requires all sheet "
2521 "symbols to be associated to a sheet, "
2522 "so the block was not loaded." ),
2534 std::pair<VECTOR2I, VECTOR2I> blockExtents;
2536 if( block.
Figures.size() > 0 )
2542 THROW_IO_ERROR( wxString::Format(
_(
"The CADSTAR schematic might be corrupt: "
2543 "Block %s references a child sheet but has no "
2544 "Figure defined." ),
2557 field.SetVisible(
false );
2601 std::vector<LAYER_ID> childSheets, orphanSheets;
2606 BLOCK& block = blockPair.second;
2609 if( block.
Type == BLOCK::TYPE::CHILD )
2610 childSheets.push_back( assocSheetID );
2616 if( std::find( childSheets.begin(), childSheets.end(), sheetID ) == childSheets.end() )
2617 orphanSheets.push_back( sheetID );
2620 return orphanSheets;
2630 if( sheetID == aCadstarSheetID )
2642 wxCHECK_MSG( aItem, , wxT(
"aItem is null" ) );
2644 if( aCadstarSheetID ==
"ALL_SHEETS" )
2650 LAYER_ID sheetID = sheetPair.first;
2657 aItem = duplicateItem;
2659 else if( aCadstarSheetID ==
"NO_SHEET" )
2661 wxFAIL_MSG( wxT(
"Trying to add an item to NO_SHEET? This might be a documentation symbol." ) );
2667 m_sheetMap.at( aCadstarSheetID )->GetScreen()->Append( aItem );
2672 wxFAIL_MSG( wxT(
"Unknown Sheet ID." ) );
2680 const wxString& aSymDefAlternate )
2691 wxString refKey = symdef.ReferenceName.Lower();
2692 wxString altKey = symdef.Alternate.Lower();
2704 else if( altKey.IsEmpty() )
2712 wxString refKeyToFind = aSymdefName.Lower();
2713 wxString altKeyToFind = aSymDefAlternate.Lower();
2755 LINE_STYLE::SOLID );
2765 default:
return LINE_STYLE::DEFAULT;
2794 aCadstarAttributeID );
2820CADSTAR_SCH_ARCHIVE_LOADER::PART::DEFINITION::PIN
2824 for( std::pair<PART_DEFINITION_PIN_ID, PART::DEFINITION::PIN> pinPair :
2827 PART::DEFINITION::PIN partPin = pinPair.second;
2829 if( partPin.TerminalGate == aGateID && partPin.TerminalPin == aTerminalID )
2833 return PART::DEFINITION::PIN();
2841 case CADSTAR_PIN_TYPE::UNCOMMITTED:
return ELECTRICAL_PINTYPE::PT_PASSIVE;
2842 case CADSTAR_PIN_TYPE::INPUT:
return ELECTRICAL_PINTYPE::PT_INPUT;
2843 case CADSTAR_PIN_TYPE::OUTPUT_OR:
return ELECTRICAL_PINTYPE::PT_OPENCOLLECTOR;
2844 case CADSTAR_PIN_TYPE::OUTPUT_NOT_OR:
return ELECTRICAL_PINTYPE::PT_OUTPUT;
2845 case CADSTAR_PIN_TYPE::OUTPUT_NOT_NORM_OR:
return ELECTRICAL_PINTYPE::PT_OUTPUT;
2846 case CADSTAR_PIN_TYPE::POWER:
return ELECTRICAL_PINTYPE::PT_POWER_IN;
2847 case CADSTAR_PIN_TYPE::GROUND:
return ELECTRICAL_PINTYPE::PT_POWER_IN;
2848 case CADSTAR_PIN_TYPE::TRISTATE_BIDIR:
return ELECTRICAL_PINTYPE::PT_BIDI;
2849 case CADSTAR_PIN_TYPE::TRISTATE_INPUT:
return ELECTRICAL_PINTYPE::PT_INPUT;
2850 case CADSTAR_PIN_TYPE::TRISTATE_DRIVER:
return ELECTRICAL_PINTYPE::PT_OUTPUT;
2853 return ELECTRICAL_PINTYPE::PT_UNSPECIFIED;
2858 if( aCadstarGateID.IsEmpty() )
2861 return (
int) aCadstarGateID.Upper().GetChar( 0 ) - (int) wxUniChar(
'A' ) + 1;
2904 switch( aCadstarAlignment )
2923 default: wxFAIL_MSG(
"Unknown Cadstar Alignment" );
return aCadstarAlignment;
2931 switch( aCadstarAlignment )
2945 default: wxFAIL_MSG(
"Unknown Cadstar Alignment" );
return aCadstarAlignment;
2955 aKiCadTextItem->
SetText( escapedText );
2966 if( textWidth == 0 )
2987 const long long aCadstarOrientAngle,
2997 ALIGNMENT textAlignment = aCadstarAlignment;
3003 textAlignment =
mirrorX( aCadstarAlignment );
3008 switch( aAlignment )
3063 wxCHECK( textEdaItem, );
3085 textAlignment =
rotate180( textAlignment );
3089 textAlignment =
rotate180( textAlignment );
3092 wxFAIL_MSG(
"Unknown Quadrant" );
3096 setAlignment( aKiCadTextItem, textAlignment );
3103 setAlignment( aKiCadTextItem, textAlignment );
3105 int off =
static_cast<SCH_TEXT*
>( aKiCadTextItem )->GetTextOffset();
3116 default: wxFAIL_MSG(
"Unexpected Spin Style" );
break;
3144 wxFAIL_MSG(
"Unexpected Spin Style" );
3153 label->SetSpinStyle( spin );
3157 wxFAIL_MSG(
"Unexpected item type" );
3172 aCadstarTextElement.
Mirror );
3179 long long aScalingFactorNumerator,
3180 long long aScalingFactorDenominator )
3184 if( aScalingFactorNumerator == aScalingFactorDenominator )
3188 [&](
int aLength ) ->
int
3190 return( aLength * aScalingFactorNumerator ) / aScalingFactorDenominator;
3196 return VECTOR2I( scaleLen( aCoord.x ), scaleLen( aCoord.y ) );
3202 return VECTOR2I( scaleLen( aSize.x ), scaleLen( aSize.y ) );
3209 switch( item.Type() )
3211 case KICAD_T::SCH_SHAPE_T:
3215 if( shape.
GetShape() == SHAPE_T::ARC )
3221 else if( shape.
GetShape() == SHAPE_T::POLY )
3231 case KICAD_T::SCH_PIN_T:
3235 pin.SetPosition( scalePt(
pin.GetPosition() ) );
3236 pin.SetLength( scaleLen(
pin.GetLength() ) );
3240 case KICAD_T::SCH_TEXT_T:
3276 if( aGateNumber > 0 && shape.
GetUnit() != aGateNumber )
3279 if( shape.
GetShape() != SHAPE_T::POLY )
3289 if( pt0 != pt1 && uniqueSegments.count( pt0 ) == 0 && uniqueSegments.count( pt1 ) == 0 )
3292 if( pt0.
x == pt1.
x || pt0.
y == pt1.
y )
3294 uniqueSegments.insert( { pt0, poly } );
3295 uniqueSegments.insert( { pt1, poly } );
3303 auto setPinOrientation =
3310 pin->SetOrientation( PIN_ORIENTATION::PIN_RIGHT );
3312 pin->SetOrientation( PIN_ORIENTATION::PIN_UP );
3314 pin->SetOrientation( PIN_ORIENTATION::PIN_LEFT );
3316 pin->SetOrientation( PIN_ORIENTATION::PIN_DOWN );
3319 if( uniqueSegments.count(
pin->GetPosition() ) )
3325 if( otherPt ==
pin->GetPosition() )
3326 otherPt = poly.
CPoint( 1 );
3337std::pair<VECTOR2I, VECTOR2I>
3345 if( upperLeft.
x > v.
End.
x )
3346 upperLeft.
x = v.
End.
x;
3348 if( upperLeft.
y < v.
End.
y )
3349 upperLeft.
y = v.
End.
y;
3351 if( lowerRight.
x < v.
End.
x )
3352 lowerRight.
x = v.
End.
x;
3354 if( lowerRight.
y > v.
End.
y )
3355 lowerRight.
y = v.
End.
y;
3362 if( upperLeft.
x > v.
End.
x )
3363 upperLeft.
x = v.
End.
x;
3365 if( upperLeft.
y < v.
End.
y )
3366 upperLeft.
y = v.
End.
y;
3368 if( lowerRight.
x < v.
End.
x )
3369 lowerRight.
x = v.
End.
x;
3371 if( lowerRight.
y > v.
End.
y )
3372 lowerRight.
y = v.
End.
y;
3379 VECTOR2I size = lowerRightKiCad - upperLeftKiCad;
3381 return { upperLeftKiCad,
VECTOR2I( abs( size.
x ), abs( size.
y ) ) };
3411 const double& aScalingFactor,
3413 const bool& aMirrorInvert )
3417 if( aScalingFactor != 1.0 )
3420 retVal -= aTransformCentre;
3421 retVal.
x =
KiROUND( retVal.
x * aScalingFactor );
3422 retVal.
y =
KiROUND( retVal.
y * aScalingFactor );
3423 retVal += aTransformCentre;
3427 MIRROR( retVal.
x, aTransformCentre.
x );
3429 if( !aRotation.
IsZero() )
3430 RotatePoint( retVal, aTransformCentre, aRotation );
3432 if( aMoveVector !=
VECTOR2I{ 0, 0 } )
3433 retVal += aMoveVector;
3441 return sqrt( ( (
double) aPoint.
x * (
double) aPoint.
x )
3442 + ( (
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.
const SizeVec & GetSize() const
coord_type GetTop() const
coord_type GetRight() const
coord_type GetLeft() 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 void FixTextPositionNoAlignment(EDA_TEXT *aKiCadTextItem, bool aInvertY=false)
Corrects the position of a text element that had NO_ALIGNMENT in CADSTAR.
static wxString generateLibName(const wxString &aRefName, const wxString &aAlternateName)
wxString LAYER_ID
ID of a Sheet (if schematic) or board Layer (if PCB)
@ 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
static SCH_FIELD * addNewFieldToSymbol(const wxString &aFieldName, std::unique_ptr< LIB_SYMBOL > &aKiCadSymbol)
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)
wxString getAttributeName(const ATTRIBUTE_ID &aCadstarAttributeID)
std::vector< LIB_SYMBOL * > m_loadedSymbols
Loaded symbols so far.
PART getPart(const PART_ID &aCadstarPartID)
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 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)
void applyToLibraryFieldAttribute(const ATTRIBUTE_LOCATION &aCadstarAttrLoc, const VECTOR2I &aSymbolOrigin, SCH_FIELD *aKiCadField)
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)
SPIN_STYLE getSpinStyle(const long long &aCadstarOrientation, bool aMirror)
std::map< wxString, LIB_SYMBOL * > m_powerSymLibMap
NetName->KiCad Power Lib Symbol.
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.
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.
void applyTextSettings(EDA_TEXT *aKiCadTextItem, const TEXTCODE_ID &aCadstarTextCodeID, const ALIGNMENT &aCadstarAlignment, const JUSTIFICATION &aCadstarJustification, const long long aCadstarOrientAngle=0, bool aMirrored=false, bool aInvertY=false)
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 loadLibrarySymbolShapeVertices(const std::vector< VERTEX > &aCadstarVertices, const VECTOR2I &aSymbolOrigin, LIB_SYMBOL *aSymbol, int aGateNumber, int aLineThickness)
LINE_STYLE getLineStyle(const LINECODE_ID &aCadstarLineCodeID)
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
void SetTextSize(VECTOR2I aNewSize, bool aEnforceMinTextSize=true)
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)
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.
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.
Define a library symbol object.
void SetUnitCount(int aCount, bool aDuplicateDrawItems=true)
Set the units per symbol count.
std::vector< SCH_PIN * > GetPins(int aUnit=0, int aBodyStyle=0) const
Return a list of pin object pointers from the draw item list.
SCH_FIELD & GetValueField() const
Return reference to the value field.
std::vector< SCH_PIN * > GetAllLibPins() const
Return a list of pin pointers for all units / converts.
LIB_ITEMS_CONTAINER & GetDrawItems()
Return a reference to the draw item list.
wxString GetName() const override
SCH_FIELD & GetReferenceField() const
Return reference to the reference designator field.
void AddDrawItem(SCH_ITEM *aItem, bool aSort=true)
Add a new draw aItem to the draw object list and sort according to aSort.
virtual void SetName(const wxString &aName)
ITERATOR_BASE< SCH_ITEM, MULTIVECTOR< SCH_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 SetHeightMils(double aHeightInMils)
const VECTOR2D GetSizeIU(double aIUScale) const
Gets the page size in internal units.
void SetWidthMils(double aWidthInMils)
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 SetName(const wxString &aName)
void SetText(const wxString &aText) override
void SetSpinStyle(SPIN_STYLE aSpinStyle) override
void SetSpinStyle(SPIN_STYLE aSpinStyle) override
Base class for any item which can be embedded within the SCHEMATIC container class,...
void SetLayer(SCH_LAYER_ID aLayer)
virtual void SetUnit(int aUnit)
SCH_ITEM * Duplicate(bool doClone=false) const
Routine to create a new copy of given item.
void SetPosition(const VECTOR2I &aPosition) override
void SetShape(LABEL_FLAG_SHAPE aShape)
void SetPosition(const VECTOR2I &aPosition) override
void AutoplaceFields(SCH_SCREEN *aScreen, bool aManual) override
virtual void SetSpinStyle(SPIN_STYLE aSpinStyle)
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 LINE_STYLE aStyle)
void SetEndPoint(const VECTOR2I &aPosition)
void SetNumber(const wxString &aNumber)
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.
void SetPosition(const VECTOR2I &aPos) override
void SetStroke(const STROKE_PARAMS &aStroke) override
void AddPoint(const VECTOR2I &aPosition)
VECTOR2I GetPosition() const override
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, bool aCaseInsensitive=false)
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.
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.
SPIN_STYLE MirrorX()
Mirror the label spin style across the X axis or simply swaps up and bottom.
SPIN_STYLE MirrorY()
Mirror the label spin style across the Y axis or simply swaps left and right.
Simple container to manage line stroke parameters.
void SetShowPinNames(bool aShow)
Set or clear the pin name visibility flag.
void SetShowPinNumbers(bool aShow)
Set or clear the pin number visibility flag.
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_0
static constexpr EDA_ANGLE ANGLE_90
static constexpr EDA_ANGLE ANGLE_VERTICAL
static constexpr EDA_ANGLE ANGLE_HORIZONTAL
static constexpr EDA_ANGLE ANGLE_45
static constexpr EDA_ANGLE ANGLE_270
static constexpr EDA_ANGLE ANGLE_180
static constexpr EDA_ANGLE ANGLE_135
static const std::string KiCadSchematicFileExtension
#define THROW_IO_ERROR(msg)
SCH_LAYER_ID
Eeschema drawing layers.
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.
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:...
LINE_STYLE
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::map< long, std::string > m_PinLabelsMap
Map of pin identifiers to alphanumeric pin labels.
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)
Calculate the new point of coord coord pX, pY, for a rotation center 0, 0.
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.