68 long long maxDesignSizekicad = std::numeric_limits<int>::max();
70 if( designSizeXkicad > maxDesignSizekicad || designSizeYkicad > maxDesignSizekicad )
73 _(
"The design is too large and cannot be imported into KiCad. \n"
74 "Please reduce the maximum design size in CADSTAR by navigating to: \n"
75 "Design Tab -> Properties -> Design Options -> Maximum Design Size. \n"
76 "Current Design size: %.2f, %.2f millimeters. \n"
77 "Maximum permitted design size: %.2f, %.2f millimeters.\n" ),
91 _(
"The selected file indicates that nets might be out of synchronisation "
92 "with the schematic. It is recommended that you carry out an 'Align Nets' "
93 "procedure in CADSTAR and re-import, to avoid inconsistencies between the "
94 "PCB and the schematic. " ) );
131 wxLogError( wxString::Format(
_(
"Unable to determine zone fill priorities for layer "
132 "'%s'. A best attempt has been made but it is "
133 "possible that DRC errors exist and that manual "
134 "editing of the zone priorities is required." ),
145 _(
"The CADSTAR design contains Trunk routing elements, which have no KiCad "
146 "equivalent. These elements were not loaded." ) );
151 wxLogWarning( wxString::Format(
152 _(
"The CADSTAR design contains variants which has no KiCad equivalent. Only "
153 "the variant '%s' was loaded." ),
160 _(
"The CADSTAR design contains re-use blocks which has no KiCad equivalent. The "
161 "re-use block information has been discarded during the import." ) );
164 wxLogWarning(
_(
"CADSTAR fonts are different to the ones in KiCad. This will likely result "
165 "in alignment issues that may cause DRC errors. Please review the imported "
166 "text elements carefully and correct manually if required." ) );
169 _(
"The CADSTAR design has been imported successfully.\n"
170 "Please review the import errors and warnings (if any)." ) );
175 std::vector<FOOTPRINT*> retval;
177 for( std::pair<SYMDEF_ID, FOOTPRINT*> fpPair :
m_libraryMap )
179 retval.push_back(
static_cast<FOOTPRINT*
>( fpPair.second->Clone() ) );
195 for( std::pair<SYMDEF_ID, FOOTPRINT*> libItem :
m_libraryMap )
216 std::vector<std::unique_ptr<FOOTPRINT>> retval;
220 footprint->SetParent(
nullptr );
221 retval.emplace_back( footprint );
239 wxLogWarning( wxString::Format(
240 _(
"The CADSTAR layer '%s' has no KiCad equivalent. All elements on this "
241 "layer have been mapped to KiCad layer '%s' instead." ),
242 aCadstarLayerName,
LSET::Name( aKiCadLayer ) ) );
252 wxLogMessage( wxString::Format(
253 _(
"The CADSTAR layer '%s' has been assumed to be a technical layer. All "
254 "elements on this layer have been mapped to KiCad layer '%s'." ),
255 aCadstarLayerName,
LSET::Name( aKiCadLayer ) ) );
262 int aDielectricSublayer )
274 if( !aCadstarLayer.
Name.IsEmpty() )
288 LAYER_ID ElecLayerID = wxEmptyString;
291 std::vector<LAYER_ID> ConstructionLayers;
296 bool IsInitialised() {
return !ElecLayerID.IsEmpty() || ConstructionLayers.size() > 0; };
299 std::vector<LAYER_BLOCK> cadstarBoardStackup;
300 LAYER_BLOCK currentBlock;
312 if( currentBlock.IsInitialised() )
314 cadstarBoardStackup.push_back( currentBlock );
315 currentBlock = LAYER_BLOCK();
318 currentBlock.ElecLayerID = cadstarLayerID;
325 wxLogWarning( wxString::Format(
_(
"The CADSTAR construction layer '%s' is on "
326 "the outer surface of the board. It has been "
328 cadstarLayer.
Name ) );
332 currentBlock.ConstructionLayers.push_back( cadstarLayerID );
337 if( currentBlock.IsInitialised() )
338 cadstarBoardStackup.push_back( currentBlock );
343 if( cadstarBoardStackup.back().ConstructionLayers.size() > 0 )
345 for(
const LAYER_ID& layerID : cadstarBoardStackup.back().ConstructionLayers )
349 wxLogWarning( wxString::Format(
_(
"The CADSTAR construction layer '%s' is on "
350 "the outer surface of the board. It has been "
352 cadstarLayer.
Name ) );
355 cadstarBoardStackup.back().ConstructionLayers.clear();
361 LAYER_BLOCK bottomLayer = cadstarBoardStackup.back();
362 cadstarBoardStackup.pop_back();
364 LAYER_BLOCK secondToLastLayer = cadstarBoardStackup.back();
365 cadstarBoardStackup.pop_back();
367 LAYER_BLOCK dummyLayer;
369 if( secondToLastLayer.ConstructionLayers.size() > 0 )
371 LAYER_ID lastConstruction = secondToLastLayer.ConstructionLayers.back();
373 if( secondToLastLayer.ConstructionLayers.size() > 1 )
377 secondToLastLayer.ConstructionLayers.pop_back();
386 dummyLayer.ConstructionLayers.push_back( lastConstruction );
389 cadstarBoardStackup.push_back( secondToLastLayer );
390 cadstarBoardStackup.push_back( dummyLayer );
391 cadstarBoardStackup.push_back( bottomLayer );
396 wxASSERT( cadstarBoardStackup.back().ConstructionLayers.size() == 0 );
407 size_t stackIndex = 0;
411 if( item->GetType() == BOARD_STACKUP_ITEM_TYPE::BS_ITEM_TYPE_COPPER )
413 LAYER_ID layerID = cadstarBoardStackup.at( stackIndex ).ElecLayerID;
415 if( layerID.IsEmpty() )
418 item->SetThickness( 0 );
424 LAYER_T copperType = LAYER_T::LT_SIGNAL;
426 switch( copperLayer.
Type )
429 copperType = LAYER_T::LT_JUMPER;
433 copperType = LAYER_T::LT_SIGNAL;
437 copperType = LAYER_T::LT_POWER;
442 wxFAIL_MSG( wxT(
"Unexpected Layer type. Was expecting an electrical type" ) );
448 m_layermap.insert( { copperLayer.
ID, item->GetBrdLayerId() } );
451 else if( item->GetType() == BOARD_STACKUP_ITEM_TYPE::BS_ITEM_TYPE_DIELECTRIC )
453 LAYER_BLOCK layerBlock = cadstarBoardStackup.at( stackIndex );
454 LAYER_BLOCK layerBlockBelow = cadstarBoardStackup.at( stackIndex + 1 );
456 if( layerBlock.ConstructionLayers.size() == 0 )
462 int dielectricId = stackIndex + 1;
463 item->SetDielectricLayerId( dielectricId );
468 if( layerBlock.ElecLayerID.IsEmpty() )
477 if( layerBlockBelow.ElecLayerID.IsEmpty() )
488 LAYER copperLayerBelow =
506 int dielectricSublayer = 0;
508 for(
LAYER_ID constructionLaID : layerBlock.ConstructionLayers )
512 if( dielectricSublayer )
513 item->AddDielectricPrms( dielectricSublayer );
517 m_layermap.insert( { dielectricLayer.
ID, item->GetBrdLayerId() } );
518 ++dielectricSublayer;
523 else if( item->GetType() == BOARD_STACKUP_ITEM_TYPE::BS_ITEM_TYPE_SILKSCREEN )
525 item->SetColor( wxT(
"White" ) );
527 else if( item->GetType() == BOARD_STACKUP_ITEM_TYPE::BS_ITEM_TYPE_SOLDERMASK )
529 item->SetColor( wxT(
"Green" ) );
537 int numElecLayersProcessed = 0;
540 int currentDocLayer = 0;
547 PCB_LAYER_ID kicadLayerID = PCB_LAYER_ID::UNDEFINED_LAYER;
548 wxString layerName = curLayer.
Name.Lower();
561 kicadLayerID = aBack;
563 kicadLayerID = aFront;
567 case LOG_LEVEL::NONE:
574 case LOG_LEVEL::WARN:
580 switch( curLayer.
Type )
588 THROW_IO_ERROR( wxString::Format(
_(
"Unexpected layer '%s' in layer stack." ),
595 ++numElecLayersProcessed;
603 if( currentDocLayer >= docLayers.size() )
606 kicadLayerID = docLayers.at( currentDocLayer++ );
614 selectLayerID( PCB_LAYER_ID::F_Fab, PCB_LAYER_ID::B_Fab, LOG_LEVEL::NONE );
618 selectLayerID( PCB_LAYER_ID::F_CrtYd, PCB_LAYER_ID::B_CrtYd, LOG_LEVEL::NONE );
624 if( layerName.Contains( wxT(
"glue" ) ) || layerName.Contains( wxT(
"adhesive" ) ) )
626 selectLayerID( PCB_LAYER_ID::F_Adhes, PCB_LAYER_ID::B_Adhes, LOG_LEVEL::MSG );
628 else if( layerName.Contains( wxT(
"silk" ) ) || layerName.Contains( wxT(
"legend" ) ) )
630 selectLayerID( PCB_LAYER_ID::F_SilkS, PCB_LAYER_ID::B_SilkS, LOG_LEVEL::MSG );
632 else if( layerName.Contains( wxT(
"assembly" ) ) || layerName.Contains( wxT(
"fabrication" ) ) )
634 selectLayerID( PCB_LAYER_ID::F_Fab, PCB_LAYER_ID::B_Fab, LOG_LEVEL::MSG );
636 else if( layerName.Contains( wxT(
"resist" ) ) || layerName.Contains( wxT(
"mask" ) ) )
638 selectLayerID( PCB_LAYER_ID::F_Mask, PCB_LAYER_ID::B_Mask, LOG_LEVEL::MSG );
640 else if( layerName.Contains( wxT(
"paste" ) ) )
642 selectLayerID( PCB_LAYER_ID::F_Paste, PCB_LAYER_ID::B_Paste, LOG_LEVEL::MSG );
647 selectLayerID( PCB_LAYER_ID::Eco1_User, PCB_LAYER_ID::Eco2_User,
653 selectLayerID( PCB_LAYER_ID::F_Paste, PCB_LAYER_ID::B_Paste, LOG_LEVEL::MSG );
657 selectLayerID( PCB_LAYER_ID::F_SilkS, PCB_LAYER_ID::B_SilkS, LOG_LEVEL::MSG );
661 selectLayerID( PCB_LAYER_ID::F_Mask, PCB_LAYER_ID::B_Mask, LOG_LEVEL::MSG );
667 selectLayerID( PCB_LAYER_ID::Eco1_User, PCB_LAYER_ID::Eco2_User, LOG_LEVEL::WARN );
671 wxFAIL_MSG( wxT(
"Unknown CADSTAR Layer Sub-type" ) );
677 wxFAIL_MSG( wxT(
"Unknown CADSTAR Layer Type" ) );
692 std::vector<INPUT_LAYER_DESC> inputLayers;
693 std::map<wxString, LAYER_ID> cadstarLayerNameMap;
695 for( std::pair<LAYER_ID, PCB_LAYER_ID> layerPair :
m_layermap )
707 inputLayers.push_back( iLdesc );
708 cadstarLayerNameMap.insert( { curLayer->
Name, curLayer->
ID } );
712 if( inputLayers.size() == 0 )
718 for( std::pair<wxString, PCB_LAYER_ID> layerPair : reMappedLayers )
720 if( layerPair.second == PCB_LAYER_ID::UNDEFINED_LAYER )
722 wxFAIL_MSG( wxT(
"Unexpected Layer ID" ) );
726 LAYER_ID cadstarLayerID = cadstarLayerNameMap.at( layerPair.first );
727 m_layermap.at( cadstarLayerID ) = layerPair.second;
728 enabledLayers |=
LSET( layerPair.second );
742 [&]( wxString aID,
int* aVal )
744 if( spacingCodes.find( aID ) == spacingCodes.end() )
745 wxLogWarning(
_(
"Design rule %s was not found. This was ignored." ) );
763 auto applyNetClassRule =
764 [&]( wxString aID, std::shared_ptr<NETCLASS>& aNetClassPtr )
767 applyRule( aID, &value );
770 aNetClassPtr->SetClearance( value );
773 applyNetClassRule(
"T_T", bds.
m_NetSettings->m_DefaultNetClass );
775 wxLogWarning(
_(
"KiCad design rules are different from CADSTAR ones. Only the compatible "
776 "design rules were imported. It is recommended that you review the design "
777 "rules that have been applied." ) );
793 if( component.
Figures.size() > 0 )
796 componentLayer = firstFigure.
LayerID;
798 else if( component.
Texts.size() > 0 )
800 TEXT firstText = component.
Texts.begin()->second;
801 componentLayer = firstText.
LayerID;
824 m_libraryMap.insert( std::make_pair( key, footprint ) );
832 for( std::pair<FIGURE_ID, FIGURE> figPair : aComponent.
Figures )
834 FIGURE& fig = figPair.second;
841 wxString::Format( wxT(
"Component %s:%s -> Figure %s" ),
854 bool compCopperError =
false;
861 LSET remainingLayers = layers;
863 if( !compCopperError && copperLayers.count() > 1 && compCopper.
AssociatedPadIDs.size() > 0 )
866 wxLogError(
_(
"Footprint definition '%s' has component copper associated to a pad on "
867 "multiple layers. Custom padstacks are not supported in KiCad. The "
868 "copper items have been imported as graphical elements." ),
871 compCopperError =
true;
900 std::unique_ptr<PAD>
pad = std::make_unique<PAD>( aFootprint );
901 pad->SetAttribute( PAD_ATTRIB::SMD );
902 pad->SetLayerSet( copperLayers );
904 ? wxString::Format( wxT(
"%ld" ), anchorPad.
ID )
914 if( anchorSize <= 0 )
917 pad->SetShape( PAD_SHAPE::CUSTOM );
918 pad->SetAnchorPadShape( PAD_SHAPE::CIRCLE );
919 pad->SetSize( { anchorSize, anchorSize } );
920 pad->SetPosition( anchorPos );
924 shapePolys.
Move( -anchorPos );
925 pad->AddPrimitivePoly( shapePolys, 0,
true );
936 aFootprint->
Add(
pad.release(), ADD_MODE::APPEND );
941 remainingLayers ^= copperLayers;
944 if( remainingLayers.any() )
949 wxString::Format( wxT(
"Component %s:%s -> Copper element" ),
961 for( std::pair<COMP_AREA_ID, COMPONENT_AREA> areaPair : aComponent.
ComponentAreas )
967 int lineThickness = 0;
970 aFootprint->
Add( zone, ADD_MODE::APPEND );
992 libName << wxT(
" (" ) << aComponent.
Alternate << wxT(
")" );
995 wxString::Format(
_(
"The CADSTAR area '%s' in library component '%s' does not "
996 "have a KiCad equivalent. The area is neither a via nor "
997 "route keepout area. The area was not imported." ),
998 area.
ID, libName ) );
1007 for( std::pair<PAD_ID, COMPONENT_PAD> padPair : aComponent.
ComponentPads )
1010 aFootprint->
Add(
pad, ADD_MODE::APPEND );
1021 std::unique_ptr<PAD>
pad = std::make_unique<PAD>( aParent );
1024 switch( aCadstarPad.
Side )
1039 wxFAIL_MSG( wxT(
"Unknown Pad type" ) );
1042 pad->SetAttribute( PAD_ATTRIB::SMD );
1043 pad->SetLocalSolderMaskMargin( 0 );
1044 pad->SetLocalSolderPasteMargin( 0 );
1045 pad->SetLocalSolderPasteMarginRatio( 0.0 );
1046 bool complexPadErrorLogged =
false;
1048 for(
auto& reassign : csPadcode.
Reassigns )
1053 if( shape.
Size == 0 )
1055 padLayerSet.reset( kiLayer );
1063 std::optional<int> localMargin =
pad->GetLocalSolderMaskMargin();
1065 if( !localMargin.has_value() )
1066 pad->SetLocalSolderMaskMargin( newMargin );
1068 pad->SetLocalSolderMaskMargin( newMargin );
1072 std::optional<int> localMargin =
pad->GetLocalSolderPasteMargin();
1074 if( !localMargin.has_value() )
1075 pad->SetLocalSolderPasteMargin( newMargin );
1077 pad->SetLocalSolderPasteMargin( newMargin );
1083 if( !complexPadErrorLogged )
1085 complexPadErrorLogged =
true;
1089 _(
"The CADSTAR pad definition '%s' is a complex pad stack, "
1090 "which is not supported in KiCad. Please review the "
1091 "imported pads as they may require manual correction." ),
1098 pad->SetLayerSet( padLayerSet );
1105 pad->SetNumber( wxT(
"" ) );
1110 ? wxString::Format( wxT(
"%ld" ), aCadstarPad.
ID )
1122 pad->SetAttribute( PAD_ATTRIB::SMD );
1137 pad->SetShape( PAD_SHAPE::CIRCLE );
1143 pad->SetShape( PAD_SHAPE::CHAMFERED_RECT );
1148 pad->SetChamferPositions( RECT_CHAMFER_POSITIONS::RECT_CHAMFER_BOTTOM_LEFT
1149 | RECT_CHAMFER_POSITIONS::RECT_CHAMFER_TOP_LEFT );
1150 pad->SetRoundRectRadiusRatio( 0.5 );
1151 pad->SetChamferRectRatio( 0.0 );
1158 pad->SetShape( PAD_SHAPE::CIRCLE );
1168 pad->SetShape( PAD_SHAPE::RECTANGLE );
1169 pad->SetChamferRectRatio( 0.5 );
1170 pad->SetSize( { sizeOfSquare, sizeOfSquare } );
1178 pad->SetShape( PAD_SHAPE::OVAL );
1189 pad->SetShape( PAD_SHAPE::CHAMFERED_RECT );
1190 pad->SetChamferPositions( RECT_CHAMFER_POSITIONS::RECT_CHAMFER_ALL );
1191 pad->SetChamferRectRatio( 0.25 );
1197 pad->SetShape( PAD_SHAPE::RECTANGLE );
1208 pad->SetShape( PAD_SHAPE::ROUNDRECT );
1221 pad->SetShape( PAD_SHAPE::RECTANGLE );
1227 wxFAIL_MSG( wxT(
"Unknown Pad Shape" ) );
1240 pad->SetDrillShape( PAD_DRILL_SHAPE::OBLONG );
1247 pad->SetDrillShape( PAD_DRILL_SHAPE::CIRCLE );
1256 pad->SetAttribute( PAD_ATTRIB::PTH );
1258 pad->SetAttribute( PAD_ATTRIB::NPTH );
1262 pad->SetDrillSize( { 0, 0 } );
1267 LSET lset =
pad->GetLayerSet();
1270 if( lset.size() > 0 )
1276 pad->SetPosition( { 0, 0 } );
1277 pad->TransformShapeToPolygon( padOutline, layer, 0, maxError,
ERROR_INSIDE );
1280 padShape->
SetShape( SHAPE_T::POLY );
1284 padShape->
Move( padOffset - drillOffset );
1289 if( editedPadOutline.
Contains( { 0, 0 } ) )
1291 pad->SetAnchorPadShape( PAD_SHAPE::RECTANGLE );
1293 pad->SetShape( PAD_SHAPE::CUSTOM );
1294 pad->AddPrimitive( padShape );
1295 padOffset = { 0, 0 };
1302 drillOffset = { 0, 0 };
1307 _(
"The CADSTAR pad definition '%s' has the hole shape outside the "
1308 "pad shape. The hole has been moved to the center of the pad." ),
1314 wxFAIL_MSG( wxT(
"No copper layers defined in the pad?" ) );
1316 pad->SetOffset( drillOffset );
1321 pad->SetOffset( drillOffset );
1337 wxLogError(
_(
"The CADSTAR pad definition '%s' has import errors: %s" ),
1344 return pad.release();
1349 const PAD_ID aCadstarPadID )
1351 size_t index = aCadstarPadID - (long) 1;
1353 if( !( index < aFootprint->Pads().size() ) )
1355 THROW_IO_ERROR( wxString::Format(
_(
"Unable to find pad index '%d' in footprint '%s'." ),
1356 (
long) aCadstarPadID,
1360 return aFootprint->
Pads().at( index );
1366 for( std::pair<GROUP_ID, GROUP> groupPair :
Layout.
Groups )
1368 GROUP& csGroup = groupPair.second;
1380 for( std::pair<GROUP_ID, GROUP> groupPair :
Layout.
Groups )
1382 GROUP& csGroup = groupPair.second;
1384 if( !csGroup.
GroupID.IsEmpty() )
1388 THROW_IO_ERROR( wxString::Format(
_(
"Unable to find group ID %s in the group "
1394 THROW_IO_ERROR( wxString::Format(
_(
"Unable to find sub group %s in the group "
1395 "map (parent group ID=%s, Name=%s)." ),
1404 parentGroup->
AddItem( kiCadGroup );
1413 for( std::pair<BOARD_ID, CADSTAR_BOARD> boardPair :
Layout.
Boards )
1419 wxString::Format( wxT(
"BOARD %s" ), board.
ID ),
1422 if( !board.
GroupID.IsEmpty() )
1434 for( std::pair<FIGURE_ID, FIGURE> figPair :
Layout.
Figures )
1436 FIGURE& fig = figPair.second;
1443 wxString::Format( wxT(
"FIGURE %s" ), fig.
ID ),
1456 for( std::pair<TEXT_ID, TEXT> txtPair :
Layout.
Texts )
1458 TEXT& csTxt = txtPair.second;
1470 switch( csDim.
Type )
1472 case DIMENSION::TYPE::LINEARDIM:
1475 case DIMENSION::SUBTYPE::ANGLED:
1476 wxLogWarning( wxString::Format(
_(
"Dimension ID %s is an angled dimension, which "
1477 "has no KiCad equivalent. An aligned dimension "
1478 "was loaded instead." ),
1481 case DIMENSION::SUBTYPE::DIRECT:
1482 case DIMENSION::SUBTYPE::ORTHOGONAL:
1484 if( csDim.
Line.
Style == DIMENSION::LINE::STYLE::EXTERNAL )
1486 wxLogWarning( wxString::Format(
1487 _(
"Dimension ID %s has 'External' style in CADSTAR. External "
1488 "dimension styles are not yet supported in KiCad. The dimension "
1489 "object was imported with an internal dimension style instead." ),
1495 if( csDim.
Subtype == DIMENSION::SUBTYPE::ORTHOGONAL )
1519 VECTOR2I crossbarVector = crossbarEnd - crossbarStart;
1521 double height = 0.0;
1523 if( csDim.
Subtype == DIMENSION::SUBTYPE::ORTHOGONAL )
1526 height = heightVector.
y;
1528 height = heightVector.
x;
1534 height = heightVector.
x * angle.
Cos() + heightVector.
y * angle.
Sin();
1544 wxLogError(
_(
"Unexpected Dimension type (ID %s). This was not imported." ),
1550 case DIMENSION::TYPE::LEADERDIM:
1553 if( csDim.
Line.
Style == DIMENSION::LINE::STYLE::INTERNAL )
1677 case DIMENSION::TYPE::ANGLEDIM:
1679 wxLogError(
_(
"Dimension %s is an angular dimension which has no KiCad equivalent. "
1680 "The object was not imported." ),
1690 for( std::pair<AREA_ID, AREA> areaPair :
Layout.
Areas )
1692 AREA& area = areaPair.second;
1696 int lineThickness = 0;
1719 wxLogWarning( wxString::Format(
_(
"The CADSTAR area '%s' is marked as a placement "
1720 "area in CADSTAR. Placement areas are not "
1721 "supported in KiCad. Only the supported elements "
1722 "for the area were imported." ),
1728 wxLogError( wxString::Format(
_(
"The CADSTAR area '%s' does not have a KiCad "
1729 "equivalent. Pure Placement areas are not supported." ),
1755 THROW_IO_ERROR( wxString::Format(
_(
"Unable to find component '%s' in the library"
1756 "(Symdef ID: '%s')" ),
1761 FOOTPRINT* libFootprint = fpIter->second;
1780 for( std::pair<PART_DEFINITION_PIN_ID, PART::DEFINITION::PIN> pinPair :
1783 PART::DEFINITION::PIN
pin = pinPair.second;
1784 wxString pinName =
pin.Name;
1786 if( pinName.empty() )
1787 pinName =
pin.Identifier;
1789 if( pinName.empty() )
1790 pinName = wxString::Format( wxT(
"%ld" ),
pin.ID );
1802 for( std::pair<PAD_ID, PADEXCEPTION> padPair : comp.
PadExceptions )
1811 if( !padEx.
PadCode.IsEmpty() )
1826 wxString padNumber = kiPad->
GetNumber();
1841 footprint->
SetValue( wxEmptyString );
1857 if( !comp.
PartID.IsEmpty() && comp.
PartID != wxT(
"NO_PART" ) )
1869 for( std::pair<DOCUMENTATION_SYMBOL_ID, DOCUMENTATION_SYMBOL> docPair :
1879 THROW_IO_ERROR( wxString::Format(
_(
"Unable to find documentation symbol in the "
1880 "library (Symdef ID: '%s')" ),
1884 SYMDEF_PCB& docSymDefinition = ( *docSymIter ).second;
1891 bool mirrorInvert = docSymInstance.
Mirror;
1896 if( !docSymDefinition.
Alternate.IsEmpty() )
1897 groupName += wxT(
" (" ) + docSymDefinition.
Alternate + wxT(
")" );
1905 for( std::pair<FIGURE_ID, FIGURE> figPair : docSymDefinition.
Figures )
1907 FIGURE fig = figPair.second;
1909 wxString::Format( wxT(
"DOCUMENTATION SYMBOL %s, FIGURE %s" ),
1911 m_board, groupID, moveVector, rotationAngle, scalingFactor,
1912 centreOfTransform, mirrorInvert );
1916 for( std::pair<TEXT_ID, TEXT> textPair : docSymDefinition.
Texts )
1918 TEXT txt = textPair.second;
1920 rotationAngle, scalingFactor, centreOfTransform, mirrorInvert );
1930 TEMPLATE& csTemplate = tempPair.second;
1932 int zonelinethickness = 0;
1942 if( !( csTemplate.
NetID.IsEmpty() || csTemplate.
NetID == wxT(
"NONE" ) ) )
1947 wxLogWarning( wxString::Format(
1948 _(
"The CADSTAR template '%s' has the setting 'Allow in No Routing Areas' "
1949 "enabled. This setting has no KiCad equivalent, so it has been ignored." ),
1950 csTemplate.
Name ) );
1955 wxLogWarning( wxString::Format(
1956 _(
"The CADSTAR template '%s' has the setting 'Box Isolated Pins' "
1957 "enabled. This setting has no KiCad equivalent, so it has been ignored." ),
1958 csTemplate.
Name ) );
1963 wxLogWarning( wxString::Format(
1964 _(
"The CADSTAR template '%s' has the setting 'Automatic Repour' "
1965 "enabled. This setting has no KiCad equivalent, so it has been ignored." ),
1966 csTemplate.
Name ) );
1974 wxLogWarning( wxString::Format(
1975 _(
"The CADSTAR template '%s' has a non-zero value defined for the "
1976 "'Sliver Width' setting. There is no KiCad equivalent for "
1977 "this, so this setting was ignored." ),
1978 csTemplate.
Name ) );
1984 wxLogWarning( wxString::Format(
1985 _(
"The CADSTAR template '%s' has different settings for 'Retain Poured Copper "
1986 "- Disjoint' and 'Retain Poured Copper - Isolated'. KiCad does not "
1987 "distinguish between these two settings. The setting for disjoint copper "
1988 "has been applied as the minimum island area of the KiCad Zone." ),
1989 csTemplate.
Name ) );
1992 long long minIslandArea = -1;
2019 if( csTemplate.
Pouring.
FillType == TEMPLATE::POURING::COPPER_FILL_TYPE::HATCHED )
2021 zone->
SetFillMode( ZONE_FILL_MODE::HATCH_PATTERN );
2035 wxLogWarning( wxString::Format(
2036 _(
"The CADSTAR template '%s' has different settings for thermal relief "
2037 "in pads and vias. KiCad only supports one single setting for both. The "
2038 "setting for pads has been applied." ),
2039 csTemplate.
Name ) );
2050 if( spokeWidth < minThickness )
2052 wxLogWarning( wxString::Format(
2053 _(
"The CADSTAR template '%s' has thermal reliefs in the original design "
2054 "but the spoke width (%.2f mm) is thinner than the minimum thickness of "
2055 "the zone (%.2f mm). KiCad requires the minimum thickness of the zone "
2056 "to be preserved. Therefore the minimum thickness has been applied as "
2057 "the new spoke width and will be applied next time the zones are "
2062 spokeWidth = minThickness;
2085 NET_ID netid = wxEmptyString;
2087 for( std::pair<NET_ID, NET_PCB> netPair :
Layout.
Nets )
2091 if( net.
Name == powerPlaneLayerName )
2098 if( netid.IsEmpty() )
2100 wxLogError(
_(
"The CADSTAR layer '%s' is defined as a power plane layer. However no "
2101 "net with such name exists. The layer has been loaded but no copper "
2102 "zone was created." ),
2103 powerPlaneLayerName );
2107 for( std::pair<BOARD_ID, CADSTAR_BOARD> boardPair :
Layout.
Boards )
2112 int defaultLineThicknesss = bds.
GetLineThickness( PCB_LAYER_ID::Edge_Cuts );
2132 for( std::pair<COPPER_ID, COPPER> copPair :
Layout.
Coppers )
2134 COPPER& csCopper = copPair.second;
2157 if( shape->GetShape() == SHAPE_T::ARC )
2161 ERROR_LOC::ERROR_INSIDE );
2167 ERROR_LOC::ERROR_INSIDE );
2202 _(
"The CADSTAR design contains COPPER elements, which have no direct KiCad "
2203 "equivalent. These have been imported as a KiCad Zone if solid or hatch "
2204 "filled, or as a KiCad Track if the shape was an unfilled outline (open or "
2252 zone->
SetFillMode( ZONE_FILL_MODE::HATCH_PATTERN );
2278 for( std::pair<NET_ID, NET_PCB> netPair :
Layout.
Nets )
2281 wxString netnameForErrorReporting = net.
Name;
2283 std::map<NETELEMENT_ID, long> netelementSizes;
2285 if( netnameForErrorReporting.IsEmpty() )
2286 netnameForErrorReporting = wxString::Format( wxT(
"$%ld" ), net.
SignalNum );
2288 for( std::pair<NETELEMENT_ID, NET_PCB::VIA> viaPair : net.
Vias )
2290 NET_PCB::VIA
via = viaPair.second;
2294 netelementSizes.insert( { viaPair.first, viaSize } );
2297 for( std::pair<NETELEMENT_ID, NET_PCB::PIN> pinPair : net.
Pins )
2299 NET_PCB::PIN
pin = pinPair.second;
2302 if( footprint ==
nullptr )
2304 wxLogWarning( wxString::Format(
2305 _(
"The net '%s' references component ID '%s' which does not exist. "
2306 "This has been ignored." ),
2307 netnameForErrorReporting,
pin.ComponentID ) );
2309 else if( (
pin.PadID - (
long) 1 ) > footprint->
Pads().size() )
2311 wxLogWarning( wxString::Format(
_(
"The net '%s' references non-existent pad index"
2312 " '%d' in component '%s'. This has been "
2314 netnameForErrorReporting,
2333 if( assocPads.find(
pin.PadID ) != assocPads.end() )
2335 for(
PAD_ID copperPadID : assocPads.at(
pin.PadID ) )
2344 int padsize = std::min(
pad->GetSizeX(),
pad->GetSizeY() );
2345 netelementSizes.insert( { pinPair.first, padsize } );
2353 auto getJunctionSize =
2354 [&](
NETELEMENT_ID aJptNetElemId,
const NET_PCB::CONNECTION_PCB& aConnectionToIgnore ) ->
int
2356 int jptsize = std::numeric_limits<int>::max();
2358 for( NET_PCB::CONNECTION_PCB connection : net.
Connections )
2360 if( connection.Route.RouteVertices.size() == 0 )
2363 if( connection.StartNode == aConnectionToIgnore.StartNode
2364 && connection.EndNode == aConnectionToIgnore.EndNode )
2369 if( connection.StartNode == aJptNetElemId )
2371 int s =
getKiCadLength( connection.Route.RouteVertices.front().RouteWidth );
2372 jptsize = std::max( jptsize, s );
2374 else if( connection.EndNode == aJptNetElemId )
2376 int s =
getKiCadLength( connection.Route.RouteVertices.back().RouteWidth );
2377 jptsize = std::max( jptsize, s );
2381 if( jptsize == std::numeric_limits<int>::max()
2382 && !aConnectionToIgnore.Route.RouteVertices.empty() )
2386 NET_PCB::ROUTE_VERTEX vertex = aConnectionToIgnore.Route.RouteVertices.front();
2388 if( aConnectionToIgnore.EndNode == aJptNetElemId )
2389 vertex = aConnectionToIgnore.Route.RouteVertices.back();
2397 for( NET_PCB::CONNECTION_PCB connection : net.
Connections )
2399 int startSize = std::numeric_limits<int>::max();
2400 int endSize = std::numeric_limits<int>::max();
2402 if( netelementSizes.find( connection.StartNode ) != netelementSizes.end() )
2403 startSize = netelementSizes.at( connection.StartNode );
2405 startSize = getJunctionSize( connection.StartNode, connection );
2407 if( netelementSizes.find( connection.EndNode ) != netelementSizes.end() )
2408 endSize = netelementSizes.at( connection.EndNode );
2410 endSize = getJunctionSize( connection.EndNode, connection );
2415 if( !connection.Unrouted )
2424 auto findAndReplaceTextField =
2463 wxString varValue = txtvalue.second;
2465 txtVars.insert( { varName, varValue } );
2470 wxString varName = txtvalue.first;
2471 wxString varValue = txtvalue.second;
2473 txtVars.insert( { varName, varValue } );
2478 wxLogError(
_(
"Text Variables could not be set as there is no project loaded." ) );
2486 for( std::pair<ATTRIBUTE_ID, ATTRIBUTE_VALUE> attrPair : aComponent.
AttributeValues )
2497 for( std::pair<ATTRIBUTE_ID, TEXT_LOCATION> textlocPair : aComponent.
TextLocations )
2504 attrval = wxEmptyString;
2508 attrval = wxT(
"${REFERENCE}" );
2523 const NET_PCB::ROUTE& aCadstarRoute,
2524 long aStartWidth,
long aEndWidth )
2526 if( aCadstarRoute.RouteVertices.size() == 0 )
2529 std::vector<PCB_SHAPE*> shapes;
2530 std::vector<NET_PCB::ROUTE_VERTEX> routeVertices = aCadstarRoute.RouteVertices;
2533 if( aStartWidth < routeVertices.front().RouteWidth )
2535 NET_PCB::ROUTE_VERTEX newFrontVertex = aCadstarRoute.RouteVertices.front();
2536 newFrontVertex.RouteWidth = aStartWidth;
2537 newFrontVertex.Vertex.End = aCadstarRoute.StartPoint;
2538 routeVertices.insert( routeVertices.begin(), newFrontVertex );
2542 if( aEndWidth < routeVertices.back().RouteWidth )
2544 NET_PCB::ROUTE_VERTEX newBackVertex = aCadstarRoute.RouteVertices.back();
2545 newBackVertex.RouteWidth = aEndWidth;
2546 routeVertices.push_back( newBackVertex );
2549 POINT prevEnd = aCadstarRoute.StartPoint;
2551 for(
const NET_PCB::ROUTE_VERTEX& v : routeVertices )
2557 shapes.push_back( shape );
2558 prevEnd = v.Vertex.End;
2563 wxLogError(
_(
"The CADSTAR design contains teardrops. This importer does not yet "
2564 "support them, so the teardrops in the design have been ignored." ) );
2580 const NET_ID& aCadstarNetID,
const NET_PCB::VIA& aCadstarVia )
2590 via->SetLocked( aCadstarVia.Fixed );
2594 wxLogError(
_(
"The CADSTAR via code '%s' has different shape from a circle defined. "
2595 "KiCad only supports circular vias so this via type has been changed to "
2596 "be a via with circular shape of %.2f mm diameter." ),
2603 bool start_layer_outside =
2606 bool end_layer_outside =
2610 if( start_layer_outside && end_layer_outside )
2612 via->SetViaType( VIATYPE::THROUGH );
2614 else if( ( !start_layer_outside ) && ( !end_layer_outside ) )
2616 via->SetViaType( VIATYPE::BLIND_BURIED );
2620 via->SetViaType( VIATYPE::MICROVIA );
2628 return via->GetWidth();
2635 const LAYER_ID& aCadstarLayerOverride,
2637 double aRotationAngle,
double aScalingFactor,
2639 bool aMirrorInvert )
2642 aContainer->
Add( txt );
2647 RotatePoint( rotatedTextPos, aTransformCentre, rotationAngle );
2648 rotatedTextPos.
x =
KiROUND( ( rotatedTextPos.
x - aTransformCentre.
x ) * aScalingFactor );
2649 rotatedTextPos.
y =
KiROUND( ( rotatedTextPos.
y - aTransformCentre.
y ) * aScalingFactor );
2650 rotatedTextPos += aTransformCentre;
2709 wxFAIL_MSG( wxT(
"Unknown Alignment - needs review!" ) );
2713 txt->
Flip( aTransformCentre,
true );
2716 if( aScalingFactor != 1.0 )
2722 scaledTextSize.
x =
KiROUND( (
double) unscaledTextSize.
x * aScalingFactor );
2723 scaledTextSize.
y =
KiROUND( (
double) unscaledTextSize.
y * aScalingFactor );
2729 txt->
Move( aMoveVector );
2734 LAYER_ID layersToDrawOn = aCadstarLayerOverride;
2736 if( layersToDrawOn.IsEmpty() )
2737 layersToDrawOn = aCadstarText.
LayerID;
2748 if( !aCadstarGroupID.IsEmpty() )
2759 if( !aCadstarGroupID.IsEmpty() )
2769 const wxString& aShapeName,
2773 double aRotationAngle,
double aScalingFactor,
2775 bool aMirrorInvert )
2777 auto drawAsOutline = [&]()
2780 aContainer, aCadstarGroupID, aMoveVector, aRotationAngle,
2781 aScalingFactor, aTransformCentre, aMirrorInvert );
2783 aCadstarGroupID, aMoveVector, aRotationAngle, aScalingFactor,
2784 aTransformCentre, aMirrorInvert );
2787 switch( aCadstarShape.
Type )
2797 wxLogWarning( wxString::Format(
2798 _(
"The shape for '%s' is Hatch filled in CADSTAR, which has no KiCad equivalent. "
2799 "Using solid fill instead." ),
2805 if( aCadstarShape.
Vertices.size() < 3 )
2816 aMoveVector, aRotationAngle,
2817 aScalingFactor, aTransformCentre,
2825 aContainer->
Add( shape, ADD_MODE::APPEND );
2827 if( !aCadstarGroupID.IsEmpty() )
2841 double aRotationAngle,
2842 double aScalingFactor,
2844 bool aMirrorInvert )
2846 for(
const CUTOUT& cutout : aCutouts )
2849 aCadstarGroupID, aMoveVector, aRotationAngle, aScalingFactor,
2850 aTransformCentre, aMirrorInvert );
2861 double aRotationAngle,
2862 double aScalingFactor,
2864 bool aMirrorInvert )
2867 aCadstarGroupID, aMoveVector,
2868 aRotationAngle, aScalingFactor,
2869 aTransformCentre, aMirrorInvert );
2873 shape->SetStroke(
STROKE_PARAMS( aLineThickness, LINE_STYLE::SOLID ) );
2874 shape->SetLayer( aKiCadLayer );
2875 shape->SetParent( aContainer );
2876 aContainer->
Add( shape, ADD_MODE::APPEND );
2881std::vector<PCB_SHAPE*>
2886 double aRotationAngle,
double aScalingFactor,
2888 bool aMirrorInvert )
2890 std::vector<PCB_SHAPE*> shapes;
2892 if( aCadstarVertices.size() < 2 )
2896 const VERTEX* prev = &aCadstarVertices.at( 0 );
2899 for(
size_t i = 1; i < aCadstarVertices.size(); i++ )
2901 cur = &aCadstarVertices.at( i );
2903 aMoveVector, aRotationAngle, aScalingFactor,
2904 aTransformCentre, aMirrorInvert ) );
2913 const VERTEX& aCadstarVertex,
2917 double aRotationAngle,
2918 double aScalingFactor,
2920 bool aMirrorInvert )
2932 centerPoint = ( startPoint + endPoint ) / 2;
2939 switch( aCadstarVertex.
Type )
2943 shape =
new PCB_SHAPE( aContainer, SHAPE_T::SEGMENT );
2946 shape->
SetEnd( endPoint );
2957 shape =
new PCB_SHAPE( aContainer, SHAPE_T::ARC );
2962 EDA_ANGLE arcStartAngle( startPoint - centerPoint );
2963 EDA_ANGLE arcEndAngle( endPoint - centerPoint );
2964 EDA_ANGLE arcAngle = ( arcEndAngle - arcStartAngle ).Normalize();
2979 shape->
Flip( aTransformCentre,
true );
2981 if( aScalingFactor != 1.0 )
2983 shape->
Move( -1*aTransformCentre );
2984 shape->
Scale( aScalingFactor );
2985 shape->
Move( aTransformCentre );
2988 if( aRotationAngle != 0.0 )
2991 if( aMoveVector !=
VECTOR2I{ 0, 0 } )
2992 shape->
Move( aMoveVector );
2994 if( !aCadstarGroupID.IsEmpty() )
3002 const int& aLineThickness,
3005 ZONE* zone =
new ZONE( aParentContainer );
3009 zone->
SetFillMode( ZONE_FILL_MODE::HATCH_PATTERN );
3010 zone->
SetHatchStyle( ZONE_BORDER_DISPLAY_STYLE::DIAGONAL_FULL );
3021 for(
int i = 0; i < polygon.
HoleCount( 0 ); i++ )
3032 double aRotationAngle,
3033 double aScalingFactor,
3035 bool aMirrorInvert )
3040 aContainer, noGroup, aMoveVector,
3041 aRotationAngle, aScalingFactor,
3042 aTransformCentre, aMirrorInvert );
3053 noGroup, aMoveVector,
3054 aRotationAngle, aScalingFactor,
3055 aTransformCentre, aMirrorInvert );
3066 if( aLineThickness > 0 )
3074 for(
int j = 0; j < polySet.
HoleCount( i ); ++j )
3091 switch( shape->GetShape() )
3095 SHAPE_ARC arc( shape->GetCenter(), shape->GetStart(), shape->GetArcAngle() );
3097 if( shape->EndsSwapped() )
3104 case SHAPE_T::SEGMENT:
3105 lineChain.
Append( shape->GetStartX(), shape->GetStartY() );
3106 lineChain.
Append( shape->GetEndX(), shape->GetEndY() );
3110 wxFAIL_MSG( wxT(
"Drawsegment type is unexpected. Ignored." ) );
3130 const std::vector<PCB_SHAPE*>& aShapes,
3133 int aWidthOverride )
3135 std::vector<PCB_TRACK*> tracks;
3147 if( aTrack->GetLength() != 0 )
3149 tracks.push_back( aTrack );
3150 aParentContainer->
Add( aTrack, ADD_MODE::APPEND );
3160 switch( shape->GetShape() )
3164 SHAPE_ARC arc( shape->GetStart(), shape->GetArcMid(), shape->GetEnd(), 0 );
3166 if( shape->EndsSwapped() )
3169 track =
new PCB_ARC( aParentContainer, &arc );
3173 case SHAPE_T::SEGMENT:
3174 track =
new PCB_TRACK( aParentContainer );
3175 track->
SetStart( shape->GetStart() );
3176 track->
SetEnd( shape->GetEnd() );
3180 wxFAIL_MSG( wxT(
"Drawsegment type is unexpected. Ignored." ) );
3184 if( aWidthOverride == -1 )
3185 track->
SetWidth( shape->GetWidth() );
3189 if( aLayerOverride == PCB_LAYER_ID::UNDEFINED_LAYER )
3190 track->
SetLayer( shape->GetLayer() );
3194 if( aNet !=
nullptr )
3202 if( prevTrack !=
nullptr )
3204 int offsetAmount = ( track->
GetWidth() / 2 ) - ( prevTrack->
GetWidth() / 2 );
3206 if( offsetAmount > 0 )
3213 else if( offsetAmount < 0 )
3218 prevTrack->
SetEnd( newEnd );
3234 addTrack( synthTrack );
3239 addTrack( prevTrack );
3254 const wxString& aAttributeValue )
3267 aFootprint->
SetValue( aAttributeValue );
3268 txt = &aFootprint->
Value();
3273 aFootprint->
Add( txt );
3274 txt->
SetText( aAttributeValue );
3287 aFootprint->
SetValue( aAttributeValue );
3288 txt = &aFootprint->
Value();
3294 aFootprint->
Add( txt );
3295 txt->
SetText( aAttributeValue );
3305 if( aCadstarAttrLoc.
Mirror )
3363 wxFAIL_MSG( wxT(
"Unknown Alignment - needs review!" ) );
3372 const long& aOffsetAmount )
3374 VECTOR2I v( *aPointToOffset - aRefPoint );
3380 aPointToOffset->
x = offsetted.
x;
3381 aPointToOffset->
y = offsetted.
y;
3385 *aPointToOffset = aRefPoint;
3403 if( textSize.
x == 0 )
3408 if( textSize.
x == 0 || textSize.
y == 0 )
3501 const std::map<ATTRIBUTE_ID, ATTRIBUTE_VALUE>& aCadstarAttributeMap )
3503 wxCHECK( aCadstarAttributeMap.find( aCadstarAttributeID ) != aCadstarAttributeMap.end(),
3506 return aCadstarAttributeMap.at( aCadstarAttributeID ).Value;
3523 const PART_ID& aCadstarPartID )
3558 if( hcode.
Hatches.size() < 1 )
3571 if( hcode.
Hatches.size() < 1 )
3583 if( hcode.
Hatches.size() < 1 )
3608 if( hcode.
Hatches.size() != 2 )
3610 wxLogWarning( wxString::Format(
3611 _(
"The CADSTAR Hatching code '%s' has %d hatches defined. "
3612 "KiCad only supports 2 hatches (crosshatching) 90 degrees apart. "
3613 "The imported hatching is crosshatched." ),
3618 if( hcode.
Hatches.at( 0 ).LineWidth != hcode.
Hatches.at( 1 ).LineWidth )
3620 wxLogWarning( wxString::Format(
3621 _(
"The CADSTAR Hatching code '%s' has different line widths for each "
3622 "hatch. KiCad only supports one width for the hatching. The imported "
3623 "hatching uses the width defined in the first hatch definition, i.e. "
3632 wxLogWarning( wxString::Format(
3633 _(
"The CADSTAR Hatching code '%s' has different step sizes for each "
3634 "hatch. KiCad only supports one step size for the hatching. The imported "
3635 "hatching uses the step size defined in the first hatching definition, "
3642 if( abs( hcode.
Hatches.at( 0 ).OrientAngle - hcode.
Hatches.at( 1 ).OrientAngle )
3645 wxLogWarning( wxString::Format(
3646 _(
"The hatches in CADSTAR Hatching code '%s' have an angle "
3647 "difference of %.1f degrees. KiCad only supports hatching 90 "
3648 "degrees apart. The imported hatching has two hatches 90 "
3649 "degrees apart, oriented %.1f degrees from horizontal." ),
3678 wxString prefix = wxEmptyString;
3679 wxString suffix = wxEmptyString;
3680 size_t startpos = aCadstarDim.
Text.
Text.Find( wxT(
"<@DISTANCE" ) );
3682 if( startpos != wxNOT_FOUND )
3685 wxString remainingStr = aCadstarDim.
Text.
Text.Mid( startpos );
3686 size_t endpos = remainingStr.Find(
"@>" );
3690 if( suffix.StartsWith( wxT(
"mm" ) ) )
3693 suffix = suffix.Mid( 2 );
3711 switch( dimensionUnits )
3716 wxLogWarning( wxString::Format(
_(
"Dimension ID %s uses a type of unit that "
3717 "is not supported in KiCad. Millimeters were "
3718 "applied instead." ),
3722 aKiCadDim->
SetUnitsMode( DIM_UNITS_MODE::MILLIMETRES );
3734 wxFAIL_MSG( wxT(
"We should have handled design units before coming here!" ) );
3741 std::map<TEMPLATE_ID, std::set<TEMPLATE_ID>> winningOverlaps;
3750 aZoneB->GetLocalClearance().value() );
3759 [&](
ZONE* aLowerZone,
ZONE* aHigherZone ) ->
double
3762 intersectShape.
Inflate( inflateValue( aLowerZone, aHigherZone ),
3772 double leftOverArea = lowerZoneFill.
Area();
3774 return leftOverArea;
3777 auto intersectionAreaOfZoneOutlines =
3778 [&](
ZONE* aZoneA,
ZONE* aZoneB ) ->
double
3781 outLineA.
Inflate( inflateValue( aZoneA, aZoneB ), CORNER_STRATEGY::ROUND_ALL_CORNERS,
3785 outLineB.
Inflate( inflateValue( aZoneA, aZoneB ), CORNER_STRATEGY::ROUND_ALL_CORNERS,
3790 return outLineA.
Area();
3794 auto isLowerPriority =
3797 return winningOverlaps[b].count( a ) > 0;
3800 for( std::map<TEMPLATE_ID, ZONE*>::iterator it1 =
m_zonesMap.begin();
3804 ZONE* thisZone = it1->second;
3809 for( std::map<TEMPLATE_ID, ZONE*>::iterator it2 = it1;
3813 ZONE* otherZone = it2->second;
3815 if( thisTemplate.
ID == otherTemplate.
ID )
3824 if( intersectionAreaOfZoneOutlines( thisZone, otherZone ) == 0 )
3833 if( thisZonePolyFill.
Area() > 0.0 && otherZonePolyFill.
Area() > 0.0 )
3836 double areaThis = errorArea( thisZone, otherZone );
3838 double areaOther = errorArea( otherZone, thisZone );
3840 if( areaThis > areaOther )
3843 winningOverlaps[thisTemplate.
ID].insert( otherTemplate.
ID );
3848 winningOverlaps[otherTemplate.
ID].insert( thisTemplate.
ID );
3851 else if( thisZonePolyFill.
Area() > 0.0 )
3854 winningOverlaps[thisTemplate.
ID].insert( otherTemplate.
ID );
3856 else if( otherZonePolyFill.
Area() > 0.0 )
3859 winningOverlaps[otherTemplate.
ID].insert( thisTemplate.
ID );
3865 if( intersectionAreaOfZoneOutlines( thisZone, otherZone ) != 0 )
3868 winningOverlaps[otherTemplate.
ID].insert( thisTemplate.
ID );
3870 winningOverlaps[thisTemplate.
ID].insert( otherTemplate.
ID );
3879 std::set<TEMPLATE_ID> intersectingIDs;
3881 for(
const std::pair<
TEMPLATE_ID, std::set<TEMPLATE_ID>>& idPair : winningOverlaps )
3883 intersectingIDs.insert( idPair.first );
3884 intersectingIDs.insert( idPair.second.begin(), idPair.second.end() );
3888 std::vector<TEMPLATE_ID> sortedIDs;
3892 sortedIDs.push_back(
id );
3896 std::sort( sortedIDs.begin(), sortedIDs.end(), isLowerPriority );
3902 if( prevID.IsEmpty() )
3908 wxASSERT( !isLowerPriority(
id, prevID ) );
3910 int newPriority =
m_zonesMap.at( prevID )->GetAssignedPriority();
3913 if( isLowerPriority( prevID,
id ) )
3916 m_zonesMap.at(
id )->SetAssignedPriority( newPriority );
3921 for(
const std::pair<
TEMPLATE_ID, std::set<TEMPLATE_ID>>& idPair : winningOverlaps )
3925 for(
const TEMPLATE_ID& losingID : idPair.second )
3927 if(
m_zonesMap.at( losingID )->GetAssignedPriority()
3928 >
m_zonesMap.at( winningID )->GetAssignedPriority() )
3962 if( aCadstarNetID.IsEmpty() )
3968 return m_netMap.at( aCadstarNetID );
3975 wxString newName = csNet.
Name;
3977 if( csNet.
Name.IsEmpty() )
3979 if( csNet.
Pins.size() > 0 )
3983 NET_PCB::PIN firstPin = ( *csNet.
Pins.begin() ).second;
3986 newName = wxT(
"Net-(" );
3988 newName << wxT(
"-Pad" ) << wxString::Format( wxT(
"%ld" ), firstPin.PadID );
3989 newName << wxT(
")" );
3993 wxFAIL_MSG( wxT(
"A net with no pins associated?" ) );
3994 newName = wxT(
"csNet-" );
3995 newName << wxString::Format( wxT(
"%i" ), csNet.
SignalNum );
4002 wxLogMessage(
_(
"The CADSTAR design contains nets with a 'Net Class' assigned. KiCad "
4003 "does not have an equivalent to CADSTAR's Net Class so these elements "
4004 "were not imported. Note: KiCad's version of 'Net Class' is closer to "
4005 "CADSTAR's 'Net Route Code' (which has been imported for all nets)." ) );
4012 wxLogWarning(
_(
"The CADSTAR design contains nets with a 'Spacing Class' assigned. "
4013 "KiCad does not have an equivalent to CADSTAR's Spacing Class so "
4014 "these elements were not imported. Please review the design rules as "
4015 "copper pours will affected by this." ) );
4021 std::shared_ptr<NETCLASS> netclass;
4023 std::tuple<ROUTECODE_ID, NETCLASS_ID, SPACING_CLASS_ID> key = { csNet.
RouteCodeID,
4033 wxString netClassName;
4036 netClassName += wxT(
"Route code: " ) + rc.
Name;
4041 netClassName += wxT(
" | Net class: " ) + nc.
Name;
4047 netClassName += wxT(
" | Spacing class: " ) + sp.
Name;
4050 netclass.reset(
new NETCLASS( *netSettings->m_DefaultNetClass ) );
4051 netclass->SetName( netClassName );
4052 netSettings->m_NetClasses[ netClassName ] = netclass;
4059 std::make_unique<EDA_COMBINED_MATCHER>( newName,
CTX_NETCLASS ),
4065 m_netMap.insert( { aCadstarNetID, netInfo } );
4074 bool aDetectMaxLayer )
4077 return PCB_LAYER_ID::B_Cu;
4081 case 1:
return PCB_LAYER_ID::F_Cu;
4082 case 2:
return PCB_LAYER_ID::In1_Cu;
4083 case 3:
return PCB_LAYER_ID::In2_Cu;
4084 case 4:
return PCB_LAYER_ID::In3_Cu;
4085 case 5:
return PCB_LAYER_ID::In4_Cu;
4086 case 6:
return PCB_LAYER_ID::In5_Cu;
4087 case 7:
return PCB_LAYER_ID::In6_Cu;
4088 case 8:
return PCB_LAYER_ID::In7_Cu;
4089 case 9:
return PCB_LAYER_ID::In8_Cu;
4090 case 10:
return PCB_LAYER_ID::In9_Cu;
4091 case 11:
return PCB_LAYER_ID::In10_Cu;
4092 case 12:
return PCB_LAYER_ID::In11_Cu;
4093 case 13:
return PCB_LAYER_ID::In12_Cu;
4094 case 14:
return PCB_LAYER_ID::In13_Cu;
4095 case 15:
return PCB_LAYER_ID::In14_Cu;
4096 case 16:
return PCB_LAYER_ID::In15_Cu;
4097 case 17:
return PCB_LAYER_ID::In16_Cu;
4098 case 18:
return PCB_LAYER_ID::In17_Cu;
4099 case 19:
return PCB_LAYER_ID::In18_Cu;
4100 case 20:
return PCB_LAYER_ID::In19_Cu;
4101 case 21:
return PCB_LAYER_ID::In20_Cu;
4102 case 22:
return PCB_LAYER_ID::In21_Cu;
4103 case 23:
return PCB_LAYER_ID::In22_Cu;
4104 case 24:
return PCB_LAYER_ID::In23_Cu;
4105 case 25:
return PCB_LAYER_ID::In24_Cu;
4106 case 26:
return PCB_LAYER_ID::In25_Cu;
4107 case 27:
return PCB_LAYER_ID::In26_Cu;
4108 case 28:
return PCB_LAYER_ID::In27_Cu;
4109 case 29:
return PCB_LAYER_ID::In28_Cu;
4110 case 30:
return PCB_LAYER_ID::In29_Cu;
4111 case 31:
return PCB_LAYER_ID::In30_Cu;
4112 case 32:
return PCB_LAYER_ID::B_Cu;
4115 return PCB_LAYER_ID::UNDEFINED_LAYER;
4127 switch( layer.
Type )
4148 return PCB_LAYER_ID::UNDEFINED_LAYER;
4152 PCB_LAYER_ID::UNDEFINED_LAYER );
4165 return LSET( 4, PCB_LAYER_ID::Dwgs_User,
4166 PCB_LAYER_ID::Cmts_User,
4167 PCB_LAYER_ID::Eco1_User,
4168 PCB_LAYER_ID::Eco2_User )
4176 |
LSET( 4, PCB_LAYER_ID::Dwgs_User,
4177 PCB_LAYER_ID::Cmts_User,
4178 PCB_LAYER_ID::Eco1_User,
4179 PCB_LAYER_ID::Eco2_User )
4195 parentGroup->
AddItem( aKiCadItem );
4200 const wxString& aName )
4202 wxString groupName = aName;
4207 groupName = aName + wxT(
"_" ) + wxString::Format( wxT(
"%i" ), ++num );
4212 docSymGroup->
SetName( groupName );
4214 m_groupMap.insert( { groupID, docSymGroup } );
constexpr int ARC_HIGH_DEF
constexpr double PCB_IU_PER_MM
constexpr EDA_IU_SCALE pcbIUScale
LAYER_T
The allowed types of layers, same as Specctra DSN spec.
#define COMPONENT_NAME_2_ATTRID
Component Name 2 Attribute ID - typically used for indicating the placement of designators in placeme...
#define COMPONENT_NAME_ATTRID
Component Name Attribute ID - typically used for placement of designators on silk screen.
Loads a cpa file into a KiCad BOARD object.
bool SetNetCode(int aNetCode, bool aNoAssert)
Set net using a net code.
NETINFO_ITEM * GetNet() const
Return #NET_INFO object for a given item.
void SetNet(NETINFO_ITEM *aNetInfo)
Set a NET_INFO object for the item.
Container for design settings for a BOARD object.
std::shared_ptr< NET_SETTINGS > m_NetSettings
int m_CopperEdgeClearance
BOARD_STACKUP & GetStackupDescriptor()
void SetBoardThickness(int aThickness)
int GetLineThickness(PCB_LAYER_ID aLayer) const
Return the default graphic segment thickness from the layer class for the given layer.
ZONE_SETTINGS & GetDefaultZoneSettings()
int m_ViasMinAnnularWidth
Abstract interface for BOARD_ITEMs capable of storing other items inside.
virtual void Add(BOARD_ITEM *aItem, ADD_MODE aMode=ADD_MODE::INSERT, bool aSkipConnectivity=false)=0
Adds an item to the container.
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
virtual PCB_LAYER_ID GetLayer() const
Return the primary layer this item is on.
virtual void SetLocked(bool aLocked)
virtual BOARD_ITEM * Duplicate() const
Create a copy of this BOARD_ITEM.
virtual void SetLayer(PCB_LAYER_ID aLayer)
Set the layer this item is on.
virtual bool IsLocked() const
Manage one layer needed to make a physical board.
void SetThickness(int aThickness, int aDielectricSubLayer=0)
void SetMaterial(const wxString &aName, int aDielectricSubLayer=0)
void SetLossTangent(double aTg, int aDielectricSubLayer=0)
void SetEpsilonR(double aEpsilon, int aDielectricSubLayer=0)
void SetLayerName(const wxString &aName)
Manage layers needed to make a physical board.
void RemoveAll()
Delete all items in list and clear the list.
const std::vector< BOARD_STACKUP_ITEM * > & GetList() const
int BuildBoardThicknessFromStackup() const
void BuildDefaultStackupList(const BOARD_DESIGN_SETTINGS *aSettings, int aActiveCopperLayersCount=0)
Create a default stackup, according to the current BOARD_DESIGN_SETTINGS settings.
Information pertinent to a Pcbnew printed circuit board.
LSET GetEnabledLayers() const
A proxy function that calls the corresponding function in m_BoardSettings.
void Add(BOARD_ITEM *aItem, ADD_MODE aMode=ADD_MODE::INSERT, bool aSkipConnectivity=false) override
Removes an item from the container.
void SetEnabledLayers(LSET aLayerMask)
A proxy function that calls the correspondent function in m_BoardSettings.
bool SetLayerName(PCB_LAYER_ID aLayer, const wxString &aLayerName)
Changes the name of the layer given by aLayer.
void SetVisibleLayers(LSET aLayerMask)
A proxy function that calls the correspondent function in m_BoardSettings changes the bit-mask of vis...
void SetCopperLayerCount(int aCount)
bool SetLayerType(PCB_LAYER_ID aLayer, LAYER_T aLayerType)
Change the type of the layer given by aLayer.
const wxString GetLayerName(PCB_LAYER_ID aLayer) const
Return the name of a aLayer.
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
void Remove(BOARD_ITEM *aBoardItem, REMOVE_MODE aMode=REMOVE_MODE::NORMAL) override
Removes an item from the container.
@ ANTICLOCKWISE_SEMICIRCLE
static const std::map< TEXT_FIELD_NAME, wxString > CADSTAR_TO_KICAD_FIELDS
Map between CADSTAR fields and KiCad text variables.
TEXT_FIELD_NAME
These are special fields in text objects enclosed between the tokens '<@' and '>' such as <@[FIELD_NA...
@ NO_ALIGNMENT
NO_ALIGNMENT has different meaning depending on the object type.
static const long UNDEFINED_VALUE
static wxString ParseTextFields(const wxString &aTextString, PARSER_CONTEXT *aParserContext)
Replaces CADSTAR fields for the equivalent in KiCad and stores the field values in aParserContext.
wxString LAYER_ID
ID of a Sheet (if schematic) or board Layer (if PCB)
static void FixTextPositionNoAlignment(EDA_TEXT *aKiCadTextItem)
Corrects the position of a text element that had NO_ALIGNMENT in CADSTAR.
@ OUTLINE
Unfilled closed shape.
@ OPENSHAPE
Unfilled open shape. Cannot have cutouts.
@ SOLID
Filled closed shape (solid fill).
@ HATCHED
Filled closed shape (hatch fill).
static const double TXT_HEIGHT_RATIO
CADSTAR fonts are drawn on a 24x24 integer matrix, where the each axis goes from 0 to 24.
void checkPoint()
Updates m_progressReporter or throws if user cancelled.
@ DESIGN
Inherits from design units (assumed Assignments->Technology->Units)
PROGRESS_REPORTER * m_progressReporter
std::map< TEMPLATE_ID, ZONE * > m_zonesMap
Map between Cadstar and KiCad zones.
std::map< std::tuple< ROUTECODE_ID, NETCLASS_ID, SPACING_CLASS_ID >, std::shared_ptr< NETCLASS > > m_netClassMap
Map between Cadstar and KiCad classes.
bool m_doneCopperWarning
Used by loadCoppers() to avoid multiple duplicate warnings.
std::set< PADCODE_ID > m_padcodesTested
Used by getKiCadPad() to avoid multiple duplicate warnings.
int getKiCadLength(long long aCadstarLength)
void initStackupItem(const LAYER &aCadstarLayer, BOARD_STACKUP_ITEM *aKiCadItem, int aDielectricSublayer)
int m_numCopperLayers
Number of layers in the design.
std::vector< LAYER_ID > m_powerPlaneLayers
List of layers that are marked as power plane in CADSTAR.
void drawCadstarText(const TEXT &aCadstarText, BOARD_ITEM_CONTAINER *aContainer, const GROUP_ID &aCadstarGroupID=wxEmptyString, const LAYER_ID &aCadstarLayerOverride=wxEmptyString, const VECTOR2I &aMoveVector={ 0, 0 }, double aRotationAngle=0.0, double aScalingFactor=1.0, const VECTOR2I &aTransformCentre={ 0, 0 }, bool aMirrorInvert=false)
bool isLayerSet(const LAYER_ID &aCadstarLayerID)
LAYERPAIR getLayerPair(const LAYERPAIR_ID &aCadstarLayerPairID)
FOOTPRINT * getFootprintFromCadstarID(const COMPONENT_ID &aCadstarComponentID)
PADCODE getPadCode(const PADCODE_ID &aCadstarPadCodeID)
int loadNetVia(const NET_ID &aCadstarNetID, const NET_PCB::VIA &aCadstarVia)
Load via and return via size.
EDA_ANGLE getAngle(const long long &aCadstarAngle)
std::vector< PCB_SHAPE * > getShapesFromVertices(const std::vector< VERTEX > &aCadstarVertices, BOARD_ITEM_CONTAINER *aContainer=nullptr, const GROUP_ID &aCadstarGroupID=wxEmptyString, const VECTOR2I &aMoveVector={ 0, 0 }, double aRotationAngle=0.0, double aScalingFactor=1.0, const VECTOR2I &aTransformCentre={ 0, 0 }, bool aMirrorInvert=false)
Returns a vector of pointers to PCB_SHAPE objects.
void applyTextCode(EDA_TEXT *aKiCadText, const TEXTCODE_ID &aCadstarTextCodeID)
Apply cadstar textcode parameters to a KiCad text object.
std::map< COMPONENT_ID, FOOTPRINT * > m_componentMap
Map between Cadstar and KiCad components on the board.
SHAPE_LINE_CHAIN getLineChainFromShapes(const std::vector< PCB_SHAPE * > &aShapes)
Returns a SHAPE_LINE_CHAIN object from a series of PCB_SHAPE objects.
void applyDimensionSettings(const DIMENSION &aCadstarDim, PCB_DIMENSION_BASE *aKiCadDim)
void loadNetTracks(const NET_ID &aCadstarNetID, const NET_PCB::ROUTE &aCadstarRoute, long aStartWidth=std::numeric_limits< long >::max(), long aEndWidth=std::numeric_limits< long >::max())
ZONE * getZoneFromCadstarShape(const SHAPE &aCadstarShape, const int &aLineThickness, BOARD_ITEM_CONTAINER *aParentContainer)
PCB_LAYER_ID getKiCadCopperLayerID(unsigned int aLayerNum, bool aDetectMaxLayer=true)
std::vector< PCB_TRACK * > makeTracksFromShapes(const std::vector< PCB_SHAPE * > &aShapes, BOARD_ITEM_CONTAINER *aParentContainer, NETINFO_ITEM *aNet=nullptr, PCB_LAYER_ID aLayerOverride=UNDEFINED_LAYER, int aWidthOverride=-1)
Returns a vector of pointers to TRACK/ARC objects.
VIACODE getViaCode(const VIACODE_ID &aCadstarViaCodeID)
VECTOR2I m_designCenter
Used for calculating the required offset to apply to the Cadstar design so that it fits in KiCad canv...
void Load(BOARD *aBoard, PROJECT *aProject)
Loads a CADSTAR PCB Archive file into the KiCad BOARD object given.
void drawCadstarCutoutsAsShapes(const std::vector< CUTOUT > &aCutouts, const PCB_LAYER_ID &aKiCadLayer, int aLineThickness, BOARD_ITEM_CONTAINER *aContainer, const GROUP_ID &aCadstarGroupID=wxEmptyString, const VECTOR2I &aMoveVector={ 0, 0 }, double aRotationAngle=0.0, double aScalingFactor=1.0, const VECTOR2I &aTransformCentre={ 0, 0 }, bool aMirrorInvert=false)
Uses PCB_SHAPEs to draw the cutouts on m_board object.
void logBoardStackupWarning(const wxString &aCadstarLayerName, const PCB_LAYER_ID &aKiCadLayer)
std::vector< FOOTPRINT * > GetLoadedLibraryFootpints() const
Return a copy of the loaded library footprints (caller owns the objects)
PCB_SHAPE * getShapeFromVertex(const POINT &aCadstarStartPoint, const VERTEX &aCadstarVertex, BOARD_ITEM_CONTAINER *aContainer=nullptr, const GROUP_ID &aCadstarGroupID=wxEmptyString, const VECTOR2I &aMoveVector={ 0, 0 }, double aRotationAngle=0.0, double aScalingFactor=1.0, const VECTOR2I &aTransformCentre={ 0, 0 }, bool aMirrorInvert=false)
Returns a pointer to a PCB_SHAPE object.
void checkAndLogHatchCode(const HATCHCODE_ID &aCadstarHatchcodeID)
bool m_doneSpacingClassWarning
Used by getKiCadNet() to avoid multiple duplicate warnings.
int m_numNets
Number of nets loaded so far.
void loadDocumentationSymbols()
void loadLibraryPads(const SYMDEF_PCB &aComponent, FOOTPRINT *aFootprint)
void loadComponentLibrary()
PAD * getKiCadPad(const COMPONENT_PAD &aCadstarPad, FOOTPRINT *aParent)
void drawCadstarShape(const SHAPE &aCadstarShape, const PCB_LAYER_ID &aKiCadLayer, int aLineThickness, const wxString &aShapeName, BOARD_ITEM_CONTAINER *aContainer, const GROUP_ID &aCadstarGroupID=wxEmptyString, const VECTOR2I &aMoveVector={ 0, 0 }, double aRotationAngle=0.0, double aScalingFactor=1.0, const VECTOR2I &aTransformCentre={ 0, 0 }, bool aMirrorInvert=false)
NETINFO_ITEM * getKiCadNet(const NET_ID &aCadstarNetID)
Searches m_netMap and returns the NETINFO_ITEM pointer if exists.
void logBoardStackupMessage(const wxString &aCadstarLayerName, const PCB_LAYER_ID &aKiCadLayer)
int getLineThickness(const LINECODE_ID &aCadstarLineCodeID)
bool m_doneTearDropWarning
std::map< NET_ID, NETINFO_ITEM * > m_netMap
Map between Cadstar and KiCad Nets.
void loadComponentAttributes(const COMPONENT &aComponent, FOOTPRINT *aFootprint)
PCB_GROUP * getKiCadGroup(const GROUP_ID &aCadstarGroupID)
bool m_logLayerWarnings
Used in loadBoardStackup()
HATCHCODE getHatchCode(const HATCHCODE_ID &aCadstarHatchcodeID)
void loadLibraryCoppers(const SYMDEF_PCB &aComponent, FOOTPRINT *aFootprint)
LAYER_TYPE getLayerType(const LAYER_ID aCadstarLayerID)
void loadLibraryFigures(const SYMDEF_PCB &aComponent, FOOTPRINT *aFootprint)
TEXTCODE getTextCode(const TEXTCODE_ID &aCadstarTextCodeID)
wxString getAttributeName(const ATTRIBUTE_ID &aCadstarAttributeID)
wxString getAttributeValue(const ATTRIBUTE_ID &aCadstarAttributeID, const std::map< ATTRIBUTE_ID, ATTRIBUTE_VALUE > &aCadstarAttributeMap)
void applyRouteOffset(VECTOR2I *aPointToOffset, const VECTOR2I &aRefPoint, const long &aOffsetAmount)
CADSTAR's Post Processor does an action called "Route Offset" which is applied when a route is wider ...
VECTOR2I getKiCadPoint(const VECTOR2I &aCadstarPoint)
Scales, offsets and inverts y axis to make the point usable directly in KiCad.
void remapUnsureLayers()
Callback m_layerMappingHandler for layers we aren't sure of.
double getAngleTenthDegree(const long long &aCadstarAngle)
LSET getKiCadLayerSet(const LAYER_ID &aCadstarLayerID)
void addToGroup(const GROUP_ID &aCadstarGroupID, BOARD_ITEM *aKiCadItem)
std::map< SYMDEF_ID, FOOTPRINT * > m_libraryMap
Map between Cadstar and KiCad components in the library.
COPPERCODE getCopperCode(const COPPERCODE_ID &aCadstaCopperCodeID)
SHAPE_POLY_SET getPolySetFromCadstarShape(const SHAPE &aCadstarShape, int aLineThickness=-1, BOARD_ITEM_CONTAINER *aContainer=nullptr, const VECTOR2I &aMoveVector={ 0, 0 }, double aRotationAngle=0.0, double aScalingFactor=1.0, const VECTOR2I &aTransformCentre={ 0, 0 }, bool aMirrorInvert=false)
Returns a SHAPE_POLY_SET object from a Cadstar SHAPE.
std::map< PAD_ID, std::vector< PAD_ID > > ASSOCIATED_COPPER_PADS
Map of pad anchor points (first) to copper pads (second).
EDA_ANGLE getHatchCodeAngle(const HATCHCODE_ID &aCadstarHatchcodeID)
int getKiCadHatchCodeThickness(const HATCHCODE_ID &aCadstarHatchcodeID)
PCB_LAYER_ID getKiCadLayer(const LAYER_ID &aCadstarLayerID)
std::set< HATCHCODE_ID > m_hatchcodesTested
Used by checkAndLogHatchCode() to avoid multiple duplicate warnings.
void loadLibraryAreas(const SYMDEF_PCB &aComponent, FOOTPRINT *aFootprint)
GROUP_ID createUniqueGroupID(const wxString &aName)
Adds a new PCB_GROUP* to m_groupMap.
int getKiCadHatchCodeGap(const HATCHCODE_ID &aCadstarHatchcodeID)
std::vector< std::unique_ptr< FOOTPRINT > > LoadLibrary()
Parse a CADSTAR PCB Archive and load the footprints contained within.
ROUTECODE getRouteCode(const ROUTECODE_ID &aCadstarRouteCodeID)
void drawCadstarVerticesAsShapes(const std::vector< VERTEX > &aCadstarVertices, const PCB_LAYER_ID &aKiCadLayer, int aLineThickness, BOARD_ITEM_CONTAINER *aContainer, const GROUP_ID &aCadstarGroupID=wxEmptyString, const VECTOR2I &aMoveVector={ 0, 0 }, double aRotationAngle=0.0, double aScalingFactor=1.0, const VECTOR2I &aTransformCentre={ 0, 0 }, bool aMirrorInvert=false)
Uses PCB_SHAPE to draw the vertices on m_board object.
void addAttribute(const ATTRIBUTE_LOCATION &aCadstarAttrLoc, const ATTRIBUTE_ID &aCadstarAttributeID, FOOTPRINT *aFootprint, const wxString &aAttributeValue)
Adds a CADSTAR Attribute to a KiCad footprint.
std::map< GROUP_ID, PCB_GROUP * > m_groupMap
Map between Cadstar and KiCad groups.
bool calculateZonePriorities(PCB_LAYER_ID &aLayer)
Tries to make a best guess as to the zone priorities based on the pour status.
std::map< LAYER_ID, PCB_LAYER_ID > m_layermap
Map between Cadstar and KiCad Layers.
PAD *& getPadReference(FOOTPRINT *aFootprint, const PAD_ID aCadstarPadID)
bool m_doneNetClassWarning
Used by getKiCadNet() to avoid multiple duplicate warnings.
double getAngleDegrees(const long long &aCadstarAngle)
PART getPart(const PART_ID &aCadstarPartID)
LAYER_MAPPING_HANDLER m_layerMappingHandler
Callback to get layer mapping.
std::map< SYMDEF_ID, ASSOCIATED_COPPER_PADS > m_librarycopperpads
Associated copper pads (if any) for each component library definition.
long PAD_ID
Pad identifier (pin) in the PCB.
@ LAYERSUBTYPE_SOLDERRESIST
@ LAYERSUBTYPE_SILKSCREEN
void Parse(bool aLibrary=false)
Parses the file.
int KiCadUnitMultiplier
Use this value to convert units in this CPA file to KiCad units.
@ UNDEFINED
Only used for error detection.
@ ALLELEC
Inbuilt layer type (cannot be assigned to user layers)
@ ALLDOC
Inbuilt layer type (cannot be assigned to user layers)
@ NONELEC
This type has subtypes.
@ NOLAYER
Inbuilt layer type (cannot be assigned to user layers)
@ JUMPERLAYER
Inbuilt layer type (cannot be assigned to user layers)
@ ALLLAYER
Inbuilt layer type (cannot be assigned to user layers)
@ ASSCOMPCOPP
Inbuilt layer type (cannot be assigned to user layers)
@ ROUNDED_RECT
Keyword "ROUNDED".
@ MAXIMUM
The highest PHYSICAL_LAYER_ID currently defined (i.e.
@ MINIMUM
PHYSICAL_LAYER_ID 1 (i.e.
@ THROUGH_HOLE
All physical layers currently defined.
EDA_ANGLE NormalizeNegative()
void SetCenter(const VECTOR2I &aCenter)
SHAPE_POLY_SET & GetPolyShape()
void SetFilled(bool aFlag)
void SetPolyShape(const SHAPE_POLY_SET &aShape)
void SetStart(const VECTOR2I &aStart)
void SetShape(SHAPE_T aShape)
void SetEnd(const VECTOR2I &aEnd)
void SetArcAngleAndEnd(const EDA_ANGLE &aAngle, bool aCheckNegativeAngle=false)
Set the end point from the angle center and start.
A mix-in class (via multiple inheritance) that handles texts such as labels, parts,...
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 SetMirrored(bool isMirrored)
void SetVertJustify(GR_TEXT_V_ALIGN_T aType)
virtual void SetVisible(bool aVisible)
void SetTextThickness(int aWidth)
The TextThickness is that set by the user.
void SetKeepUpright(bool aKeepUpright)
virtual void SetText(const wxString &aText)
virtual void SetTextAngle(const EDA_ANGLE &aAngle)
int GetTextThickness() const
VECTOR2I GetTextSize() const
void SetHorizJustify(GR_TEXT_H_ALIGN_T aType)
A logical library item identifier and consists of various portions much like a URI.
int Parse(const UTF8 &aId, bool aFix=false)
Parse LIB_ID with the information from aId.
const UTF8 & GetLibItemName() const
LSEQ is a sequence (and therefore also a set) of PCB_LAYER_IDs.
LSET is a set of PCB_LAYER_IDs.
static LSET AllBoardTechMask()
Return a mask holding board technical layers (no CU layer) on both side.
static LSET AllLayersMask()
static LSET UserDefinedLayers()
Return a mask with all of the allowable user defined layers.
LSEQ Seq(const PCB_LAYER_ID *aWishListSequence, unsigned aCount) const
Return an LSEQ from the union of this LSET and a desired sequence.
bool Contains(PCB_LAYER_ID aLayer)
See if the layer set contains a PCB layer.
static LSET AllCuMask(int aCuLayerCount=MAX_CU_LAYERS)
Return a mask holding the requested number of Cu PCB_LAYER_IDs.
static const wxChar * Name(PCB_LAYER_ID aLayerId)
Return the fixed name association with aLayerId.
Handle the data for a net.
void SetNetClass(const std::shared_ptr< NETCLASS > &aNetClass)
const wxString & GetNumber() const
void SetNumber(const wxString &aNumber)
Set the pad number (note that it can be alphanumeric, such as the array reference "AA12").
void SetUnitsFormat(const DIM_UNITS_FORMAT aFormat)
void SetPrefix(const wxString &aPrefix)
void SetExtensionOffset(int aOffset)
void SetSuffix(const wxString &aSuffix)
void SetLineThickness(int aWidth)
virtual const VECTOR2I & GetStart() const
The dimension's origin is the first feature point for the dimension.
virtual void SetEnd(const VECTOR2I &aPoint)
void SetPrecision(DIM_PRECISION aPrecision)
virtual void SetStart(const VECTOR2I &aPoint)
void SetOverrideText(const wxString &aValue)
void SetUnitsMode(DIM_UNITS_MODE aMode)
For better understanding of the points that make a dimension:
void SetExtensionHeight(int aHeight)
void SetHeight(int aHeight)
Set the distance from the feature points to the crossbar line.
A leader is a dimension-like object pointing to a specific point.
An orthogonal dimension is like an aligned dimension, but the extension lines are locked to the X or ...
void SetOrientation(DIR aOrientation)
Set the orientation of the dimension line (so, perpendicular to the feature lines).
A set of BOARD_ITEMs (i.e., without duplicates).
void SetName(const wxString &aName)
virtual bool AddItem(BOARD_ITEM *aItem)
Add item to group.
void SetLocked(bool aLocked) override
void Flip(const VECTOR2I &aCentre, bool aFlipLeftRight) override
Flip this object, i.e.
void Rotate(const VECTOR2I &aRotCentre, const EDA_ANGLE &aAngle) override
Rotate this object.
void SetLayer(PCB_LAYER_ID aLayer) override
Set the layer this item is on.
void Move(const VECTOR2I &aMoveVector) override
Move this object.
void Scale(double aScale)
void SetStroke(const STROKE_PARAMS &aStroke) override
void Flip(const VECTOR2I &aCentre, bool aFlipLeftRight) override
Flip this object, i.e.
virtual void SetPosition(const VECTOR2I &aPos) override
void Move(const VECTOR2I &aMoveVector) override
Move this object.
void SetWidth(int aWidth)
void SetEnd(const VECTOR2I &aEnd)
void SetStart(const VECTOR2I &aStart)
const VECTOR2I & GetStart() const
const VECTOR2I & GetEnd() const
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 std::map< wxString, wxString > & GetTextVars() const
Represent a polyline containing arcs as well as line segments: A chain of connected line and/or arc s...
virtual const VECTOR2I GetPoint(int aIndex) const override
void SetClosed(bool aClosed)
Mark the line chain as closed (i.e.
int PointCount() const
Return the number of points (vertices) in this line chain.
void Append(int aX, int aY, bool aAllowDuplication=false)
Append a new point at the end of the line chain.
Represent a set of closed polygons.
void BooleanSubtract(const SHAPE_POLY_SET &b, POLYGON_MODE aFastMode)
Perform boolean polyset difference For aFastMode meaning, see function booleanOp.
void Fracture(POLYGON_MODE aFastMode)
Convert a set of polygons with holes to a single outline with "slits"/"fractures" connecting the oute...
void ClearArcs()
Removes all arc references from all the outlines and holes in the polyset.
double Area()
Return the area of this poly set.
void BooleanAdd(const SHAPE_POLY_SET &b, POLYGON_MODE aFastMode)
Perform boolean polyset union For aFastMode meaning, see function booleanOp.
void BooleanIntersection(const SHAPE_POLY_SET &b, POLYGON_MODE aFastMode)
Perform boolean polyset intersection For aFastMode meaning, see function booleanOp.
void Inflate(int aAmount, CORNER_STRATEGY aCornerStrategy, int aMaxError, bool aSimplify=false)
Perform outline inflation/deflation.
int HoleCount(int aOutline) const
Returns the number of holes in a given outline.
int AddHole(const SHAPE_LINE_CHAIN &aHole, int aOutline=-1)
Adds a new hole to the given outline (default: last) and returns its index.
SHAPE_LINE_CHAIN & Outline(int aIndex)
Return the reference to aIndex-th outline in the set.
SHAPE_LINE_CHAIN & Hole(int aOutline, int aHole)
Return the reference to aHole-th hole in the aIndex-th outline.
const SHAPE_LINE_CHAIN & CHole(int aOutline, int aHole) const
int OutlineCount() const
Return the number of outlines in the set.
void Move(const VECTOR2I &aVector) override
bool Contains(const VECTOR2I &aP, int aSubpolyIndex=-1, int aAccuracy=0, bool aUseBBoxCaches=false) const
Return true if a given subpolygon contains the point aP.
const SHAPE_LINE_CHAIN & COutline(int aIndex) const
Simple container to manage line stroke parameters.
T EuclideanNorm() const
Compute the Euclidean norm of the vector, which is defined as sqrt(x ** 2 + y ** 2).
VECTOR2< T > Resize(T aNewLength) const
Return a vector of the same direction, but length specified in aNewLength.
EDA_ANGLE m_HatchOrientation
Handle a list of polygons defining a copper zone.
void SetHatchThickness(int aThickness)
void SetNeedRefill(bool aNeedRefill)
void SetDoNotAllowPads(bool aEnable)
std::optional< int > GetLocalClearance() const override
void SetLocalClearance(std::optional< int > aClearance)
void AddPolygon(std::vector< VECTOR2I > &aPolygon)
Add a polygon to the zone outline.
const std::shared_ptr< SHAPE_POLY_SET > & GetFilledPolysList(PCB_LAYER_ID aLayer) const
void SetMinThickness(int aMinThickness)
void SetHatchOrientation(const EDA_ANGLE &aStep)
void SetDoNotAllowCopperPour(bool aEnable)
void SetThermalReliefSpokeWidth(int aThermalReliefSpokeWidth)
virtual void SetLayer(PCB_LAYER_ID aLayer) override
Set the layer this item is on.
SHAPE_POLY_SET * Outline()
void SetHatchStyle(ZONE_BORDER_DISPLAY_STYLE aStyle)
SHAPE_POLY_SET * GetFill(PCB_LAYER_ID aLayer)
void SetIsRuleArea(bool aEnable)
void SetDoNotAllowTracks(bool aEnable)
void SetFilledPolysList(PCB_LAYER_ID aLayer, const SHAPE_POLY_SET &aPolysList)
Set the list of filled polygons.
void SetIsFilled(bool isFilled)
void SetFillMode(ZONE_FILL_MODE aFillMode)
bool HasFilledPolysForLayer(PCB_LAYER_ID aLayer) const
void SetDoNotAllowVias(bool aEnable)
void SetThermalReliefGap(int aThermalReliefGap)
void SetLayerSet(LSET aLayerSet) override
virtual LSET GetLayerSet() const override
Return a std::bitset of all layers on which the item physically resides.
void SetDoNotAllowFootprints(bool aEnable)
void SetAssignedPriority(unsigned aPriority)
void SetPadConnection(ZONE_CONNECTION aPadConnection)
void SetZoneName(const wxString &aName)
void SetIslandRemovalMode(ISLAND_REMOVAL_MODE aRemove)
void SetMinIslandArea(long long int aArea)
void SetHatchGap(int aStep)
void TransformArcToPolygon(SHAPE_POLY_SET &aBuffer, const VECTOR2I &aStart, const VECTOR2I &aMid, const VECTOR2I &aEnd, int aWidth, int aError, ERROR_LOC aErrorLoc)
Convert arc to multiple straight segments.
void TransformOvalToPolygon(SHAPE_POLY_SET &aBuffer, const VECTOR2I &aStart, const VECTOR2I &aEnd, int aWidth, int aError, ERROR_LOC aErrorLoc, int aMinSegCount=0)
Convert a oblong shape to a polygon, using multiple segments.
static constexpr EDA_ANGLE ANGLE_90
static constexpr EDA_ANGLE ANGLE_180
#define DEFAULT_SIZE_TEXT
This is the "default-of-the-default" hardcoded text size; individual application define their own def...
#define THROW_IO_ERROR(msg)
PCB_LAYER_ID
A quick note on layer IDs:
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 ...
constexpr int Mils2IU(const EDA_IU_SCALE &aIuScale, int mils)
EDA_ANGLE abs(const EDA_ANGLE &aAngle)
Class to handle a set of BOARD_ITEMs.
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< SPACING_CLASS_ID, SPCCLASSNAME > SpacingClassNames
std::map< LINECODE_ID, LINECODE > LineCodes
std::map< NETCLASS_ID, CADSTAR_NETCLASS > NetClasses
std::map< HATCHCODE_ID, HATCHCODE > HatchCodes
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.
SYMDEF_ID SymdefID
Normally documentation symbols only have TEXT, FIGURE and TEXT_LOCATION objects which are all drawn o...
GROUP_ID GroupID
If not empty, this GROUP is part of another GROUP.
std::vector< HATCH > Hatches
ROUTECODE_ID RouteCodeID
"NETCODE" subnode
wxString Name
This is undefined (wxEmptyString) if the net is unnamed.
NETCLASS_ID NetClassID
The net might not have a net class, in which case it will be wxEmptyString ("NETCLASSREF" subnode)
SPACING_CLASS_ID SpacingClassID
The net might not have a spacing class, in which case it will be wxEmptyString ("SPACINGCLASS" subnod...
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
wxString Name
This name can be different to the PART name.
std::map< PART_DEFINITION_PIN_ID, PIN > Pins
Represents a point in x,y coordinates.
UNITS Units
Units to display for linear dimensions.
std::pair< POINT, POINT > DesignArea
long UnitDisplPrecision
Number of decimal points to display for linear dimensions.
std::vector< VERTEX > Vertices
wxString HatchCodeID
Only Applicable for HATCHED Type.
std::vector< CUTOUT > Cutouts
Not Applicable to OPENSHAPE Type.
std::map< FIGURE_ID, FIGURE > Figures
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
wxString ReferenceName
This is the name which identifies the symbol in the library Multiple components may exist with the sa...
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...
std::map< VARIANT_ID, VARIANT > Variants
< Nodename = "VARIANT" or "VMASTER" (master variant
Represents a vertex in a shape.
From CADSTAR Help: "Area is for creating areas within which, and nowhere else, certain operations are...
bool Keepout
From CADSTAR Help: "Auto Placement cannot place components within this area.
bool Placement
From CADSTAR Help: "Auto Placement can place components within this area.
bool NoVias
From CADSTAR Help: "No vias will be placed within this area by the automatic router.
bool Routing
From CADSTAR Help: "Area can be used to place routes during Automatic Routing.
bool NoTracks
From CADSTAR Help: "Area cannot be used to place routes during automatic routing.
TECHNOLOGY_SECTION Technology
GROUP_ID GroupID
Normally CADSTAR_BOARD cannot be part of a reuseblock, but included for completeness.
long OrientAngle
1/1000 of a Degree
std::map< COPPERCODE_ID, COPPERCODE > CopperCodes
std::map< PADCODE_ID, PADCODE > PadCodes
std::map< VIACODE_ID, VIACODE > ViaCodes
std::map< SPACINGCODE_ID, SPACINGCODE > SpacingCodes
Spacing Design Rules.
std::map< LAYERPAIR_ID, LAYERPAIR > LayerPairs
Default vias to use between pairs of layers.
From CADSTAR Help: "Area is for creating areas within which, and nowhere else, certain operations are...
bool NoVias
From CADSTAR Help: "Check this button to specify that any area created by the Rectangle,...
bool NoTracks
From CADSTAR Help: "Check this button to specify that any area created by the Rectangle,...
A shape of copper in the component footprint.
std::vector< PAD_ID > AssociatedPadIDs
COPPERCODE_ID CopperCodeID
bool PCBonlyPad
From CADSTAR Help: "The PCB Only Pad property can be used to stop ECO Update, Back Annotation,...
PAD_EXITS Exits
See PAD_EXITS.
POINT Position
Pad position within the component's coordinate frame.
wxString Identifier
This is an identifier that is displayed to the user.
PAD_SIDE Side
See PAD_SIDE.
wxString Name
Designator e.g. "C1", "R1", etc.
POINT Origin
Origin of the component (this is used as the reference point when placing the component in the design...
std::map< ATTRIBUTE_ID, ATTRIBUTE_VALUE > AttributeValues
std::map< PAD_ID, PADEXCEPTION > PadExceptions
Override pad definitions for this instance.
std::map< ATTRIBUTE_ID, TEXT_LOCATION > TextLocations
This contains location of any attributes, including designator position.
COMPONENT_ID VariantParentComponentID
COPPERCODE_ID CopperCodeID
TEMPLATE_ID PouredTemplateID
If not empty, it means this COPPER is part of a poured template.
long Offset
Offset from the measurement point.
long Overshoot
Overshoot of the extension line past the arrow line.
long LeaderLineExtensionLength
Only for TYPE=LEADERLINE Length of the horizontal part of the leader line [param6].
LINECODE_ID LineCodeID
param0
long LeaderLineLength
Only for TYPE=LEADERLINE Length of the angled part of the leader line [param5].
long LeaderAngle
Only for TYPE=LEADERLINE subnode "LEADERANG".
STYLE Style
Subnode="DIMLINETYPE".
Linear, leader (radius/diameter) or angular dimension.
LAYER_ID LayerID
ID on which to draw this [param1].
EXTENSION_LINE ExtensionLineParams
Not applicable to TYPE=LEADERDIM.
DIMENSION_ID ID
Some ID (doesn't seem to be used) subnode="DIMREF".
long Precision
Number of decimal points to display in the measurement [param3].
std::vector< LAYER_ID > LayerStack
std::map< MATERIAL_ID, MATERIAL > Materials
std::map< LAYER_ID, LAYER > Layers
PHYSICAL_LAYER_ID PhysicalLayerStart
PHYSICAL_LAYER_ID PhysicalLayerEnd
long Thickness
Note: Units of length are defined in file header.
std::map< TEMPLATE_ID, TEMPLATE > Templates
std::map< BOARD_ID, CADSTAR_BOARD > Boards
Normally CADSTAR only allows one board but.
std::map< TEXT_ID, TEXT > Texts
std::map< NET_ID, NET_PCB > Nets
Contains tracks and vias.
std::map< FIGURE_ID, FIGURE > Figures
VARIANT_HIERARCHY VariantHierarchy
std::map< COMPONENT_ID, COMPONENT > Components
std::map< COPPER_ID, COPPER > Coppers
std::map< DOCUMENTATION_SYMBOL_ID, DOCUMENTATION_SYMBOL > DocumentationSymbols
std::map< TRUNK_ID, TRUNK > Trunks
std::map< DIMENSION_ID, DIMENSION > Dimensions
std::map< REUSEBLOCK_ID, REUSEBLOCK > ReuseBlocks
std::map< AREA_ID, AREA > Areas
std::map< GROUP_ID, GROUP > Groups
std::map< SYMDEF_ID, SYMDEF_PCB > ComponentDefinitions
std::vector< CONNECTION_PCB > Connections
std::map< NETELEMENT_ID, VIA > Vias
std::map< NETELEMENT_ID, PIN > Pins
std::map< NETELEMENT_ID, JUNCTION_PCB > Junctions
long ReliefWidth
if undefined inherits from design
std::map< LAYER_ID, CADSTAR_PAD_SHAPE > Reassigns
long ReliefClearance
if undefined inherits from design
PADCODE_ID PadCode
If not empty, override padcode.
std::map< PAD_ID, COMPONENT_PAD > ComponentPads
std::vector< COMPONENT_COPPER > ComponentCoppers
std::map< COMP_AREA_ID, COMPONENT_AREA > ComponentAreas
long MinRouteWidth
Manufacturing Design Rule. Corresponds to "Thin Route Width".
long MaxPhysicalLayer
Should equal number of copper layers.
long AdditionalIsolation
This is the gap to apply in routes and pads in addition to the existing pad-to-copper or route-to-cop...
bool ThermalReliefOnVias
false when subnode "NOVIARELIEF" is present
HATCHCODE_ID HatchCodeID
Only for FillType = HATCHED.
bool ThermalReliefOnPads
false when subnode "NOPINRELIEF" is present
long ThermalReliefPadsAngle
Orientation for the thermal reliefs.
long MinDisjointCopper
The value is the length of one side of a notional square.
bool AutomaticRepour
true when subnode "REGENERATE" is present
bool AllowInNoRouting
true when subnode "IGNORETRN" is present
bool BoxIsolatedPins
true when subnode "BOXPINS" is present
long ClearanceWidth
Specifies the space around pads when pouring (i.e.
COPPERCODE_ID ReliefCopperCodeID
From CADSTAR Help: "Relief Copper Code is for selecting the width of line used to draw the thermal re...
COPPER_FILL_TYPE FillType
Assume solid fill.
COPPERCODE_ID CopperCodeID
From CADSTAR Help: "Copper Code is for selecting the width of the line used to draw the outline and f...
long ThermalReliefViasAngle
Disabled when !ThermalReliefOnVias (param6)
long MinIsolatedCopper
The value is the length of one side of a notional square.
long SliverWidth
Minimum width of copper that may be created.
Templates are CADSTAR's equivalent to a "filled zone".
POURING Pouring
Copper pour settings (e.g. relief / hatching /etc.)
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.
double DEG2RAD(double deg)
@ PCB_DIM_ALIGNED_T
class PCB_DIM_ALIGNED, a linear dimension (graphic item)
constexpr ret_type KiROUND(fp_type v)
Round a floating point number to an integer using "round halfway cases away from zero".