64 constexpr
long long maxDesignSizekicad = std::numeric_limits<int>::max();
66 if( designSizeXkicad > maxDesignSizekicad || designSizeYkicad > maxDesignSizekicad )
69 _(
"The design is too large and cannot be imported into KiCad. \n" 70 "Please reduce the maximum design size in CADSTAR by navigating to: \n" 71 "Design Tab -> Properties -> Design Options -> Maximum Design Size. \n" 72 "Current Design size: %.2f, %.2f millimeters. \n" 73 "Maximum permitted design size: %.2f, %.2f millimeters.\n" ),
102 _(
"The CADSTAR design contains variants which has no KiCad equivalent. Only " 103 "the master variant ('%s') was loaded." ),
110 _(
"The CADSTAR design contains grouped items which has no KiCad equivalent. Any " 111 "grouped items have been ungrouped." ) );
117 _(
"The CADSTAR design contains re-use blocks which has no KiCad equivalent. The " 118 "re-use block information has been discarded during the import." ) );
123 for( std::pair<LAYER_ID, SCH_SHEET*> sheetPair :
m_sheetMap )
143 if( field.IsVisible() )
144 bbox.
Merge( field.GetBoundingBox() );
149 bbox = item->GetBoundingBox();
152 sheetBoundingBox.
Merge( bbox );
165 auto roundToNearestGrid =
166 [&](
int aNumber ) ->
int 168 int error = aNumber % grid;
169 int absError =
sign( error ) * error;
171 if( absError > ( grid / 2 ) )
172 return aNumber + (
sign( error ) * grid ) - error;
174 return aNumber - error;
180 wxSize targetSheetSize = sheetBoundingBox.
GetSize();
181 int longestSide = std::max( targetSheetSize.x, targetSheetSize.y );
182 int margin = ( (double) longestSide * 0.03);
183 margin = roundToNearestGrid( margin );
184 targetSheetSize.IncBy( margin * 2, margin * 2 );
196 wxPoint sheetcentre( pageSizeIU.x / 2, pageSizeIU.y / 2 );
197 wxPoint itemsCentre = sheetBoundingBox.
Centre();
200 wxPoint translation = sheetcentre - itemsCentre;
201 translation.x = roundToNearestGrid( translation.x );
202 translation.y = roundToNearestGrid( translation.y );
205 std::vector<SCH_ITEM*> allItems;
208 std::back_inserter( allItems ) );
212 item->SetPosition( item->GetPosition() + translation );
219 _(
"The CADSTAR design has been imported successfully.\n" 220 "Please review the import errors and warnings (if any)." ) );
232 if( orphanSheets.size() > 1 )
237 for(
LAYER_ID sheetID : orphanSheets )
239 wxPoint pos( x * Mils2iu( 1000 ), y * Mils2iu( 1000 ) );
240 wxSize siz( Mils2iu( 1000 ), Mils2iu( 1000 ) );
253 else if( orphanSheets.size() > 0 )
255 LAYER_ID rootSheetID = orphanSheets.at( 0 );
257 wxFileName loadedFilePath = wxFileName(
Filename );
260 "%s_%02d", loadedFilePath.GetName(),
getSheetNumber( rootSheetID ) )
265 wxFileName fn( filename );
273 THROW_IO_ERROR(
_(
"The CADSTAR schematic might be corrupt: there is no root sheet." ) );
282 BLOCK& block = blockPair.second;
285 if( block.
Type == BLOCK::TYPE::PARENT )
287 else if( block.
Type == BLOCK::TYPE::CHILD )
296 for( std::pair<TERMINAL_ID, TERMINAL> termPair : block.
Terminals )
299 wxString
name =
"YOU SHOULDN'T SEE THIS TEXT. THIS IS A BUG.";
303 if( block.
Type == BLOCK::TYPE::PARENT )
305 else if( block.
Type == BLOCK::TYPE::CHILD )
331 PART part = partPair.second;
342 GATE_ID gateID = gatePair.first;
343 PART::DEFINITION::GATE gate = gatePair.second;
346 if( symbolID.IsEmpty() )
349 _(
"Part definition '%s' references symbol '%s' (alternate '%s') " 350 "which could not be found in the symbol library. The part has not " 351 "been loaded into the KiCad library." ),
352 part.
Name, gate.Name, gate.Alternate ) );
374 SYMBOL sym = symPair.second;
384 _(
"Symbol '%s' references part '%s' which could not be found " 385 "in the library. The symbol was not loaded" ),
392 double symOrientDeciDeg = 0.0;
414 wxT(
"Part Name" ) ) );
420 partname.Replace( wxT(
"\n" ), wxT(
"\\n" ) );
421 partname.Replace( wxT(
"\r" ), wxT(
"\\r" ) );
422 partname.Replace( wxT(
"\t" ), wxT(
"\\t" ) );
423 partField->
SetText( partname );
452 attrVal.
Value.Replace( wxT(
"\n" ), wxT(
"\\n" ) );
453 attrVal.
Value.Replace( wxT(
"\r" ), wxT(
"\\r" ) );
454 attrVal.
Value.Replace( wxT(
"\t" ), wxT(
"\\t" ) );
468 _(
"Symbol ID '%s' references library symbol '%s' which could not be " 469 "found in the library. Did you export all items of the design?" ),
478 _(
"Symbol ID '%s' is a signal reference or global signal but it has too " 479 "many pins. The expected number of pins is 1 but %d were found." ),
501 wxString libPartName = libraryNetName;
507 if( libPartName != symbolInstanceNetName )
509 libPartName += wxT(
" (" ) + symbolInstanceNetName + wxT(
")" );
516 kiPart =
new LIB_PART( libPartName );
549 double returnedOrientation = 0.0;
557 wxPoint terminalPosOffset = symbolTerminal.
Position - libSymDef.
Origin;
561 rotateDeciDegree += 1800.0;
563 RotatePoint( &terminalPosOffset, -rotateDeciDegree );
567 netLabel->
SetText(
"YOU SHOULDN'T SEE THIS TEXT - PLEASE REPORT THIS BUG" );
568 netLabel->
SetTextSize( wxSize( Mils2iu( 50 ), Mils2iu( 50 ) ) );
571 if( libSymDef.
Alternate.Lower().Contains(
"in" ) )
573 else if( libSymDef.
Alternate.Lower().Contains(
"bi" ) )
575 else if( libSymDef.
Alternate.Lower().Contains(
"out" ) )
585 wxASSERT_MSG(
false,
"Unkown Symbol Variant." );
591 _(
"Symbol ID '%s' is of an unknown type. It is neither a component or a " 592 "net power / symbol. The symbol was not loaded." ),
600 if( symbolName.empty() )
604 _(
"Symbol '%s' is scaled in the original CADSTAR schematic but this is not" 605 " supported in KiCad. The symbol was loaded with 1:1 scale and may require " 617 BUS bus = busPair.second;
621 if( bus.
LayerID != wxT(
"NO_SHEET" ) )
624 std::shared_ptr<BUS_ALIAS> kiBusAlias = std::make_shared<BUS_ALIAS>();
626 kiBusAlias->SetName( bus.
Name );
627 kiBusAlias->SetParent( screen );
632 label->
SetText( wxT(
"{" ) + bus.
Name + wxT(
"}" ) );
673 wxPoint nearestPt = (wxPoint) busLineChain.
NearestPoint( busLabelLoc );
690 wxString netName = net.
Name;
691 std::map<NETELEMENT_ID, SCH_LABEL*> netlabels;
693 if( netName.IsEmpty() )
697 for( std::pair<NETELEMENT_ID, NET_SCH::SYM_TERM> terminalPair : net.
Terminals )
699 NET_SCH::SYM_TERM netTerm = terminalPair.second;
708 if( netTerm.HasNetLabel )
715 netTerm.NetLabel.Justification, val );
726 if( aNode.Contains(
"BLKT" ) )
729 BLOCK_PIN_ID blockPinID = std::make_pair( blockTerm.BlockID, blockTerm.TerminalID );
742 for( std::pair<NETELEMENT_ID, NET_SCH::BLOCK_TERM> blockPair : net.
BlockTerminals )
744 SCH_HIERLABEL* label = getHierarchicalLabel( blockPair.first );
751 for( std::pair<NETELEMENT_ID, NET_SCH::BUS_TERM> busPair : net.
BusTerminals )
753 NET_SCH::BUS_TERM busTerm = busPair.second;
764 busEntry->
SetSize( wxSize( size.x, size.y ) );
768 if( busTerm.HasNetLabel )
776 busTerm.NetLabel.Justification, label );
778 netlabels.insert( { busTerm.ID, label } );
785 for( std::pair<NETELEMENT_ID, NET_SCH::DANGLER> danglerPair : net.
Danglers )
787 NET_SCH::DANGLER dangler = danglerPair.second;
793 netlabels.insert( { dangler.ID, label } );
795 m_sheetMap.at( dangler.LayerID )->GetScreen()->Append( label );
799 for( NET_SCH::CONNECTION_SCH conn : net.
Connections )
801 if( conn.LayerID == wxT(
"NO_SHEET" ) )
812 if( conn.Path.size() < 1 || conn.Path.front() != start )
813 conn.Path.insert( conn.Path.begin(), start );
815 if( conn.Path.size() < 2 || conn.Path.back() != end )
816 conn.Path.push_back( end );
819 bool secondPt =
false;
825 for(
POINT pt : conn.Path )
835 std::vector<NETELEMENT_ID> nodes;
836 nodes.push_back( conn.StartNode );
837 nodes.push_back( conn.EndNode );
849 wxSize sheetSize = parentSheet->
GetSize();
850 wxPoint sheetPosition = parentSheet->
GetPosition();
852 int leftSide = sheetPosition.x;
853 int rightSide = sheetPosition.x + sheetSize.x;
854 int topSide = sheetPosition.y;
855 int botSide = sheetPosition.y + sheetSize.y;
859 sheetEdge.
Append( leftSide, topSide );
860 sheetEdge.
Append( rightSide, topSide );
861 sheetEdge.
Append( rightSide, botSide );
862 sheetEdge.
Append( leftSide, botSide );
863 sheetEdge.
Append( leftSide, topSide );
867 if( !wireChain.
Intersect( sheetEdge, wireToSheetIntersects ) )
872 if( node == conn.StartNode )
873 wireChain = wireChain.
Reverse();
877 if( node == conn.StartNode )
878 wireChain = wireChain.
Reverse();
884 VECTOR2I intsctPt = wireToSheetIntersects.at( 0 ).p;
885 int intsctIndx = wireChain.
FindSegment( intsctPt );
886 wxASSERT_MSG( intsctIndx != -1,
"Can't find intersecting segment" );
888 if( node == conn.StartNode )
889 wireChain.
Replace( 0, intsctIndx, intsctPt );
891 wireChain.
Replace( intsctIndx + 1, -1, intsctPt );
915 wxPoint kiLast = last;
916 wxPoint kiCurrent = (wxPoint) pt;
917 double wireangleDeciDeg =
getPolarAngle( kiLast - kiCurrent );
920 if( netlabels.find( conn.StartNode ) != netlabels.end() )
922 netlabels.at( conn.StartNode )->SetLabelSpinStyle( spin );
925 SCH_HIERLABEL* sheetPin = getHierarchicalLabel( conn.StartNode );
937 if( !conn.ConnectionLineCode.IsEmpty() )
942 m_sheetMap.at( conn.LayerID )->GetScreen()->Append( wire );
950 double wireangleDeciDeg =
getPolarAngle( kiLast - kiCurrent );
953 if( netlabels.find( conn.EndNode ) != netlabels.end() )
954 netlabels.at( conn.EndNode )->SetLabelSpinStyle( spin );
956 SCH_HIERLABEL* sheetPin = getHierarchicalLabel( conn.EndNode );
963 for( std::pair<NETELEMENT_ID, NET_SCH::JUNCTION_SCH> juncPair : net.
Junctions )
965 NET_SCH::JUNCTION_SCH junc = juncPair.second;
970 m_sheetMap.at( junc.LayerID )->GetScreen()->Append( kiJunc );
972 if( junc.HasNetLabel )
985 m_sheetMap.at( junc.LayerID )->GetScreen()->Append( label );
996 FIGURE fig = figPair.second;
1007 TEXT txt = textPair.second;
1017 for( std::pair<DOCUMENTATION_SYMBOL_ID, DOCUMENTATION_SYMBOL> docSymPair :
1026 "ID '%s' which does not exist in the library. The symbol " 1027 "was not loaded." ),
1035 double scalingFactor =
1038 bool mirrorInvert = docSym.
Mirror;
1040 for( std::pair<FIGURE_ID, FIGURE> figPair : docSymDef.
Figures )
1042 FIGURE fig = figPair.second;
1045 centreOfTransform, mirrorInvert );
1048 for( std::pair<TEXT_ID, TEXT> textPair : docSymDef.
Texts )
1050 TEXT txt = textPair.second;
1055 scalingFactor, centreOfTransform, mirrorInvert );
1057 bool newMirrorStatus = kiTxt->
IsMirrored() ? !mirrorInvert : mirrorInvert;
1077 auto findAndReplaceTextField = [&](
TEXT_FIELD_NAME aField, wxString aValue ) {
1099 std::map<wxString, wxString>& txtVars = pj->
GetTextVars();
1115 wxString varValue = txtvalue.second;
1117 txtVars.insert( { varName, varValue } );
1122 wxString varName = txtvalue.first;
1123 wxString varValue = txtvalue.second;
1125 txtVars.insert( { varName, varValue } );
1130 wxLogError(
_(
"Text Variables could not be set as there is no project attached." ) );
1143 for( std::pair<FIGURE_ID, FIGURE> figPair : symbol.Figures )
1145 FIGURE fig = figPair.second;
1157 for( std::pair<TERMINAL_ID, TERMINAL> termPair : symbol.Terminals )
1161 wxString pinName = wxEmptyString;
1168 pinName = csPin.Label;
1169 pinNum = csPin.Name;
1171 if( pinNum.IsEmpty() )
1173 if( !csPin.Identifier.IsEmpty() )
1174 pinNum = csPin.Identifier;
1183 pinNumMap.insert( { term.
ID, pinNum } );
1200 if( oDeg >= -450 && oDeg <= 450 )
1202 else if( oDeg >= 450 && oDeg <= 1350 )
1204 else if( oDeg >= 1350 || oDeg <= -1350 )
1220 m_pinNumsMap.insert( { aCadstarPart->
ID + aGateID, pinNumMap } );
1222 for( std::pair<TEXT_ID, TEXT> textPair : symbol.Texts )
1224 TEXT csText = textPair.second;
1227 libtext->
SetUnit( gateNumber );
1245 if( symbol.TextLocations.find(
PART_NAME_ATTRID ) != symbol.TextLocations.end() )
1256 field->
SetName(
"Part Name" );
1261 wxString partName = aCadstarPart->
Name;
1262 partName.Replace( wxT(
"\n" ), wxT(
"\\n" ) );
1263 partName.Replace( wxT(
"\r" ), wxT(
"\\r" ) );
1264 partName.Replace( wxT(
"\t" ), wxT(
"\\t" ) );
1275 wxString footprintRefName = wxEmptyString;
1276 wxString footprintAlternateName = wxEmptyString;
1278 auto loadLibraryField =
1285 aAttributeVal.Value.
Replace( wxT(
"\n" ), wxT(
"\\n" ) );
1286 aAttributeVal.Value.Replace( wxT(
"\r" ), wxT(
"\\r" ) );
1287 aAttributeVal.Value.Replace( wxT(
"\t" ), wxT(
"\\t" ) );
1292 if( attrName == wxT(
"(PartDefinitionNameStem)" ) )
1295 aAttributeVal.Value.Replace( wxT(
" " ),
"_" );
1299 else if( attrName == wxT(
"(PartDescription)" ) )
1304 else if( attrName == wxT(
"(PartDefinitionReferenceName)" ) )
1306 footprintRefName = aAttributeVal.Value;
1309 else if( attrName == wxT(
"(PartDefinitionAlternateName)" ) )
1311 footprintAlternateName = aAttributeVal.Value;
1316 attrField = aPart->
FindField( attrName );
1323 attrField->
SetName( attrName );
1326 attrField->
SetText( aAttributeVal.Value );
1327 attrField->
SetUnit( gateNumber );
1329 if( aAttributeVal.HasLocation )
1336 else if( symbol.TextLocations.find( aAttributeVal.AttributeID )
1337 != symbol.TextLocations.end() )
1340 TEXT_LOCATION symTxtLoc = symbol.TextLocations.at( aAttributeVal.AttributeID );
1345 else if( symbol.AttributeValues.find( aAttributeVal.AttributeID )
1346 != symbol.AttributeValues.end() )
1350 symbol.AttributeValues.at( aAttributeVal.AttributeID );
1377 loadLibraryField( attrVal );
1381 for( std::pair<ATTRIBUTE_ID, ATTRIBUTE_VALUE> attr : aCadstarPart->
AttributeValues )
1384 loadLibraryField( attrVal );
1387 wxString fpNameInLibrary =
generateLibName( footprintRefName, footprintAlternateName );
1388 wxArrayString fpFilters;
1389 fpFilters.Add( fpNameInLibrary );
1394 wxFileName schFilename(
Filename );
1395 wxString libName = schFilename.GetName();
1409 const std::vector<VERTEX>& aCadstarVertices, wxPoint aSymbolOrigin,
LIB_PART* aPart,
1412 const VERTEX* prev = &aCadstarVertices.at( 0 );
1418 for(
size_t i = 1; i < aCadstarVertices.size(); i++ )
1420 cur = &aCadstarVertices.at( i );
1426 wxPoint centerPoint;
1431 centerPoint = ( startPoint + endPoint ) / 2;
1454 segment =
new LIB_ARC( aPart );
1456 ( (
LIB_ARC*) segment )->SetPosition( centerPoint );
1460 ( (
LIB_ARC*) segment )->SetStart( endPoint );
1461 ( (
LIB_ARC*) segment )->SetEnd( startPoint );
1465 ( (
LIB_ARC*) segment )->SetStart( startPoint );
1466 ( (
LIB_ARC*) segment )->SetEnd( endPoint );
1469 ( (
LIB_ARC*) segment )->CalcRadiusAngles();
1473 segment->
SetUnit( aGateNumber );
1486 aKiCadField->
SetBold(
false );
1495 const SYMBOL& aCadstarSymbol,
const LIB_PART& aKiCadPart,
double& aComponentOrientationDeciDeg )
1514 int compOrientation = 0;
1516 if( aCadstarSymbol.
Mirror )
1518 compAngleDeciDeg = -compAngleDeciDeg;
1527 wxString::Format(
_(
"Symbol '%s' is rotated by an angle of %.1f degrees in the " 1528 "original CADSTAR design but KiCad only supports rotation " 1529 "angles multiples of 90 degrees. The connecting wires will " 1530 "need manual fixing." ),
1539 wxString::Format(
_(
"Symbol '%s' references sheet ID '%s' which does not exist in " 1540 "the design. The symbol was not loaded." ),
1547 wxString gate = ( aCadstarSymbol.
GateID.IsEmpty() ) ? wxT(
"A" ) : aCadstarSymbol.
GateID;
1548 wxString partGateIndex = aCadstarSymbol.
PartRef.
RefID + gate;
1555 std::map<wxString, LIB_PIN*> pinNumToLibPinMap;
1557 for(
auto& term : termNumMap )
1559 wxString pinNum = term.second;
1560 pinNumToLibPinMap.insert( { pinNum, component->
GetPartRef()->GetPin( term.second ) } );
1563 auto replacePinNumber = [&]( wxString aOldPinNum, wxString aNewPinNum )
1565 if( aOldPinNum == aNewPinNum )
1568 LIB_PIN* libpin = pinNumToLibPinMap.at( aOldPinNum );
1573 for(
auto& pinPair : aCadstarSymbol.
PinNumbers )
1575 SYMBOL::PIN_NUM pin = pinPair.second;
1577 replacePinNumber( termNumMap.at( pin.TerminalID ),
1582 for(
auto& pinPair : aCadstarSymbol.
PinNames )
1598 const ATTRIBUTE_LOCATION& aCadstarAttrLoc,
const double& aComponentOrientationDeciDeg,
1599 bool aIsMirrored,
SCH_FIELD* aKiCadField )
1603 - aComponentOrientationDeciDeg );
1604 aKiCadField->
SetBold(
false );
1614 switch( fieldAlignment )
1631 switch( fieldJustification )
1646 double aOrientAngleDeciDeg,
double& aReturnedOrientationDeciDeg )
1652 if( oDeg >= -450 && oDeg <= 450 )
1655 aReturnedOrientationDeciDeg = 0.0;
1657 else if( oDeg >= 450 && oDeg <= 1350 )
1660 aReturnedOrientationDeciDeg = 900.0;
1662 else if( oDeg >= 1350 || oDeg <= -1350 )
1665 aReturnedOrientationDeciDeg = 1800.0;
1670 aReturnedOrientationDeciDeg = 2700.0;
1673 return compOrientation;
1681 auto logUnknownNetElementError =
1685 "Net %s references unknown net element %s. The net was " 1686 "not properly loaded and may require manual fixing." ),
1693 if( aNetElementID.Contains(
"J" ) )
1696 return logUnknownNetElementError();
1698 return aNet.
Junctions.at( aNetElementID ).Location;
1700 else if( aNetElementID.Contains(
"P" ) )
1703 return logUnknownNetElementError();
1709 return logUnknownNetElementError();
1713 wxPoint symbolOrigin = sym.
Origin;
1716 return logUnknownNetElementError();
1718 wxPoint libpinPosition =
1721 wxPoint pinOffset = libpinPosition - libOrigin;
1722 wxPoint pinPosition = symbolOrigin + pinOffset;
1727 pinPosition.x = ( 2 * symbolOrigin.x ) - pinPosition.x;
1729 double adjustedOrientationDecideg;
1732 RotatePoint( &pinPosition, symbolOrigin, -adjustedOrientationDecideg );
1735 retval.x = pinPosition.x;
1736 retval.y = pinPosition.y;
1740 else if( aNetElementID.Contains(
"BT" ) )
1743 return logUnknownNetElementError();
1745 return aNet.
BusTerminals.at( aNetElementID ).SecondPoint;
1747 else if( aNetElementID.Contains(
"BLKT" ) )
1750 return logUnknownNetElementError();
1756 return logUnknownNetElementError();
1758 return Schematic.
Blocks.at( blockid ).Terminals.at( termid ).Position;
1760 else if( aNetElementID.Contains(
"D" ) )
1763 return logUnknownNetElementError();
1765 return aNet.
Danglers.at( aNetElementID ).Position;
1769 return logUnknownNetElementError();
1778 wxString netname = aNet.
Name;
1780 if( netname.IsEmpty() )
1788 const wxPoint& aEndPoint,
const LINECODE_ID& aCadstarLineCodeID,
1790 const wxPoint& aMoveVector,
const double& aRotationAngleDeciDeg,
1791 const double& aScalingFactor,
const wxPoint& aTransformCentre,
const bool& aMirrorInvert )
1795 segment->
SetLayer( aKiCadSchLayerID );
1800 wxPoint startPoint =
applyTransform( aStartPoint, aMoveVector, aRotationAngleDeciDeg, aScalingFactor,
1801 aTransformCentre, aMirrorInvert );
1802 wxPoint endPoint =
applyTransform( aEndPoint, aMoveVector, aRotationAngleDeciDeg, aScalingFactor,
1803 aTransformCentre, aMirrorInvert );
1814 const wxPoint& aMoveVector,
const double& aRotationAngleDeciDeg,
1815 const double& aScalingFactor,
const wxPoint& aTransformCentre,
const bool& aMirrorInvert )
1817 const VERTEX* prev = &aCadstarVertices.at( 0 );
1823 for(
size_t ii = 1; ii < aCadstarVertices.size(); ii++ )
1825 cur = &aCadstarVertices.at( ii );
1835 centerPoint = ( startPoint + endPoint ) / 2;
1847 double arcStartAngle =
getPolarAngle( startPoint - centerPoint );
1848 double arcEndAngle =
getPolarAngle( endPoint - centerPoint );
1849 double arcAngleDeciDeg = arcEndAngle - arcStartAngle;
1861 for(
int jj = 0; jj < arcSegments.
SegmentCount(); jj++ )
1863 wxPoint segStart = (wxPoint) arcSegments.
Segment( jj ).
A;
1864 wxPoint segEnd = (wxPoint) arcSegments.
Segment( jj ).
B;
1867 aCadstarSheetID, aKiCadSchLayerID, aMoveVector, aRotationAngleDeciDeg,
1868 aScalingFactor, aTransformCentre, aMirrorInvert );
1875 aKiCadSchLayerID, aMoveVector, aRotationAngleDeciDeg, aScalingFactor,
1876 aTransformCentre, aMirrorInvert );
1880 wxFAIL_MSG(
"Unknown CADSTAR Vertex type" );
1891 const wxPoint& aMoveVector,
const double& aRotationAngleDeciDeg,
1892 const double& aScalingFactor,
const wxPoint& aTransformCentre,
const bool& aMirrorInvert )
1895 aCadstarSheetIDOverride, aKiCadSchLayerID, aMoveVector, aRotationAngleDeciDeg,
1896 aScalingFactor, aTransformCentre, aMirrorInvert );
1901 aKiCadSchLayerID, aMoveVector, aRotationAngleDeciDeg, aScalingFactor,
1902 aTransformCentre, aMirrorInvert );
1910 wxCHECK_MSG(
m_sheetMap.find( aCadstarSheetID ) ==
m_sheetMap.end(), ,
"Sheet already loaded!" );
1916 sheet->SetSize( aSheetSize );
1917 sheet->SetScreen( screen );
1927 wxString loadedFilename = wxFileName(
Filename ).GetName();
1928 std::string filename =
wxString::Format(
"%s_%02d", loadedFilename, sheetNum ).ToStdString();
1933 filenameField.
SetText( filename );
1935 wxFileName fn( filename );
1936 sheet->GetScreen()->SetFileName( fn.GetFullPath() );
1939 sheet->AddInstance( instance.
Path() );
1942 sheet->SetPageNumber( instance, pageNumStr );
1944 sheet->AutoplaceFields(
NULL,
false );
1946 m_sheetMap.insert( { aCadstarSheetID, sheet } );
1956 "FIXME! Parent sheet should be loaded before attempting to load subsheets" );
1960 BLOCK& block = blockPair.second;
1962 if( block.
LayerID == aCadstarSheetID && block.
Type == BLOCK::TYPE::CHILD )
1966 if( block.
Figures.size() > 0 )
1969 _(
"The block ID %s (Block name: '%s') is drawn on sheet '%s' but is " 1970 "not linked to another sheet in the design. KiCad requires all " 1971 "sheet symbols to be associated to a sheet, so the block was not " 1982 std::pair<wxPoint, wxSize> blockExtents;
1984 if( block.
Figures.size() > 0 )
1991 _(
"The CADSTAR schematic might be corrupt: Block %s references a " 1992 "child sheet but has no Figure defined." ),
2006 field.SetVisible(
false );
2010 loadedSheet, wxString(
"Block name" ) );
2016 fields.push_back( blockNameField );
2026 std::vector<LAYER_ID> childSheets, orphanSheets;
2031 BLOCK& block = blockPair.second;
2034 if( block.
Type == BLOCK::TYPE::CHILD )
2035 childSheets.push_back( assocSheetID );
2041 if( std::find( childSheets.begin(), childSheets.end(), sheetID ) == childSheets.end() )
2042 orphanSheets.push_back( sheetID );
2045 return orphanSheets;
2055 if( sheetID == aCadstarSheetID )
2067 wxCHECK_MSG( aItem, ,
"aItem is null" );
2069 if( aCadstarSheetID ==
"ALL_SHEETS" )
2075 LAYER_ID sheetID = sheetPair.first;
2082 aItem = duplicateItem;
2084 else if( aCadstarSheetID ==
"NO_SHEET" )
2087 false,
"Trying to add an item to NO_SHEET? This might be a documentation symbol." );
2093 m_sheetMap.at( aCadstarSheetID )->GetScreen()->Append( aItem );
2098 wxASSERT_MSG(
false,
"Unknown Sheet ID." );
2105 const wxString& aSymdefName,
const wxString& aSymDefAlternate )
2114 && symdef.
Alternate.Lower() == aSymDefAlternate.Lower() )
2189 const PART_ID& aCadstarPartID )
2209 const std::map<ATTRIBUTE_ID, ATTRIBUTE_VALUE>& aCadstarAttributeMap )
2211 wxCHECK( aCadstarAttributeMap.find( aCadstarAttributeID ) != aCadstarAttributeMap.end(),
2214 return aCadstarAttributeMap.at( aCadstarAttributeID ).Value;
2221 for( std::pair<PART_DEFINITION_PIN_ID, PART::DEFINITION::PIN> pinPair :
2224 PART::DEFINITION::PIN partPin = pinPair.second;
2226 if( partPin.TerminalGate == aGateID && partPin.TerminalPin == aTerminalID )
2230 return PART::DEFINITION::PIN();
2255 if( aCadstarGateID.IsEmpty() )
2258 return (
int) aCadstarGateID.Upper().GetChar( 0 ) - (int) wxUniChar(
'A' ) + 1;
2263 const long long& aCadstarOrientation,
bool aMirror )
2279 const double& aOrientationDeciDeg )
2285 if( oDeg >= -450 && oDeg <= 450 )
2287 else if( oDeg >= 450 && oDeg <= 1350 )
2289 else if( oDeg >= 1350 || oDeg <= -1350 )
2308 if( textWidth == 0 )
2315 switch( aCadstarAlignment )
2383 const FIGURE& aCadstarFigure )
2390 if( upperLeft.x > v.
End.x )
2391 upperLeft.x = v.
End.x;
2393 if( upperLeft.y < v.
End.y )
2394 upperLeft.y = v.
End.y;
2396 if( lowerRight.x < v.
End.x )
2397 lowerRight.x = v.
End.x;
2399 if( lowerRight.y > v.
End.y )
2400 lowerRight.y = v.
End.y;
2407 if( upperLeft.x > v.
End.x )
2408 upperLeft.x = v.
End.x;
2410 if( upperLeft.y < v.
End.y )
2411 upperLeft.y = v.
End.y;
2413 if( lowerRight.x < v.
End.x )
2414 lowerRight.x = v.
End.x;
2416 if( lowerRight.y > v.
End.y )
2417 lowerRight.y = v.
End.y;
2424 wxPoint size = lowerRightKiCad - upperLeftKiCad;
2426 return { upperLeftKiCad, wxSize( abs( size.x ), abs( size.y ) ) };
2442 wxPoint aCadstarPoint, wxPoint aCadstarCentre )
2454 const wxPoint& aMoveVector,
const double& aRotationAngleDeciDeg,
2455 const double& aScalingFactor,
const wxPoint& aTransformCentre,
const bool& aMirrorInvert )
2457 wxPoint retVal = aPoint;
2459 if( aScalingFactor != 1.0 )
2462 retVal -= aTransformCentre;
2463 retVal.x =
KiROUND( retVal.x * aScalingFactor );
2464 retVal.y =
KiROUND( retVal.y * aScalingFactor );
2465 retVal += aTransformCentre;
2470 MIRROR( retVal.x, aTransformCentre.x );
2471 MIRROR( retVal.x, aTransformCentre.x );
2474 if( aRotationAngleDeciDeg != 0.0 )
2476 RotatePoint( &retVal, aTransformCentre, aRotationAngleDeciDeg );
2479 if( aMoveVector != wxPoint{ 0, 0 } )
2481 retVal += aMoveVector;
2497 ( (
double) aPoint.x * (
double) aPoint.x ) + ( (
double) aPoint.y * (
double) aPoint.y ) );
void SetMirrored(bool isMirrored)
Field Reference of part, i.e. "IC21".
std::map< NETELEMENT_ID, BLOCK_TERM > BlockTerminals
int getKiCadUnitNumberFromGate(const GATE_ID &aCadstarGateID)
LIB_FIELD & GetFootprintField()
Return reference to the footprint field.
power input (GND, VCC for ICs). Must be connected to a power output.
std::vector< VERTEX > Vertices
wxPoint m_designCenter
Used for calculating the required offset to apply to the Cadstar design so that it fits in KiCad canv...
SCH_FIELD instances are attached to a component and provide a place for the component's value,...
LAYER_ID LayerID
Move all objects in the Symdef to this layer.
int FindSegment(const VECTOR2I &aP) const
Function FindSegment()
ELECTRICAL_PINTYPE getKiCadPinType(const PART::PIN_TYPE &aPinType)
void SetShape(PINSHEETLABEL_SHAPE aShape)
virtual std::map< wxString, wxString > & GetTextVars() const
std::map< ROUTECODE_ID, ROUTECODE > RouteCodes
SCH_FIELD * FindField(const wxString &aFieldName, bool aIncludeDefaultFields=true)
Search for a SCH_FIELD with aFieldName.
int Intersect(const SEG &aSeg, INTERSECTIONS &aIp) const
Function Intersect()
T NormalizeAngleNeg(T Angle)
Normalize angle to be in the 0.0 .
static UTF8 FixIllegalChars(const UTF8 &aLibItemName, bool aLib=false)
Replace illegal LIB_ID item name characters with underscores '_'.
void SetFPFilters(const wxArrayString &aFilters)
int getKiCadLength(long long aCadstarLength)
std::map< PART_ID, TERMINAL_TO_PINNUM_MAP > m_pinNumsMap
Map of pin numbers in CADSTAR parts.
std::vector< INTERSECTION > INTERSECTIONS
std::pair< wxPoint, wxSize > getFigureExtentsKiCad(const FIGURE &aCadstarFigure)
std::map< TERMINAL_ID, TERMINAL > Terminals
void loadShapeVertices(const std::vector< VERTEX > &aCadstarVertices, LINECODE_ID aCadstarLineCodeID, LAYER_ID aCadstarSheetID, SCH_LAYER_ID aKiCadSchLayerID, const wxPoint &aMoveVector={ 0, 0 }, const double &aRotationAngleDeciDeg=0.0, const double &aScalingFactor=1.0, const wxPoint &aTransformCentre={ 0, 0 }, const bool &aMirrorInvert=false)
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 Merge(const EDA_RECT &aRect)
Modify the position and size of the rectangle in order to contain aRect.
Container for project specific data.
std::map< PART_DEFINITION_PIN_ID, PIN > Pins
PART::DEFINITION::PIN getPartDefinitionPin(const PART &aCadstarPart, const GATE_ID &aGateID, const TERMINAL_ID &aTerminalID)
void loadLibrarySymbolShapeVertices(const std::vector< VERTEX > &aCadstarVertices, wxPoint aSymbolOrigin, LIB_PART *aPart, int aGateNumber)
int getLineThickness(const LINECODE_ID &aCadstarLineCodeID)
void loadSchematicSymbolInstances()
SCH_FIELD * GetField(MANDATORY_FIELD_T aFieldType)
Returns a mandatory field in this symbol.
void SetOrientation(int aOrientation)
wxString ReferenceName
This is the name which identifies the symbol in the library Multiple components may exist with the sa...
SCH_COMPONENT * loadSchematicSymbol(const SYMBOL &aCadstarSymbol, const LIB_PART &aKiCadPart, double &aComponentOrientationDeciDeg)
wxPoint GetStartPoint() const
wxString GetName() const override
long SignalNum
This is undefined if the net has been given a name.
void SetFields(const std::vector< SCH_FIELD > &aFields)
Set multiple schematic fields.
std::map< GATE_ID, GATE > GateSymbols
wxFileName m_libraryFileName
Holds all the data relating to one schematic A schematic may consist of one or more sheets (and one r...
ASSIGNMENTS_SCM Assignments
std::map< ATTRIBUTE_ID, ATTRNAME > AttributeNames
void SetSize(const wxSize &aSize)
SCH_SHEET * Last() const
Return a pointer to the last SCH_SHEET of the list.
#define SIGNALNAME_ORIGIN_ATTRID
long ScaleRatioNumerator
Documentation symbols can be arbitrarily scaled when added to a design.
std::map< SYMDEF_ID, SYMDEF_SCM > SymbolDefinitions
wxString getAttributeName(const ATTRIBUTE_ID &aCadstarAttributeID)
TEXT_FIELD_NAME
These are speccial fields in text objects enclosed between the tokens '<@' and '>' such as <@[FIELD_N...
TYPE Type
Determines what the associated layer is, whether parent, child or clone.
Define a symbol library graphical text item.
std::map< VARIANT_ID, VARIANT > Variants
double getAngleTenthDegree(const long long &aCadstarAngle)
std::map< LINECODE_ID, LINECODE > LineCodes
void SetShape(GRAPHIC_PINSHAPE aShape)
void SetLineWidth(const int aSize)
CADSTAR_SCHEMATIC Schematic
void push_back(SCH_SHEET *aSheet)
Forwarded method from std::vector.
bool Replace(const wxFindReplaceData &aSearchData)
Helper function used in search and replace dialog.
KIID_PATH Path() const
Get the sheet path as an KIID_PATH.
SCHEMATIC_SETTINGS & Settings() const
std::map< LAYER_ID, SCH_SHEET * > m_sheetMap
Map between Cadstar and KiCad Sheets.
Field object used in symbol libraries.
void SetUnitCount(int aCount, bool aDuplicateDrawItems=true)
Set the units per part count.
pin for passive components: must be connected, and can be connected to any pin
void SetTextPos(const wxPoint &aPoint)
void SetVisible(bool aVisible)
std::map< NETELEMENT_ID, DANGLER > Danglers
std::map< FIGURE_ID, FIGURE > Figures
double GetTextAngle() const
long ScaleRatioDenominator
Documentation symbols can be arbitrarily scaled when added to a design.
LIB_FIELD & GetValueField()
Return reference to the value field.
TEXTCODE getTextCode(const TEXTCODE_ID &aCadstarTextCodeID)
unknown electrical properties: creates always a warning when connected
bool ReplaceIllegalFileNameChars(std::string *aName, int aReplaceChar)
Checks aName for illegal file name characters.
#define SYMBOL_NAME_ATTRID
Symbol Name attribute ID - used for placement of designators on the schematic.
void SetPageSettings(const PAGE_INFO &aPageSettings)
void SetLength(int aLength)
void SetPosition(const wxPoint &aPosition) override
std::map< FIGURE_ID, FIGURE > Figures
#define KI_FALLTHROUGH
The KI_FALLTHROUGH macro is to be used when switch statement cases should purposely fallthrough from ...
bool HasLocation
Flag to know if this ATTRIBUTE_VALUE has a location i.e.
ALIGNMENT Alignment
In CADSTAR The default alignment for a TEXT object (when "(No Alignment()" is selected) Bottom Left o...
void SetTextSize(const wxSize &aNewSize)
std::vector< SCH_FIELD > SCH_FIELDS
A container for several SCH_FIELD items.
void Load(SCHEMATIC *aSchematic, SCH_SHEET *aRootSheet, SCH_PLUGIN::SCH_PLUGIN_RELEASER *aSchPlugin, const wxFileName &aLibraryFileName)
Loads a CADSTAR PCB Archive file into the KiCad BOARD object given.
std::map< TEXT_ID, TEXT > Texts
void RotatePoint(int *pX, int *pY, double angle)
A logical library item identifier and consists of various portions much like a URI.
const SHAPE_LINE_CHAIN Reverse() const
Function Reverse()
ATTRIBUTE_LOCATION BlockLabel
POINT getLocationOfNetElement(const NET_SCH &aNet, const NETELEMENT_ID &aNetElementID)
std::map< BUS_ID, BUS > Buses
int GetTextThickness() const
std::map< wxString, wxString > FilenamesToTextMap
CADSTAR doesn't have user defined text fields but does allow loading text from a file.
void SetName(const wxString &aName)
Set a user definable field name to aName.
void SetPosition(const wxPoint &aPos) override
SCH_SCREEN * GetScreen() const
LAYER_ID AssocLayerID
Parent or Child linked sheet.
PLOT_DASH_TYPE getLineStyle(const LINECODE_ID &aCadstarLineCodeID)
const PAGE_INFO & GetPageSettings() const
LAYER_ID LayerID
Sheet on which symbol is located.
void AddPin(SCH_SHEET_PIN *aSheetPin)
Add aSheetPin to the sheet.
void SetPageNumber(const SCH_SHEET_PATH &aInstance, const wxString &aPageNumber)
Set the page number for the sheet instance aInstance.
POINT Origin
Origin of the component (this is used as the reference point when placing the component in the design...
void Parse()
Parses the file.
long ScaleRatioNumerator
Symbols can be arbitrarily scaled in CADSTAR.
std::vector< LAYER_ID > SheetOrder
A vector to also store the order in which sheets are to be displayed.
The base class for drawable items used by schematic library components.
ALIGNMENT Alignment
In CADSTAR The default alignment for a TEXT object (when "(No Alignment()" is selected) Bottom Left o...
void Append(int aX, int aY, bool aAllowDuplication=false)
Function Append()
const VECTOR2I NearestPoint(const VECTOR2I &aP, bool aAllowInternalShapePoints=true) const
Finds a point on the line chain that is closest to point aP.
void GetFields(std::vector< SCH_FIELD * > &aVector, bool aVisibleOnly)
Populates a std::vector with SCH_FIELDs.
void SetEndPoint(const wxPoint &aPosition)
Loads a csa file into a KiCad SCHEMATIC object.
void MIRROR(T &aPoint, const T &aMirrorRef)
Updates aPoint with the mirror of aPoint relative to the aMirrorRef.
std::map< SYMBOL_ID, SYMBOL > Symbols
void loadSymbolFieldAttribute(const ATTRIBUTE_LOCATION &aCadstarAttrLoc, const double &aComponentOrientationDeciDeg, bool aIsMirrored, SCH_FIELD *aKiCadField)
int GetTextHeight() const
std::map< ATTRIBUTE_ID, ATTRIBUTE_VALUE > AttributeValues
Some attributes are defined within the part definition, whilst others are defined in the part itself.
ATTRIBUTE_LOCATION AttributeLocation
void loadGraphicStaightSegment(const wxPoint &aStartPoint, const wxPoint &aEndPoint, const LINECODE_ID &aCadstarLineCodeID, const LAYER_ID &aCadstarSheetID, const SCH_LAYER_ID &aKiCadSchLayerID, const wxPoint &aMoveVector={ 0, 0 }, const double &aRotationAngleDeciDeg=0.0, const double &aScalingFactor=1.0, const wxPoint &aTransformCentre={ 0, 0 }, const bool &aMirrorInvert=false)
std::set< TEXT_FIELD_NAME > InconsistentTextFields
Text fields need to be updated in CADSTAR and it is possible that they are not consistent accross tex...
void SetNumber(const wxString &aNumber)
A mix-in class (via multiple inheritance) that handles texts such as labels, parts,...
std::vector< SCH_FIELD > & GetFields()
T NormalizeAngle180(T Angle)
Normalize angle to be in the -180.0 .. 180.0 range.
PARTNAMECOL SymbolPartNameColor
void loadSheetAndChildSheets(LAYER_ID aCadstarSheetID, wxPoint aPosition, wxSize aSheetSize, const SCH_SHEET_PATH &aParentSheet)
void SetLineStyle(const PLOT_DASH_TYPE aStyle)
SYMBOLVARIANT SymbolVariant
void SetType(ELECTRICAL_PINTYPE aType)
void loadDocumentationSymbols()
Represents a point in x,y coordinates.
LIB_FIELD & GetReferenceField()
Return reference to the reference designator field.
ALIGNMENT
From CADSTAR Help: "Text Alignment enables you to define the position of an alignment origin for all ...
LIB_FIELD * FindField(const wxString &aFieldName)
Find a field within this part matching aFieldName and returns it or NULL if not found.
wxPoint applyTransform(const wxPoint &aPoint, const wxPoint &aMoveVector={ 0, 0 }, const double &aRotationAngleDeciDeg=0.0, const double &aScalingFactor=1.0, const wxPoint &aTransformCentre={ 0, 0 }, const bool &aMirrorInvert=false)
Field Value of part, i.e. "3.3K".
virtual void SetText(const wxString &aText)
SCH_ITEM * Duplicate(bool doClone=false) const
Routine to create a new copy of given item.
const SHAPE_LINE_CHAIN ConvertToPolyline(double aAccuracy=0.005 *PCB_IU_PER_MM) const
Constructs a SHAPE_LINE_CHAIN of segments from a given arc.
long ScaleRatioDenominator
const std::vector< VECTOR2I > & CPoints() const
std::map< ATTRIBUTE_ID, ATTRCOL > AttributeColors
long TERMINAL_ID
Terminal is the pin identifier in the schematic.
DOCUMENTATION_SYMBOL_ID ID
std::map< NETELEMENT_ID, SYM_TERM > Terminals
void AddDrawItem(LIB_ITEM *aItem, bool aSort=true)
Add a new draw aItem to the draw object list and sort according to aSort.
std::map< PART_ID, PART > PartDefinitions
Describe the page size and margins of a paper page on which to eventually print or plot.
SYMDEF_ID getSymDefFromName(const wxString &aSymdefName, const wxString &aSymDefAlternate)
EDA_RECT GetBodyBoundingBox() const
Return a bounding box for the symbol body but not the fields.
long Width
Defaults to 0 if using system fonts or, if using CADSTAR font, default to equal height (1:1 aspect ra...
void SetPosition(const wxPoint &aPosition) override
std::map< SYMBOL_ID, SCH_GLOBALLABEL * > m_globalLabelsMap
Map between Cadstar and KiCad Global Labels.
void SetVertJustify(EDA_TEXT_VJUSTIFY_T aType)
std::map< BUS_ID, std::shared_ptr< BUS_ALIAS > > m_busesMap
Map of Cadstar and KiCad Buses.
void SetLayer(SCH_LAYER_ID aLayer)
Set the layer this item is on.
void SetStartPoint(const wxPoint &aPosition)
void SetDescription(const wxString &aDescription)
VARIANT_HIERARCHY VariantHierarchy
void applyTextSettings(const TEXTCODE_ID &aCadstarTextCodeID, const ALIGNMENT &aCadstarAlignment, const JUSTIFICATION &aCadstarJustification, EDA_TEXT *aKiCadTextItem)
SCH_TEXT * getKiCadSchText(const TEXT &aCadstarTextElement)
int getSheetNumber(LAYER_ID aCadstarSheetID)
int m_DefaultWireThickness
void loadChildSheets(LAYER_ID aCadstarSheetID, const SCH_SHEET_PATH &aSheet)
GATE_ID GateID
The gate this symbol represents within the associated Part.
Define a library symbol object.
SCH_FIELD * GetFieldById(int aFieldId)
Returns a field in this symbol.
Definition of file extensions used in Kicad.
void SetVisible(bool aVisible)
SCH_FIELD * AddField(const SCH_FIELD &aField)
Add a field to the symbol.
std::map< TERMINAL_ID, TERMINAL > Terminals
std::map< TERMINAL_ID, SYMPINNAME_LABEL > PinNames
Identifier of the pin in the PCB Equivalent to KiCad's Pin Number.
EDA_ITEM * GetParent() const
void SetLabelSpinStyle(LABEL_SPIN_STYLE aSpinStyle) override
Set a spin or rotation angle, along with specific horizontal and vertical justification styles with e...
PART getPart(const PART_ID &aCadstarPartID)
SYMDEF_ID SymdefID
Normally documentation symbols only have TEXT, FIGURE and TEXT_LOCATION objects which are all drawn o...
SCH_LAYER_ID
Eeschema drawing layers.
Define a sheet pin (label) used in sheets to create hierarchical schematics.
std::vector< CONNECTION_SCH > Connections
void loadItemOntoKiCadSheet(LAYER_ID aCadstarSheetID, SCH_ITEM *aItem)
Handle access to a stack of flattened SCH_SHEET objects by way of a path for creating a flattened sch...
std::unique_ptr< LIB_PART > & GetPartRef()
std::pair< BLOCK_ID, TERMINAL_ID > BLOCK_PIN_ID
std::map< REUSEBLOCK_ID, REUSEBLOCK > ReuseBlocks
static void FixTextPositionNoAlignment(EDA_TEXT *aKiCadTextItem)
Corrects the position of a text element that had NO_ALIGNMENT in CADSTAR.
std::map< NETELEMENT_ID, BUS_TERM > BusTerminals
ROUTECODE getRouteCode(const ROUTECODE_ID &aCadstarRouteCodeID)
long Param1
Either Units or X step, depending on Type (see GRID_TYPE for more details)
std::map< BLOCK_PIN_ID, SCH_HIERLABEL * > m_sheetPinMap
Map between Cadstar and KiCad Sheets Pins.
wxPoint GetPosition() const override
wxPoint GetPosition() const override
void applyToLibraryFieldAttribute(const ATTRIBUTE_LOCATION &aCadstarAttrLoc, wxPoint aSymbolOrigin, LIB_FIELD *aKiCadField)
double getPolarRadius(wxPoint aPoint)
LIB_FIELD * GetFieldById(int aId) const
Return pointer to the requested field.
SCH_PLUGIN::SCH_PLUGIN_RELEASER * m_plugin
POINT Origin
Origin of the component (this is used as the reference point when placing the component in the design...
static const long UNDEFINED_VALUE
int SegmentCount() const
Function SegmentCount()
void SetHeightMils(int aHeightInMils)
Corresponds to CADSTAR "origin".
std::vector< VERTEX > Vertices
< Nodename = "VARIANT" or "VMASTER" (master variant
LAYER_ID LayerID
The sheet block is on (TODO: verify this is true)
std::vector< LAYER_ID > findOrphanSheets()
std::map< SYMBOL_ID, SCH_COMPONENT * > m_powerSymMap
Map between Cadstar and KiCad Power Symbols.
void loadHierarchicalSheetPins()
std::map< BLOCK_ID, BLOCK > Blocks
LABEL_SPIN_STYLE RotateCCW()
Sheet symbol placed in a schematic, and is the entry point for a sub schematic.
PLOT_DASH_TYPE
Dashed line types.
PROJECT & Prj() const override
Return a reference to the project this schematic is part of.
static wxString generateLibName(const wxString &aRefName, const wxString &aAlternateName)
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, const CPTREE &aTree)
Output a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
The first 4 are mandatory, and must be instantiated in SCH_COMPONENT and LIB_PART constructors.
int KiCadUnitDivider
Use this value to convert units in this CSA file to KiCad units.
void SetTextWidth(int aWidth)
constexpr double SCH_IU_PER_MM
JUSTIFICATION Justification
Note: Justification has no effect on single lines of text.
Helper object to release a SCH_PLUGIN in the context of a potential thrown exception through its dest...
bool HidePinNames
Specifies whether to display the pin names/indentifier in the schematic symbol or not.
void SetRef(const SCH_SHEET_PATH *aSheet, const wxString &aReference)
Set the reference for the given sheet path for this symbol.
JUSTIFICATION
From CADSTAR Help: "Multi Line Text can also be justified as Left, Centre or Right.
bool LocatePathOfScreen(SCH_SCREEN *aScreen, SCH_SHEET_PATH *aList)
Search the existing hierarchy for an instance of screen loaded from aFileName.
std::vector< CUTOUT > Cutouts
Not Applicable to OPENSHAPE Type.
SEG Segment(int aIndex)
Function Segment()
std::map< TEXTCODE_ID, TEXTCODE > TextCodes
Param1 = Units, Param2 = Divisor.
wxString getAttributeValue(const ATTRIBUTE_ID &aCadstarAttributeID, const std::map< ATTRIBUTE_ID, ATTRIBUTE_VALUE > &aCadstarAttributeMap)
LABEL_SPIN_STYLE getSpinStyle(const long long &aCadstarOrientation, bool aMirror)
void SetName(const wxString &aName)
void loadSymDefIntoLibrary(const SYMDEF_ID &aSymdefID, const PART *aCadstarPart, const GATE_ID &aGateID, LIB_PART *aPart)
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...
void AddBusAlias(std::shared_ptr< BUS_ALIAS > aAlias)
Adds a bus alias definition (and transfers ownership of the pointer)
int getComponentOrientation(double aOrientAngleDeciDeg, double &aReturnedOrientationDeciDeg)
Segment description base class to describe items which have 2 end points (track, wire,...
void SetShowPinNumbers(bool aShow)
Set or clear the pin number visibility flag.
ELECTRICAL_PINTYPE
The component library pin object electrical types used in ERC tests.
void Append(SCH_ITEM *aItem)
wxString Name
This is undefined (wxEmptyString) if the net is unnamed.
void SetHorizJustify(EDA_TEXT_HJUSTIFY_T aType)
usual pin input: must be connected
T NormalizeAnglePos(T Angle)
Normalize angle to be in the 0.0 .
long Param2
Either Divisor or Y step, depending on Type (see GRID_TYPE for more details)
JUSTIFICATION Justification
Note: Justification has no effect on single lines of text.
wxPoint getKiCadLibraryPoint(wxPoint aCadstarPoint, wxPoint aCadstarCentre)
void SetWidthMils(int aWidthInMils)
Handle the component boundary box.
const std::string KiCadSchematicFileExtension
std::map< LAYER_ID, SHEET_NAME > SheetNames
void SetTextHeight(int aHeight)
LAYER_ID LayerID
Sheet on which bus is located.
static bool ClassOf(const EDA_ITEM *aItem)
constexpr ret_type KiROUND(fp_type v)
Round a floating point number to an integer using "round halfway cases away from zero".
std::map< ATTRIBUTE_ID, ATTRIBUTE_VALUE > AttributeValues
Some attributes are defined within the part definition, whilst others are defined in the part.
std::map< ATTRIBUTE_ID, TEXT_LOCATION > TextLocations
This contains location of any attributes, including designator position.
std::map< GROUP_ID, GROUP > Groups
POINT Position
Pad position within the component's coordinate frame.
ATTRIBUTE_LOCATION AttrLoc
SYMBOL_ID VariantParentSymbolID
wxString Alternate
This is in addition to ReferenceName.
std::map< NET_ID, NET_SCH > Nets
Class for a wire to bus entry.
ATTRIBUTE_LOCATION AttrLoc
wxPoint getKiCadPoint(wxPoint aCadstarPoint)
void SetPosition(const wxPoint &aPosition) override
input or output (like port for a microprocessor)
wxString getNetName(const NET_SCH &aNet)
void SetTextThickness(int aWidth)
The TextThickness is that set by the user.
wxString LAYER_ID
ID of a Sheet (if schematic) or board Layer (if PCB)
LABEL_SPIN_STYLE getSpinStyleDeciDeg(const double &aOrientationDeciDeg)
void Update(SCH_ITEM *aItem)
Updates aItem's bounding box in the tree.
virtual void SetTextAngle(double aAngle)
double ArcTangente(int dy, int dx)
void SetLabelSpinStyle(LABEL_SPIN_STYLE aSpinStyle) override
Set a spin or rotation angle, along with specific horizontal and vertical justification styles with e...
void SetFileName(const wxString &aFileName)
std::map< TEXT_ID, TEXT > Texts
void UpdatePins()
Updates the cache of SCH_PIN objects for each pin.
void Replace(int aStartIndex, int aEndIndex, const VECTOR2I &aP)
Function Replace()
virtual void SetLabelSpinStyle(LABEL_SPIN_STYLE aSpinStyle)
Set a spin or rotation angle, along with specific horizontal and vertical justification styles with e...
Definition of the SCH_SHEET_PATH and SCH_SHEET_LIST classes for Eeschema.
bool isAttributeVisible(const ATTRIBUTE_ID &aCadstarAttributeID)
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...
void SetShowPinNames(bool aShow)
Set or clear the pin name visibility flag.
double getPolarAngle(wxPoint aPoint)
void SetPosition(const wxPoint &aPosition) override
std::map< DOCUMENTATION_SYMBOL_ID, DOCUMENTATION_SYMBOL > DocumentationSymbols
std::map< FIGURE_ID, FIGURE > Figures
std::map< NETELEMENT_ID, JUNCTION_SCH > Junctions
static constexpr int Millimeter2iu(double mm)
void AddField(LIB_FIELD *aField)
Add a field.
void SetPosition(const wxPoint &aPosition) override
NO_ALIGNMENT has different meaning depending on the object type.
Base class for any item which can be embedded within the SCHEMATIC container class,...
#define THROW_IO_ERROR(msg)
std::map< wxString, LIB_PART * > m_powerSymLibMap
Map of KiCad Power Symbol Library items.
virtual const wxString & GetText() const
Return the string associated with the text object.
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< ATTRIBUTE_ID, ATTRIBUTE_VALUE > AttributeValues
void loadFigure(const FIGURE &aCadstarFigure, const LAYER_ID &aCadstarSheetIDOverride, SCH_LAYER_ID aKiCadSchLayerID, const wxPoint &aMoveVector={ 0, 0 }, const double &aRotationAngleDeciDeg=0.0, const double &aScalingFactor=1.0, const wxPoint &aTransformCentre={ 0, 0 }, const bool &aMirrorInvert=false)
static const std::map< TEXT_FIELD_NAME, wxString > CADSTAR_TO_KICAD_FIELDS
Map between CADSTAR fields and KiCad text variables.
bool AddInstance(const KIID_PATH &aInstance)
Add a new instance aSheetPath to the instance list.
Represents a cutout in a closed shape (e.g.
const wxSize GetSize() const
KICAD_T Type() const
Returns the type of object.
Represents a vertex in a shape.
std::map< PART_ID, LIB_PART * > m_partMap
Map between Cadstar and KiCad Parts.
void SetOrientation(int aOrientation)
Compute the new transform matrix based on aOrientation for the symbol which is applied to the current...
wxPoint GetEndPoint() const