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->SetKeepTopBottom(
false );
902 pad->SetAttribute( PAD_ATTRIB::SMD );
903 pad->SetLayerSet( copperLayers );
905 ? wxString::Format( wxT(
"%ld" ), anchorPad.
ID )
915 if( anchorSize <= 0 )
918 pad->SetShape( PAD_SHAPE::CUSTOM );
919 pad->SetAnchorPadShape( PAD_SHAPE::CIRCLE );
920 pad->SetSize( { anchorSize, anchorSize } );
921 pad->SetPosition( anchorPos );
925 shapePolys.
Move( -anchorPos );
926 pad->AddPrimitivePoly( shapePolys, 0,
true );
937 aFootprint->
Add(
pad.release(), ADD_MODE::APPEND );
942 remainingLayers ^= copperLayers;
945 if( remainingLayers.any() )
950 wxString::Format( wxT(
"Component %s:%s -> Copper element" ),
962 for( std::pair<COMP_AREA_ID, COMPONENT_AREA> areaPair : aComponent.
ComponentAreas )
968 int lineThickness = 0;
971 aFootprint->
Add( zone, ADD_MODE::APPEND );
993 libName << wxT(
" (" ) << aComponent.
Alternate << wxT(
")" );
996 wxString::Format(
_(
"The CADSTAR area '%s' in library component '%s' does not "
997 "have a KiCad equivalent. The area is neither a via nor "
998 "route keepout area. The area was not imported." ),
999 area.
ID, libName ) );
1008 for( std::pair<PAD_ID, COMPONENT_PAD> padPair : aComponent.
ComponentPads )
1011 aFootprint->
Add(
pad, ADD_MODE::APPEND );
1022 std::unique_ptr<PAD>
pad = std::make_unique<PAD>( aParent );
1025 switch( aCadstarPad.
Side )
1040 wxFAIL_MSG( wxT(
"Unknown Pad type" ) );
1043 pad->SetAttribute( PAD_ATTRIB::SMD );
1044 pad->SetLocalSolderMaskMargin( 0 );
1045 pad->SetLocalSolderPasteMargin( 0 );
1046 pad->SetLocalSolderPasteMarginRatio( 0.0 );
1047 bool complexPadErrorLogged =
false;
1049 for(
auto& reassign : csPadcode.
Reassigns )
1054 if( shape.
Size == 0 )
1056 padLayerSet.reset( kiLayer );
1064 std::optional<int> localMargin =
pad->GetLocalSolderMaskMargin();
1066 if( !localMargin.has_value() )
1067 pad->SetLocalSolderMaskMargin( newMargin );
1069 pad->SetLocalSolderMaskMargin( newMargin );
1073 std::optional<int> localMargin =
pad->GetLocalSolderPasteMargin();
1075 if( !localMargin.has_value() )
1076 pad->SetLocalSolderPasteMargin( newMargin );
1078 pad->SetLocalSolderPasteMargin( newMargin );
1084 if( !complexPadErrorLogged )
1086 complexPadErrorLogged =
true;
1090 _(
"The CADSTAR pad definition '%s' is a complex pad stack, "
1091 "which is not supported in KiCad. Please review the "
1092 "imported pads as they may require manual correction." ),
1099 pad->SetLayerSet( padLayerSet );
1106 pad->SetNumber( wxT(
"" ) );
1111 ? wxString::Format( wxT(
"%ld" ), aCadstarPad.
ID )
1123 pad->SetAttribute( PAD_ATTRIB::SMD );
1138 pad->SetShape( PAD_SHAPE::CIRCLE );
1144 pad->SetShape( PAD_SHAPE::CHAMFERED_RECT );
1149 pad->SetChamferPositions( RECT_CHAMFER_POSITIONS::RECT_CHAMFER_BOTTOM_LEFT
1150 | RECT_CHAMFER_POSITIONS::RECT_CHAMFER_TOP_LEFT );
1151 pad->SetRoundRectRadiusRatio( 0.5 );
1152 pad->SetChamferRectRatio( 0.0 );
1159 pad->SetShape( PAD_SHAPE::CIRCLE );
1169 pad->SetShape( PAD_SHAPE::RECTANGLE );
1170 pad->SetChamferRectRatio( 0.5 );
1171 pad->SetSize( { sizeOfSquare, sizeOfSquare } );
1179 pad->SetShape( PAD_SHAPE::OVAL );
1190 pad->SetShape( PAD_SHAPE::CHAMFERED_RECT );
1191 pad->SetChamferPositions( RECT_CHAMFER_POSITIONS::RECT_CHAMFER_ALL );
1192 pad->SetChamferRectRatio( 0.25 );
1198 pad->SetShape( PAD_SHAPE::RECTANGLE );
1209 pad->SetShape( PAD_SHAPE::ROUNDRECT );
1222 pad->SetShape( PAD_SHAPE::RECTANGLE );
1228 wxFAIL_MSG( wxT(
"Unknown Pad Shape" ) );
1241 pad->SetDrillShape( PAD_DRILL_SHAPE_T::PAD_DRILL_SHAPE_OBLONG );
1248 pad->SetDrillShape( PAD_DRILL_SHAPE_T::PAD_DRILL_SHAPE_CIRCLE );
1257 pad->SetAttribute( PAD_ATTRIB::PTH );
1259 pad->SetAttribute( PAD_ATTRIB::NPTH );
1263 pad->SetDrillSize( { 0, 0 } );
1268 LSET lset =
pad->GetLayerSet();
1271 if( lset.size() > 0 )
1277 pad->SetPosition( { 0, 0 } );
1278 pad->TransformShapeToPolygon( padOutline, layer, 0, maxError,
ERROR_INSIDE );
1281 padShape->
SetShape( SHAPE_T::POLY );
1285 padShape->
Move( padOffset - drillOffset );
1290 if( editedPadOutline.
Contains( { 0, 0 } ) )
1292 pad->SetAnchorPadShape( PAD_SHAPE::RECTANGLE );
1294 pad->SetShape( PAD_SHAPE::CUSTOM );
1295 pad->AddPrimitive( padShape );
1296 padOffset = { 0, 0 };
1303 drillOffset = { 0, 0 };
1308 _(
"The CADSTAR pad definition '%s' has the hole shape outside the "
1309 "pad shape. The hole has been moved to the center of the pad." ),
1315 wxFAIL_MSG( wxT(
"No copper layers defined in the pad?" ) );
1317 pad->SetOffset( drillOffset );
1322 pad->SetOffset( drillOffset );
1338 wxLogError(
_(
"The CADSTAR pad definition '%s' has import errors: %s" ),
1345 pad->SetKeepTopBottom(
false );
1347 return pad.release();
1352 const PAD_ID aCadstarPadID )
1354 size_t index = aCadstarPadID - (long) 1;
1356 if( !( index < aFootprint->Pads().size() ) )
1358 THROW_IO_ERROR( wxString::Format(
_(
"Unable to find pad index '%d' in footprint '%s'." ),
1359 (
long) aCadstarPadID,
1363 return aFootprint->
Pads().at( index );
1369 for( std::pair<GROUP_ID, GROUP> groupPair :
Layout.
Groups )
1371 GROUP& csGroup = groupPair.second;
1383 for( std::pair<GROUP_ID, GROUP> groupPair :
Layout.
Groups )
1385 GROUP& csGroup = groupPair.second;
1387 if( !csGroup.
GroupID.IsEmpty() )
1391 THROW_IO_ERROR( wxString::Format(
_(
"Unable to find group ID %s in the group "
1397 THROW_IO_ERROR( wxString::Format(
_(
"Unable to find sub group %s in the group "
1398 "map (parent group ID=%s, Name=%s)." ),
1407 parentGroup->
AddItem( kiCadGroup );
1416 for( std::pair<BOARD_ID, CADSTAR_BOARD> boardPair :
Layout.
Boards )
1422 wxString::Format( wxT(
"BOARD %s" ), board.
ID ),
1425 if( !board.
GroupID.IsEmpty() )
1437 for( std::pair<FIGURE_ID, FIGURE> figPair :
Layout.
Figures )
1439 FIGURE& fig = figPair.second;
1446 wxString::Format( wxT(
"FIGURE %s" ), fig.
ID ),
1459 for( std::pair<TEXT_ID, TEXT> txtPair :
Layout.
Texts )
1461 TEXT& csTxt = txtPair.second;
1473 switch( csDim.
Type )
1475 case DIMENSION::TYPE::LINEARDIM:
1478 case DIMENSION::SUBTYPE::ANGLED:
1479 wxLogWarning( wxString::Format(
_(
"Dimension ID %s is an angled dimension, which "
1480 "has no KiCad equivalent. An aligned dimension "
1481 "was loaded instead." ),
1484 case DIMENSION::SUBTYPE::DIRECT:
1485 case DIMENSION::SUBTYPE::ORTHOGONAL:
1487 if( csDim.
Line.
Style == DIMENSION::LINE::STYLE::EXTERNAL )
1489 wxLogWarning( wxString::Format(
1490 _(
"Dimension ID %s has 'External' style in CADSTAR. External "
1491 "dimension styles are not yet supported in KiCad. The dimension "
1492 "object was imported with an internal dimension style instead." ),
1498 if( csDim.
Subtype == DIMENSION::SUBTYPE::ORTHOGONAL )
1522 VECTOR2I crossbarVector = crossbarEnd - crossbarStart;
1524 double height = 0.0;
1526 if( csDim.
Subtype == DIMENSION::SUBTYPE::ORTHOGONAL )
1529 height = heightVector.
y;
1531 height = heightVector.
x;
1537 height = heightVector.
x * angle.
Cos() + heightVector.
y * angle.
Sin();
1547 wxLogError(
_(
"Unexpected Dimension type (ID %s). This was not imported." ),
1553 case DIMENSION::TYPE::LEADERDIM:
1556 if( csDim.
Line.
Style == DIMENSION::LINE::STYLE::INTERNAL )
1680 case DIMENSION::TYPE::ANGLEDIM:
1682 wxLogError(
_(
"Dimension %s is an angular dimension which has no KiCad equivalent. "
1683 "The object was not imported." ),
1693 for( std::pair<AREA_ID, AREA> areaPair :
Layout.
Areas )
1695 AREA& area = areaPair.second;
1699 int lineThickness = 0;
1722 wxLogWarning( wxString::Format(
_(
"The CADSTAR area '%s' is marked as a placement "
1723 "area in CADSTAR. Placement areas are not "
1724 "supported in KiCad. Only the supported elements "
1725 "for the area were imported." ),
1731 wxLogError( wxString::Format(
_(
"The CADSTAR area '%s' does not have a KiCad "
1732 "equivalent. Pure Placement areas are not supported." ),
1758 THROW_IO_ERROR( wxString::Format(
_(
"Unable to find component '%s' in the library"
1759 "(Symdef ID: '%s')" ),
1764 FOOTPRINT* libFootprint = fpIter->second;
1783 for( std::pair<PART_DEFINITION_PIN_ID, PART::DEFINITION::PIN> pinPair :
1786 PART::DEFINITION::PIN
pin = pinPair.second;
1787 wxString pinName =
pin.Name;
1789 if( pinName.empty() )
1790 pinName =
pin.Identifier;
1792 if( pinName.empty() )
1793 pinName = wxString::Format( wxT(
"%ld" ),
pin.ID );
1805 for( std::pair<PAD_ID, PADEXCEPTION> padPair : comp.
PadExceptions )
1814 if( !padEx.
PadCode.IsEmpty() )
1829 wxString padNumber = kiPad->
GetNumber();
1844 footprint->
SetValue( wxEmptyString );
1860 if( !comp.
PartID.IsEmpty() && comp.
PartID != wxT(
"NO_PART" ) )
1872 for( std::pair<DOCUMENTATION_SYMBOL_ID, DOCUMENTATION_SYMBOL> docPair :
1882 THROW_IO_ERROR( wxString::Format(
_(
"Unable to find documentation symbol in the "
1883 "library (Symdef ID: '%s')" ),
1887 SYMDEF_PCB& docSymDefinition = ( *docSymIter ).second;
1894 bool mirrorInvert = docSymInstance.
Mirror;
1899 if( !docSymDefinition.
Alternate.IsEmpty() )
1900 groupName += wxT(
" (" ) + docSymDefinition.
Alternate + wxT(
")" );
1908 for( std::pair<FIGURE_ID, FIGURE> figPair : docSymDefinition.
Figures )
1910 FIGURE fig = figPair.second;
1912 wxString::Format( wxT(
"DOCUMENTATION SYMBOL %s, FIGURE %s" ),
1914 m_board, groupID, moveVector, rotationAngle, scalingFactor,
1915 centreOfTransform, mirrorInvert );
1919 for( std::pair<TEXT_ID, TEXT> textPair : docSymDefinition.
Texts )
1921 TEXT txt = textPair.second;
1923 rotationAngle, scalingFactor, centreOfTransform, mirrorInvert );
1933 TEMPLATE& csTemplate = tempPair.second;
1935 int zonelinethickness = 0;
1945 if( !( csTemplate.
NetID.IsEmpty() || csTemplate.
NetID == wxT(
"NONE" ) ) )
1950 wxLogWarning( wxString::Format(
1951 _(
"The CADSTAR template '%s' has the setting 'Allow in No Routing Areas' "
1952 "enabled. This setting has no KiCad equivalent, so it has been ignored." ),
1953 csTemplate.
Name ) );
1958 wxLogWarning( wxString::Format(
1959 _(
"The CADSTAR template '%s' has the setting 'Box Isolated Pins' "
1960 "enabled. This setting has no KiCad equivalent, so it has been ignored." ),
1961 csTemplate.
Name ) );
1966 wxLogWarning( wxString::Format(
1967 _(
"The CADSTAR template '%s' has the setting 'Automatic Repour' "
1968 "enabled. This setting has no KiCad equivalent, so it has been ignored." ),
1969 csTemplate.
Name ) );
1977 wxLogWarning( wxString::Format(
1978 _(
"The CADSTAR template '%s' has a non-zero value defined for the "
1979 "'Sliver Width' setting. There is no KiCad equivalent for "
1980 "this, so this setting was ignored." ),
1981 csTemplate.
Name ) );
1987 wxLogWarning( wxString::Format(
1988 _(
"The CADSTAR template '%s' has different settings for 'Retain Poured Copper "
1989 "- Disjoint' and 'Retain Poured Copper - Isolated'. KiCad does not "
1990 "distinguish between these two settings. The setting for disjoint copper "
1991 "has been applied as the minimum island area of the KiCad Zone." ),
1992 csTemplate.
Name ) );
1995 long long minIslandArea = -1;
2022 if( csTemplate.
Pouring.
FillType == TEMPLATE::POURING::COPPER_FILL_TYPE::HATCHED )
2024 zone->
SetFillMode( ZONE_FILL_MODE::HATCH_PATTERN );
2038 wxLogWarning( wxString::Format(
2039 _(
"The CADSTAR template '%s' has different settings for thermal relief "
2040 "in pads and vias. KiCad only supports one single setting for both. The "
2041 "setting for pads has been applied." ),
2042 csTemplate.
Name ) );
2053 if( spokeWidth < minThickness )
2055 wxLogWarning( wxString::Format(
2056 _(
"The CADSTAR template '%s' has thermal reliefs in the original design "
2057 "but the spoke width (%.2f mm) is thinner than the minimum thickness of "
2058 "the zone (%.2f mm). KiCad requires the minimum thickness of the zone "
2059 "to be preserved. Therefore the minimum thickness has been applied as "
2060 "the new spoke width and will be applied next time the zones are "
2065 spokeWidth = minThickness;
2088 NET_ID netid = wxEmptyString;
2090 for( std::pair<NET_ID, NET_PCB> netPair :
Layout.
Nets )
2094 if( net.
Name == powerPlaneLayerName )
2101 if( netid.IsEmpty() )
2103 wxLogError(
_(
"The CADSTAR layer '%s' is defined as a power plane layer. However no "
2104 "net with such name exists. The layer has been loaded but no copper "
2105 "zone was created." ),
2106 powerPlaneLayerName );
2110 for( std::pair<BOARD_ID, CADSTAR_BOARD> boardPair :
Layout.
Boards )
2115 int defaultLineThicknesss = bds.
GetLineThickness( PCB_LAYER_ID::Edge_Cuts );
2135 for( std::pair<COPPER_ID, COPPER> copPair :
Layout.
Coppers )
2137 COPPER& csCopper = copPair.second;
2160 if( shape->GetShape() == SHAPE_T::ARC )
2164 ERROR_LOC::ERROR_INSIDE );
2170 ERROR_LOC::ERROR_INSIDE );
2205 _(
"The CADSTAR design contains COPPER elements, which have no direct KiCad "
2206 "equivalent. These have been imported as a KiCad Zone if solid or hatch "
2207 "filled, or as a KiCad Track if the shape was an unfilled outline (open or "
2255 zone->
SetFillMode( ZONE_FILL_MODE::HATCH_PATTERN );
2281 for( std::pair<NET_ID, NET_PCB> netPair :
Layout.
Nets )
2284 wxString netnameForErrorReporting = net.
Name;
2286 std::map<NETELEMENT_ID, long> netelementSizes;
2288 if( netnameForErrorReporting.IsEmpty() )
2289 netnameForErrorReporting = wxString::Format( wxT(
"$%ld" ), net.
SignalNum );
2291 for( std::pair<NETELEMENT_ID, NET_PCB::VIA> viaPair : net.
Vias )
2293 NET_PCB::VIA
via = viaPair.second;
2297 netelementSizes.insert( { viaPair.first, viaSize } );
2300 for( std::pair<NETELEMENT_ID, NET_PCB::PIN> pinPair : net.
Pins )
2302 NET_PCB::PIN
pin = pinPair.second;
2305 if( footprint ==
nullptr )
2307 wxLogWarning( wxString::Format(
2308 _(
"The net '%s' references component ID '%s' which does not exist. "
2309 "This has been ignored." ),
2310 netnameForErrorReporting,
pin.ComponentID ) );
2312 else if( (
pin.PadID - (
long) 1 ) > footprint->
Pads().size() )
2314 wxLogWarning( wxString::Format(
_(
"The net '%s' references non-existent pad index"
2315 " '%d' in component '%s'. This has been "
2317 netnameForErrorReporting,
2336 if( assocPads.find(
pin.PadID ) != assocPads.end() )
2338 for(
PAD_ID copperPadID : assocPads.at(
pin.PadID ) )
2347 int padsize = std::min(
pad->GetSizeX(),
pad->GetSizeY() );
2348 netelementSizes.insert( { pinPair.first, padsize } );
2356 auto getJunctionSize =
2357 [&](
NETELEMENT_ID aJptNetElemId,
const NET_PCB::CONNECTION_PCB& aConnectionToIgnore ) ->
int
2359 int jptsize = std::numeric_limits<int>::max();
2361 for( NET_PCB::CONNECTION_PCB connection : net.
Connections )
2363 if( connection.Route.RouteVertices.size() == 0 )
2366 if( connection.StartNode == aConnectionToIgnore.StartNode
2367 && connection.EndNode == aConnectionToIgnore.EndNode )
2372 if( connection.StartNode == aJptNetElemId )
2374 int s =
getKiCadLength( connection.Route.RouteVertices.front().RouteWidth );
2375 jptsize = std::max( jptsize, s );
2377 else if( connection.EndNode == aJptNetElemId )
2379 int s =
getKiCadLength( connection.Route.RouteVertices.back().RouteWidth );
2380 jptsize = std::max( jptsize, s );
2384 if( jptsize == std::numeric_limits<int>::max()
2385 && !aConnectionToIgnore.Route.RouteVertices.empty() )
2389 NET_PCB::ROUTE_VERTEX vertex = aConnectionToIgnore.Route.RouteVertices.front();
2391 if( aConnectionToIgnore.EndNode == aJptNetElemId )
2392 vertex = aConnectionToIgnore.Route.RouteVertices.back();
2400 for( NET_PCB::CONNECTION_PCB connection : net.
Connections )
2402 int startSize = std::numeric_limits<int>::max();
2403 int endSize = std::numeric_limits<int>::max();
2405 if( netelementSizes.find( connection.StartNode ) != netelementSizes.end() )
2406 startSize = netelementSizes.at( connection.StartNode );
2408 startSize = getJunctionSize( connection.StartNode, connection );
2410 if( netelementSizes.find( connection.EndNode ) != netelementSizes.end() )
2411 endSize = netelementSizes.at( connection.EndNode );
2413 endSize = getJunctionSize( connection.EndNode, connection );
2418 if( !connection.Unrouted )
2427 auto findAndReplaceTextField =
2466 wxString varValue = txtvalue.second;
2468 txtVars.insert( { varName, varValue } );
2473 wxString varName = txtvalue.first;
2474 wxString varValue = txtvalue.second;
2476 txtVars.insert( { varName, varValue } );
2481 wxLogError(
_(
"Text Variables could not be set as there is no project loaded." ) );
2489 for( std::pair<ATTRIBUTE_ID, ATTRIBUTE_VALUE> attrPair : aComponent.
AttributeValues )
2500 for( std::pair<ATTRIBUTE_ID, TEXT_LOCATION> textlocPair : aComponent.
TextLocations )
2507 attrval = wxEmptyString;
2511 attrval = wxT(
"${REFERENCE}" );
2526 const NET_PCB::ROUTE& aCadstarRoute,
2527 long aStartWidth,
long aEndWidth )
2529 if( aCadstarRoute.RouteVertices.size() == 0 )
2532 std::vector<PCB_SHAPE*> shapes;
2533 std::vector<NET_PCB::ROUTE_VERTEX> routeVertices = aCadstarRoute.RouteVertices;
2536 if( aStartWidth < routeVertices.front().RouteWidth )
2538 NET_PCB::ROUTE_VERTEX newFrontVertex = aCadstarRoute.RouteVertices.front();
2539 newFrontVertex.RouteWidth = aStartWidth;
2540 newFrontVertex.Vertex.End = aCadstarRoute.StartPoint;
2541 routeVertices.insert( routeVertices.begin(), newFrontVertex );
2545 if( aEndWidth < routeVertices.back().RouteWidth )
2547 NET_PCB::ROUTE_VERTEX newBackVertex = aCadstarRoute.RouteVertices.back();
2548 newBackVertex.RouteWidth = aEndWidth;
2549 routeVertices.push_back( newBackVertex );
2552 POINT prevEnd = aCadstarRoute.StartPoint;
2554 for(
const NET_PCB::ROUTE_VERTEX& v : routeVertices )
2560 shapes.push_back( shape );
2561 prevEnd = v.Vertex.End;
2566 wxLogError(
_(
"The CADSTAR design contains teardrops. This importer does not yet "
2567 "support them, so the teardrops in the design have been ignored." ) );
2583 const NET_ID& aCadstarNetID,
const NET_PCB::VIA& aCadstarVia )
2593 via->SetLocked( aCadstarVia.Fixed );
2597 wxLogError(
_(
"The CADSTAR via code '%s' has different shape from a circle defined. "
2598 "KiCad only supports circular vias so this via type has been changed to "
2599 "be a via with circular shape of %.2f mm diameter." ),
2606 bool start_layer_outside =
2609 bool end_layer_outside =
2613 if( start_layer_outside && end_layer_outside )
2615 via->SetViaType( VIATYPE::THROUGH );
2617 else if( ( !start_layer_outside ) && ( !end_layer_outside ) )
2619 via->SetViaType( VIATYPE::BLIND_BURIED );
2623 via->SetViaType( VIATYPE::MICROVIA );
2631 return via->GetWidth();
2638 const LAYER_ID& aCadstarLayerOverride,
2640 double aRotationAngle,
double aScalingFactor,
2642 bool aMirrorInvert )
2645 aContainer->
Add( txt );
2650 RotatePoint( rotatedTextPos, aTransformCentre, rotationAngle );
2651 rotatedTextPos.
x =
KiROUND( ( rotatedTextPos.
x - aTransformCentre.
x ) * aScalingFactor );
2652 rotatedTextPos.
y =
KiROUND( ( rotatedTextPos.
y - aTransformCentre.
y ) * aScalingFactor );
2653 rotatedTextPos += aTransformCentre;
2712 wxFAIL_MSG( wxT(
"Unknown Alignment - needs review!" ) );
2716 txt->
Flip( aTransformCentre,
true );
2719 if( aScalingFactor != 1.0 )
2725 scaledTextSize.
x =
KiROUND( (
double) unscaledTextSize.
x * aScalingFactor );
2726 scaledTextSize.
y =
KiROUND( (
double) unscaledTextSize.
y * aScalingFactor );
2732 txt->
Move( aMoveVector );
2737 LAYER_ID layersToDrawOn = aCadstarLayerOverride;
2739 if( layersToDrawOn.IsEmpty() )
2740 layersToDrawOn = aCadstarText.
LayerID;
2751 if( !aCadstarGroupID.IsEmpty() )
2762 if( !aCadstarGroupID.IsEmpty() )
2772 const wxString& aShapeName,
2776 double aRotationAngle,
double aScalingFactor,
2778 bool aMirrorInvert )
2780 auto drawAsOutline = [&]()
2783 aContainer, aCadstarGroupID, aMoveVector, aRotationAngle,
2784 aScalingFactor, aTransformCentre, aMirrorInvert );
2786 aCadstarGroupID, aMoveVector, aRotationAngle, aScalingFactor,
2787 aTransformCentre, aMirrorInvert );
2790 switch( aCadstarShape.
Type )
2800 wxLogWarning( wxString::Format(
2801 _(
"The shape for '%s' is Hatch filled in CADSTAR, which has no KiCad equivalent. "
2802 "Using solid fill instead." ),
2808 if( aCadstarShape.
Vertices.size() < 3 )
2819 aMoveVector, aRotationAngle,
2820 aScalingFactor, aTransformCentre,
2828 aContainer->
Add( shape, ADD_MODE::APPEND );
2830 if( !aCadstarGroupID.IsEmpty() )
2844 double aRotationAngle,
2845 double aScalingFactor,
2847 bool aMirrorInvert )
2849 for(
const CUTOUT& cutout : aCutouts )
2852 aCadstarGroupID, aMoveVector, aRotationAngle, aScalingFactor,
2853 aTransformCentre, aMirrorInvert );
2864 double aRotationAngle,
2865 double aScalingFactor,
2867 bool aMirrorInvert )
2870 aCadstarGroupID, aMoveVector,
2871 aRotationAngle, aScalingFactor,
2872 aTransformCentre, aMirrorInvert );
2876 shape->SetStroke(
STROKE_PARAMS( aLineThickness, LINE_STYLE::SOLID ) );
2877 shape->SetLayer( aKiCadLayer );
2878 shape->SetParent( aContainer );
2879 aContainer->
Add( shape, ADD_MODE::APPEND );
2884std::vector<PCB_SHAPE*>
2889 double aRotationAngle,
double aScalingFactor,
2891 bool aMirrorInvert )
2893 std::vector<PCB_SHAPE*> shapes;
2895 if( aCadstarVertices.size() < 2 )
2899 const VERTEX* prev = &aCadstarVertices.at( 0 );
2902 for(
size_t i = 1; i < aCadstarVertices.size(); i++ )
2904 cur = &aCadstarVertices.at( i );
2906 aMoveVector, aRotationAngle, aScalingFactor,
2907 aTransformCentre, aMirrorInvert ) );
2916 const VERTEX& aCadstarVertex,
2920 double aRotationAngle,
2921 double aScalingFactor,
2923 bool aMirrorInvert )
2935 centerPoint = ( startPoint + endPoint ) / 2;
2942 switch( aCadstarVertex.
Type )
2946 shape =
new PCB_SHAPE( aContainer, SHAPE_T::SEGMENT );
2949 shape->
SetEnd( endPoint );
2960 shape =
new PCB_SHAPE( aContainer, SHAPE_T::ARC );
2965 EDA_ANGLE arcStartAngle( startPoint - centerPoint );
2966 EDA_ANGLE arcEndAngle( endPoint - centerPoint );
2967 EDA_ANGLE arcAngle = ( arcEndAngle - arcStartAngle ).Normalize();
2982 shape->
Flip( aTransformCentre,
true );
2984 if( aScalingFactor != 1.0 )
2986 shape->
Move( -1*aTransformCentre );
2987 shape->
Scale( aScalingFactor );
2988 shape->
Move( aTransformCentre );
2991 if( aRotationAngle != 0.0 )
2994 if( aMoveVector !=
VECTOR2I{ 0, 0 } )
2995 shape->
Move( aMoveVector );
2997 if( !aCadstarGroupID.IsEmpty() )
3005 const int& aLineThickness,
3008 ZONE* zone =
new ZONE( aParentContainer );
3012 zone->
SetFillMode( ZONE_FILL_MODE::HATCH_PATTERN );
3013 zone->
SetHatchStyle( ZONE_BORDER_DISPLAY_STYLE::DIAGONAL_FULL );
3024 for(
int i = 0; i < polygon.
HoleCount( 0 ); i++ )
3035 double aRotationAngle,
3036 double aScalingFactor,
3038 bool aMirrorInvert )
3043 aContainer, noGroup, aMoveVector,
3044 aRotationAngle, aScalingFactor,
3045 aTransformCentre, aMirrorInvert );
3056 noGroup, aMoveVector,
3057 aRotationAngle, aScalingFactor,
3058 aTransformCentre, aMirrorInvert );
3069 if( aLineThickness > 0 )
3077 for(
int j = 0; j < polySet.
HoleCount( i ); ++j )
3094 switch( shape->GetShape() )
3098 SHAPE_ARC arc( shape->GetCenter(), shape->GetStart(), shape->GetArcAngle() );
3100 if( shape->EndsSwapped() )
3107 case SHAPE_T::SEGMENT:
3108 lineChain.
Append( shape->GetStartX(), shape->GetStartY() );
3109 lineChain.
Append( shape->GetEndX(), shape->GetEndY() );
3113 wxFAIL_MSG( wxT(
"Drawsegment type is unexpected. Ignored." ) );
3133 const std::vector<PCB_SHAPE*>& aShapes,
3136 int aWidthOverride )
3138 std::vector<PCB_TRACK*> tracks;
3150 if( aTrack->GetLength() != 0 )
3152 tracks.push_back( aTrack );
3153 aParentContainer->
Add( aTrack, ADD_MODE::APPEND );
3163 switch( shape->GetShape() )
3167 SHAPE_ARC arc( shape->GetStart(), shape->GetArcMid(), shape->GetEnd(), 0 );
3169 if( shape->EndsSwapped() )
3172 track =
new PCB_ARC( aParentContainer, &arc );
3176 case SHAPE_T::SEGMENT:
3177 track =
new PCB_TRACK( aParentContainer );
3178 track->
SetStart( shape->GetStart() );
3179 track->
SetEnd( shape->GetEnd() );
3183 wxFAIL_MSG( wxT(
"Drawsegment type is unexpected. Ignored." ) );
3187 if( aWidthOverride == -1 )
3188 track->
SetWidth( shape->GetWidth() );
3192 if( aLayerOverride == PCB_LAYER_ID::UNDEFINED_LAYER )
3193 track->
SetLayer( shape->GetLayer() );
3197 if( aNet !=
nullptr )
3205 if( prevTrack !=
nullptr )
3207 int offsetAmount = ( track->
GetWidth() / 2 ) - ( prevTrack->
GetWidth() / 2 );
3209 if( offsetAmount > 0 )
3216 else if( offsetAmount < 0 )
3221 prevTrack->
SetEnd( newEnd );
3237 addTrack( synthTrack );
3242 addTrack( prevTrack );
3257 const wxString& aAttributeValue )
3270 aFootprint->
SetValue( aAttributeValue );
3271 txt = &aFootprint->
Value();
3276 aFootprint->
Add( txt );
3277 txt->
SetText( aAttributeValue );
3290 aFootprint->
SetValue( aAttributeValue );
3291 txt = &aFootprint->
Value();
3297 aFootprint->
Add( txt );
3298 txt->
SetText( aAttributeValue );
3308 if( aCadstarAttrLoc.
Mirror )
3366 wxFAIL_MSG( wxT(
"Unknown Alignment - needs review!" ) );
3375 const long& aOffsetAmount )
3377 VECTOR2I v( *aPointToOffset - aRefPoint );
3383 aPointToOffset->
x = offsetted.
x;
3384 aPointToOffset->
y = offsetted.
y;
3388 *aPointToOffset = aRefPoint;
3406 if( textSize.
x == 0 )
3411 if( textSize.
x == 0 || textSize.
y == 0 )
3504 const std::map<ATTRIBUTE_ID, ATTRIBUTE_VALUE>& aCadstarAttributeMap )
3506 wxCHECK( aCadstarAttributeMap.find( aCadstarAttributeID ) != aCadstarAttributeMap.end(),
3509 return aCadstarAttributeMap.at( aCadstarAttributeID ).Value;
3526 const PART_ID& aCadstarPartID )
3561 if( hcode.
Hatches.size() < 1 )
3574 if( hcode.
Hatches.size() < 1 )
3586 if( hcode.
Hatches.size() < 1 )
3611 if( hcode.
Hatches.size() != 2 )
3613 wxLogWarning( wxString::Format(
3614 _(
"The CADSTAR Hatching code '%s' has %d hatches defined. "
3615 "KiCad only supports 2 hatches (crosshatching) 90 degrees apart. "
3616 "The imported hatching is crosshatched." ),
3621 if( hcode.
Hatches.at( 0 ).LineWidth != hcode.
Hatches.at( 1 ).LineWidth )
3623 wxLogWarning( wxString::Format(
3624 _(
"The CADSTAR Hatching code '%s' has different line widths for each "
3625 "hatch. KiCad only supports one width for the hatching. The imported "
3626 "hatching uses the width defined in the first hatch definition, i.e. "
3635 wxLogWarning( wxString::Format(
3636 _(
"The CADSTAR Hatching code '%s' has different step sizes for each "
3637 "hatch. KiCad only supports one step size for the hatching. The imported "
3638 "hatching uses the step size defined in the first hatching definition, "
3645 if( abs( hcode.
Hatches.at( 0 ).OrientAngle - hcode.
Hatches.at( 1 ).OrientAngle )
3648 wxLogWarning( wxString::Format(
3649 _(
"The hatches in CADSTAR Hatching code '%s' have an angle "
3650 "difference of %.1f degrees. KiCad only supports hatching 90 "
3651 "degrees apart. The imported hatching has two hatches 90 "
3652 "degrees apart, oriented %.1f degrees from horizontal." ),
3681 wxString prefix = wxEmptyString;
3682 wxString suffix = wxEmptyString;
3683 size_t startpos = aCadstarDim.
Text.
Text.Find( wxT(
"<@DISTANCE" ) );
3685 if( startpos != wxNOT_FOUND )
3688 wxString remainingStr = aCadstarDim.
Text.
Text.Mid( startpos );
3689 size_t endpos = remainingStr.Find(
"@>" );
3693 if( suffix.StartsWith( wxT(
"mm" ) ) )
3696 suffix = suffix.Mid( 2 );
3714 switch( dimensionUnits )
3719 wxLogWarning( wxString::Format(
_(
"Dimension ID %s uses a type of unit that "
3720 "is not supported in KiCad. Millimeters were "
3721 "applied instead." ),
3725 aKiCadDim->
SetUnitsMode( DIM_UNITS_MODE::MILLIMETRES );
3737 wxFAIL_MSG( wxT(
"We should have handled design units before coming here!" ) );
3744 std::map<TEMPLATE_ID, std::set<TEMPLATE_ID>> winningOverlaps;
3753 aZoneB->GetLocalClearance().value() );
3762 [&](
ZONE* aLowerZone,
ZONE* aHigherZone ) ->
double
3765 intersectShape.
Inflate( inflateValue( aLowerZone, aHigherZone ),
3775 double leftOverArea = lowerZoneFill.
Area();
3777 return leftOverArea;
3780 auto intersectionAreaOfZoneOutlines =
3781 [&](
ZONE* aZoneA,
ZONE* aZoneB ) ->
double
3784 outLineA.
Inflate( inflateValue( aZoneA, aZoneB ), CORNER_STRATEGY::ROUND_ALL_CORNERS,
3788 outLineB.
Inflate( inflateValue( aZoneA, aZoneB ), CORNER_STRATEGY::ROUND_ALL_CORNERS,
3793 return outLineA.
Area();
3797 auto isLowerPriority =
3800 return winningOverlaps[b].count( a ) > 0;
3803 for( std::map<TEMPLATE_ID, ZONE*>::iterator it1 =
m_zonesMap.begin();
3807 ZONE* thisZone = it1->second;
3812 for( std::map<TEMPLATE_ID, ZONE*>::iterator it2 = it1;
3816 ZONE* otherZone = it2->second;
3818 if( thisTemplate.
ID == otherTemplate.
ID )
3827 if( intersectionAreaOfZoneOutlines( thisZone, otherZone ) == 0 )
3836 if( thisZonePolyFill.
Area() > 0.0 && otherZonePolyFill.
Area() > 0.0 )
3839 double areaThis = errorArea( thisZone, otherZone );
3841 double areaOther = errorArea( otherZone, thisZone );
3843 if( areaThis > areaOther )
3846 winningOverlaps[thisTemplate.
ID].insert( otherTemplate.
ID );
3851 winningOverlaps[otherTemplate.
ID].insert( thisTemplate.
ID );
3854 else if( thisZonePolyFill.
Area() > 0.0 )
3857 winningOverlaps[thisTemplate.
ID].insert( otherTemplate.
ID );
3859 else if( otherZonePolyFill.
Area() > 0.0 )
3862 winningOverlaps[otherTemplate.
ID].insert( thisTemplate.
ID );
3868 if( intersectionAreaOfZoneOutlines( thisZone, otherZone ) != 0 )
3871 winningOverlaps[otherTemplate.
ID].insert( thisTemplate.
ID );
3873 winningOverlaps[thisTemplate.
ID].insert( otherTemplate.
ID );
3882 std::set<TEMPLATE_ID> intersectingIDs;
3884 for(
const std::pair<
TEMPLATE_ID, std::set<TEMPLATE_ID>>& idPair : winningOverlaps )
3886 intersectingIDs.insert( idPair.first );
3887 intersectingIDs.insert( idPair.second.begin(), idPair.second.end() );
3891 std::vector<TEMPLATE_ID> sortedIDs;
3895 sortedIDs.push_back(
id );
3899 std::sort( sortedIDs.begin(), sortedIDs.end(), isLowerPriority );
3905 if( prevID.IsEmpty() )
3911 wxASSERT( !isLowerPriority(
id, prevID ) );
3913 int newPriority =
m_zonesMap.at( prevID )->GetAssignedPriority();
3916 if( isLowerPriority( prevID,
id ) )
3919 m_zonesMap.at(
id )->SetAssignedPriority( newPriority );
3924 for(
const std::pair<
TEMPLATE_ID, std::set<TEMPLATE_ID>>& idPair : winningOverlaps )
3928 for(
const TEMPLATE_ID& losingID : idPair.second )
3930 if(
m_zonesMap.at( losingID )->GetAssignedPriority()
3931 >
m_zonesMap.at( winningID )->GetAssignedPriority() )
3965 if( aCadstarNetID.IsEmpty() )
3971 return m_netMap.at( aCadstarNetID );
3978 wxString newName = csNet.
Name;
3980 if( csNet.
Name.IsEmpty() )
3982 if( csNet.
Pins.size() > 0 )
3986 NET_PCB::PIN firstPin = ( *csNet.
Pins.begin() ).second;
3989 newName = wxT(
"Net-(" );
3991 newName << wxT(
"-Pad" ) << wxString::Format( wxT(
"%ld" ), firstPin.PadID );
3992 newName << wxT(
")" );
3996 wxFAIL_MSG( wxT(
"A net with no pins associated?" ) );
3997 newName = wxT(
"csNet-" );
3998 newName << wxString::Format( wxT(
"%i" ), csNet.
SignalNum );
4005 wxLogMessage(
_(
"The CADSTAR design contains nets with a 'Net Class' assigned. KiCad "
4006 "does not have an equivalent to CADSTAR's Net Class so these elements "
4007 "were not imported. Note: KiCad's version of 'Net Class' is closer to "
4008 "CADSTAR's 'Net Route Code' (which has been imported for all nets)." ) );
4015 wxLogWarning(
_(
"The CADSTAR design contains nets with a 'Spacing Class' assigned. "
4016 "KiCad does not have an equivalent to CADSTAR's Spacing Class so "
4017 "these elements were not imported. Please review the design rules as "
4018 "copper pours will affected by this." ) );
4024 std::shared_ptr<NETCLASS> netclass;
4026 std::tuple<ROUTECODE_ID, NETCLASS_ID, SPACING_CLASS_ID> key = { csNet.
RouteCodeID,
4036 wxString netClassName;
4039 netClassName += wxT(
"Route code: " ) + rc.
Name;
4044 netClassName += wxT(
" | Net class: " ) + nc.
Name;
4050 netClassName += wxT(
" | Spacing class: " ) + sp.
Name;
4053 netclass.reset(
new NETCLASS( *netSettings->m_DefaultNetClass ) );
4054 netclass->SetName( netClassName );
4055 netSettings->m_NetClasses[ netClassName ] = netclass;
4062 std::make_unique<EDA_COMBINED_MATCHER>( newName,
CTX_NETCLASS ),
4068 m_netMap.insert( { aCadstarNetID, netInfo } );
4077 bool aDetectMaxLayer )
4080 return PCB_LAYER_ID::B_Cu;
4084 case 1:
return PCB_LAYER_ID::F_Cu;
4085 case 2:
return PCB_LAYER_ID::In1_Cu;
4086 case 3:
return PCB_LAYER_ID::In2_Cu;
4087 case 4:
return PCB_LAYER_ID::In3_Cu;
4088 case 5:
return PCB_LAYER_ID::In4_Cu;
4089 case 6:
return PCB_LAYER_ID::In5_Cu;
4090 case 7:
return PCB_LAYER_ID::In6_Cu;
4091 case 8:
return PCB_LAYER_ID::In7_Cu;
4092 case 9:
return PCB_LAYER_ID::In8_Cu;
4093 case 10:
return PCB_LAYER_ID::In9_Cu;
4094 case 11:
return PCB_LAYER_ID::In10_Cu;
4095 case 12:
return PCB_LAYER_ID::In11_Cu;
4096 case 13:
return PCB_LAYER_ID::In12_Cu;
4097 case 14:
return PCB_LAYER_ID::In13_Cu;
4098 case 15:
return PCB_LAYER_ID::In14_Cu;
4099 case 16:
return PCB_LAYER_ID::In15_Cu;
4100 case 17:
return PCB_LAYER_ID::In16_Cu;
4101 case 18:
return PCB_LAYER_ID::In17_Cu;
4102 case 19:
return PCB_LAYER_ID::In18_Cu;
4103 case 20:
return PCB_LAYER_ID::In19_Cu;
4104 case 21:
return PCB_LAYER_ID::In20_Cu;
4105 case 22:
return PCB_LAYER_ID::In21_Cu;
4106 case 23:
return PCB_LAYER_ID::In22_Cu;
4107 case 24:
return PCB_LAYER_ID::In23_Cu;
4108 case 25:
return PCB_LAYER_ID::In24_Cu;
4109 case 26:
return PCB_LAYER_ID::In25_Cu;
4110 case 27:
return PCB_LAYER_ID::In26_Cu;
4111 case 28:
return PCB_LAYER_ID::In27_Cu;
4112 case 29:
return PCB_LAYER_ID::In28_Cu;
4113 case 30:
return PCB_LAYER_ID::In29_Cu;
4114 case 31:
return PCB_LAYER_ID::In30_Cu;
4115 case 32:
return PCB_LAYER_ID::B_Cu;
4118 return PCB_LAYER_ID::UNDEFINED_LAYER;
4130 switch( layer.
Type )
4151 return PCB_LAYER_ID::UNDEFINED_LAYER;
4155 PCB_LAYER_ID::UNDEFINED_LAYER );
4168 return LSET( 4, PCB_LAYER_ID::Dwgs_User,
4169 PCB_LAYER_ID::Cmts_User,
4170 PCB_LAYER_ID::Eco1_User,
4171 PCB_LAYER_ID::Eco2_User )
4179 |
LSET( 4, PCB_LAYER_ID::Dwgs_User,
4180 PCB_LAYER_ID::Cmts_User,
4181 PCB_LAYER_ID::Eco1_User,
4182 PCB_LAYER_ID::Eco2_User )
4198 parentGroup->
AddItem( aKiCadItem );
4203 const wxString& aName )
4205 wxString groupName = aName;
4210 groupName = aName + wxT(
"_" ) + wxString::Format( wxT(
"%i" ), ++num );
4215 docSymGroup->
SetName( groupName );
4217 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 void FixTextPositionNoAlignment(EDA_TEXT *aKiCadTextItem, bool aInvertY=false)
Corrects the position of a text element that had NO_ALIGNMENT in CADSTAR.
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)
@ 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".