58 long long maxDesignSizekicad = std::numeric_limits<int>::max();
60 if( designSizeXkicad > maxDesignSizekicad || designSizeYkicad > maxDesignSizekicad )
63 _(
"The design is too large and cannot be imported into KiCad. \n" 64 "Please reduce the maximum design size in CADSTAR by navigating to: \n" 65 "Design Tab -> Properties -> Design Options -> Maximum Design Size. \n" 66 "Current Design size: %.2f, %.2f millimeters. \n" 67 "Maximum permitted design size: %.2f, %.2f millimeters.\n" ),
81 _(
"The selected file indicates that nets might be out of synchronisation " 82 "with the schematic. It is recommended that you carry out an 'Align Nets' " 83 "procedure in CADSTAR and re-import, to avoid inconsistencies between the " 84 "PCB and the schematic. " ) );
108 _(
"The CADSTAR design contains Trunk routing elements, which have no KiCad " 109 "equivalent. These elements were not loaded." ) );
115 _(
"The CADSTAR design contains variants which has no KiCad equivalent. Only " 116 "the variant '%s' was loaded." ),
123 _(
"The CADSTAR design contains re-use blocks which has no KiCad equivalent. The " 124 "re-use block information has been discarded during the import." ) );
128 _(
"The CADSTAR design has been imported successfully.\n" 129 "Please review the import errors and warnings (if any)." ) );
134 std::vector<FOOTPRINT*> retval;
136 for( std::pair<SYMDEF_ID, FOOTPRINT*> fpPair :
m_libraryMap )
138 retval.push_back( static_cast<FOOTPRINT*>( fpPair.second->Clone() ) );
146 const wxString& aCadstarLayerName,
152 _(
"The CADSTAR layer '%s' has no KiCad equivalent. All elements on this " 153 "layer have been mapped to KiCad layer '%s' instead." ),
154 aCadstarLayerName,
LSET::Name( aKiCadLayer ) ) );
165 _(
"The CADSTAR layer '%s' has been assumed to be a technical layer. All " 166 "elements on this layer have been mapped to KiCad layer '%s'." ),
167 aCadstarLayerName,
LSET::Name( aKiCadLayer ) ) );
174 int aDielectricSublayer )
197 LAYER_ID ElecLayerID = wxEmptyString;
200 std::vector<LAYER_ID> ConstructionLayers;
205 bool IsInitialised() {
return !ElecLayerID.IsEmpty() || ConstructionLayers.size() > 0; };
208 std::vector<LAYER_BLOCK> cadstarBoardStackup;
209 LAYER_BLOCK currentBlock;
220 if( currentBlock.IsInitialised() )
222 cadstarBoardStackup.push_back( currentBlock );
223 currentBlock = LAYER_BLOCK();
226 currentBlock.ElecLayerID = cadstarLayerID;
230 currentBlock.ConstructionLayers.push_back( cadstarLayerID );
234 if( currentBlock.IsInitialised() )
235 cadstarBoardStackup.push_back( currentBlock );
237 int totalCopperLayers = cadstarBoardStackup.size();
241 if( cadstarBoardStackup.back().ConstructionLayers.size() > 0 )
243 cadstarBoardStackup.push_back( LAYER_BLOCK() );
248 if( ( totalCopperLayers % 2 ) != 0 )
250 LAYER_BLOCK bottomLayer = cadstarBoardStackup.back();
251 cadstarBoardStackup.pop_back();
253 LAYER_BLOCK secondToLastLayer = cadstarBoardStackup.back();
254 cadstarBoardStackup.pop_back();
256 LAYER_BLOCK dummyLayer;
257 LAYER_ID lastConstruction = secondToLastLayer.ConstructionLayers.back();
259 if( secondToLastLayer.ConstructionLayers.size() > 1 )
262 secondToLastLayer.ConstructionLayers.pop_back();
271 dummyLayer.ConstructionLayers.push_back( lastConstruction );
272 cadstarBoardStackup.push_back( secondToLastLayer );
273 cadstarBoardStackup.push_back( dummyLayer );
274 cadstarBoardStackup.push_back( bottomLayer );
278 wxASSERT( totalCopperLayers == cadstarBoardStackup.size() );
279 wxASSERT( cadstarBoardStackup.back().ConstructionLayers.size() == 0 );
290 size_t stackIndex = 0;
296 LAYER_ID layerID = cadstarBoardStackup.at( stackIndex ).ElecLayerID;
298 if( layerID.IsEmpty() )
301 item->SetThickness( 0 );
309 switch( copperLayer.
Type )
325 wxFAIL_MSG(
"Unexpected Layer type. Was expecting an electrical type" );
331 m_layermap.insert( { copperLayer.
ID, item->GetBrdLayerId() } );
336 LAYER_BLOCK layerBlock = cadstarBoardStackup.at( stackIndex );
337 LAYER_BLOCK layerBlockBelow = cadstarBoardStackup.at( stackIndex + 1 );
340 wxASSERT( layerBlock.ConstructionLayers.size() > 0 );
342 int dielectricId = stackIndex + 1;
344 item->SetDielectricLayerId( dielectricId );
349 if( layerBlock.ElecLayerID.IsEmpty() )
358 if( layerBlockBelow.ElecLayerID.IsEmpty() )
369 LAYER copperLayerBelow =
387 int dielectricSublayer = 0;
389 for(
LAYER_ID constructionLaID : layerBlock.ConstructionLayers )
393 if( dielectricSublayer )
394 item->AddDielectricPrms( dielectricSublayer );
398 m_layermap.insert( { dielectricLayer.
ID, item->GetBrdLayerId() } );
399 ++dielectricSublayer;
406 int numElecAndPowerLayers = 0;
412 wxString layerName = curLayer.
Name.Lower();
424 if( numElecAndPowerLayers > 0 )
425 kicadLayerID = aBack;
427 kicadLayerID = aFront;
438 case LOG_LEVEL::WARN:
444 switch( curLayer.
Type )
453 _(
"Unexpected layer '%s' in layer stack." ), curLayer.
Name ) );
459 ++numElecAndPowerLayers;
483 if( layerName.Contains(
"glue" ) || layerName.Contains(
"adhesive" ) )
487 else if( layerName.Contains(
"silk" ) || layerName.Contains(
"legend" ) )
491 else if( layerName.Contains(
"assembly" ) || layerName.Contains(
"fabrication" ) )
495 else if( layerName.Contains(
"resist" ) || layerName.Contains(
"mask" ) )
499 else if( layerName.Contains(
"paste" ) )
530 wxFAIL_MSG(
"Unknown CADSTAR Layer Sub-type" );
536 wxFAIL_MSG(
"Unknown CADSTAR Layer Type" );
551 std::vector<INPUT_LAYER_DESC> inputLayers;
552 std::map<wxString, LAYER_ID> cadstarLayerNameMap;
554 for( std::pair<LAYER_ID, PCB_LAYER_ID> layerPair :
m_layermap )
572 inputLayers.push_back( iLdesc );
573 cadstarLayerNameMap.insert( { curLayer->
Name, curLayer->
ID } );
577 if( inputLayers.size() == 0 )
583 for( std::pair<wxString, PCB_LAYER_ID> layerPair : reMappedLayers )
587 wxFAIL_MSG(
"Unexpected Layer ID" );
591 LAYER_ID cadstarLayerID = cadstarLayerNameMap.at( layerPair.first );
592 m_layermap.at( cadstarLayerID ) = layerPair.second;
593 enabledLayers |=
LSET( layerPair.second );
607 [&]( wxString aID,
int* aVal )
609 if( spacingCodes.find( aID ) == spacingCodes.end() )
610 wxLogWarning(
_(
"Design rule %s was not found. This was ignored." ) );
627 auto applyNetClassRule = [&]( wxString aID,
NETCLASS* aNetClassPtr,
628 void (
NETCLASS::*aFunc )( int ) ) {
630 applyRule( aID, &value );
633 ( aNetClassPtr->*aFunc )( value );
640 wxLogWarning(
_(
"KiCad design rules are different from CADSTAR ones. Only the compatible " 641 "design rules were imported. It is recommended that you review the design " 642 "rules that have been applied." ) );
653 ( wxT(
" (" ) + component.
Alternate + wxT(
")" ) ) :
659 libID.
Parse( fpName,
true );
667 m_libraryMap.insert( std::make_pair( key, footprint ) );
675 for( std::pair<FIGURE_ID, FIGURE> figPair : aComponent.
Figures )
677 FIGURE& fig = figPair.second;
708 for( std::pair<COMP_AREA_ID, COMPONENT_AREA> areaPair : aComponent.
ComponentAreas )
739 libName << wxT(
" (" ) << aComponent.
Alternate << wxT(
")" );
743 "have a KiCad equivalent. The area is neither a via nor " 744 "route keepout area. The area was not imported." ),
745 area.
ID, libName ) );
754 for( std::pair<PAD_ID, COMPONENT_PAD> padPair : aComponent.
ComponentPads )
767 PAD* pad =
new PAD( aParent );
769 switch( aCadstarPad.
Side )
792 wxFAIL_MSG(
"Unknown Pad type" );
815 wxPoint padOffset = { 0, 0 };
816 wxPoint drillOffset = { 0, 0 };
855 pad->
SetSize( { sizeOfSquare, sizeOfSquare } );
912 wxFAIL_MSG(
"Unknown Pad Shape" );
952 if( lset.size() > 0 )
968 padShape->
Move( padOffset - drillOffset );
974 if( editedPadOutline.
Contains( { 0, 0 } ) )
977 pad->
SetSize( wxSize( { 4, 4 } ) );
980 padOffset = { 0, 0 };
987 drillOffset = { 0, 0 };
992 _(
"The CADSTAR pad definition '%s' has the hole shape outside the " 993 "pad shape. The hole has been moved to the center of the pad." ),
1003 wxFAIL_MSG(
"No copper layers defined in the pad?" );
1030 for( std::pair<GROUP_ID, GROUP> groupPair :
Layout.
Groups )
1032 GROUP& csGroup = groupPair.second;
1044 for( std::pair<GROUP_ID, GROUP> groupPair :
Layout.
Groups )
1046 GROUP& csGroup = groupPair.second;
1048 if( !csGroup.
GroupID.IsEmpty() )
1053 _(
"The file appears to be corrupt. Unable to find group ID %s " 1054 "in the group definitions." ),
1060 _(
"The file appears to be corrupt. Unable to find sub group %s " 1061 "in the group map (parent group ID=%s, Name=%s)." ),
1068 parentGroup->
AddItem( kiCadGroup );
1077 for( std::pair<BOARD_ID, CADSTAR_BOARD> boardPair :
Layout.
Boards )
1085 if( !board.
GroupID.IsEmpty() )
1097 for( std::pair<FIGURE_ID, FIGURE> figPair :
Layout.
Figures )
1099 FIGURE& fig = figPair.second;
1113 for( std::pair<TEXT_ID, TEXT> txtPair :
Layout.
Texts )
1115 TEXT& csTxt = txtPair.second;
1127 switch( csDim.
Type )
1129 case DIMENSION::TYPE::LINEARDIM:
1132 case DIMENSION::SUBTYPE::ANGLED:
1133 wxLogWarning(
wxString::Format(
_(
"Dimension ID %s is an angled dimension, which " 1134 "has no KiCad equivalent. An aligned dimension " 1135 "was loaded instead." ),
1138 case DIMENSION::SUBTYPE::DIRECT:
1139 case DIMENSION::SUBTYPE::ORTHOGONAL:
1141 if( csDim.
Line.
Style == DIMENSION::LINE::STYLE::EXTERNAL )
1144 _(
"Dimension ID %s has 'External' style in CADSTAR. External " 1145 "dimension styles are not yet supported in KiCad. The dimension " 1146 "object was imported with an internal dimension style instead." ),
1152 if( csDim.
Subtype == DIMENSION::SUBTYPE::ORTHOGONAL )
1176 VECTOR2I crossbarVector = crossbarEnd - crossbarStart;
1178 double height = 0.0;
1180 if( csDim.
Subtype == DIMENSION::SUBTYPE::ORTHOGONAL )
1183 height = heightVector.
y;
1185 height = heightVector.
x;
1189 double angle = crossbarVector.
Angle() + ( M_PI / 2 );
1190 height = heightVector.
x * cos(
angle ) + heightVector.
y * sin(
angle );
1201 _(
"Unexpected Dimension type (ID %s). This was not imported" ),
1207 case DIMENSION::TYPE::LEADERDIM:
1210 if( csDim.
Line.
Style == DIMENSION::LINE::STYLE::INTERNAL )
1314 wxPoint endPoint = csDim.
Line.
End + endOffset;
1334 case DIMENSION::TYPE::ANGLEDIM:
1337 _(
"Dimension ID %s is an angular dimension which has no KiCad equivalent. " 1338 "The object was not imported." ),
1348 for( std::pair<AREA_ID, AREA> areaPair :
Layout.
Areas )
1350 AREA& area = areaPair.second;
1377 _(
"The CADSTAR area '%s' is marked as a placement area in CADSTAR. " 1378 "Placement areas are not supported in KiCad. Only the supported " 1379 "elements for the area were imported." ),
1386 "Pure Placement areas are not supported." ),
1413 "(Symdef ID: '%s')" ),
1417 FOOTPRINT* libFootprint = fpIter->second;
1436 for( std::pair<PART_DEFINITION_PIN_ID, PART::DEFINITION::PIN> pinPair :
1439 PART::DEFINITION::PIN pin = pinPair.second;
1440 wxString pinName = pin.Name;
1442 if( pinName.empty() )
1443 pinName = pin.Identifier;
1445 if( pinName.empty() )
1448 footprint->
Pads().at( pin.ID - (
long long) 1 )->SetName( pinName );
1458 for( std::pair<PAD_ID, PADEXCEPTION> padPair : comp.
PadExceptions )
1463 if( !padEx.
PadCode.IsEmpty() )
1476 PAD* kiPad = footprint->
Pads().at( padEx.
ID - (
long long) 1 );
1477 wxString padName = kiPad->
GetName();
1484 footprint->
Pads().at( padEx.
ID - (
long long) 1 ) = kiPad;
1489 footprint->
SetValue( wxEmptyString );
1505 if( !comp.
PartID.IsEmpty() && comp.
PartID != wxT(
"NO_PART" ) )
1517 for( std::pair<DOCUMENTATION_SYMBOL_ID, DOCUMENTATION_SYMBOL> docPair :
1528 "library (Symdef ID: '%s')" ),
1532 SYMDEF_PCB& docSymDefinition = ( *docSymIter ).second;
1533 wxPoint moveVector =
1539 bool mirrorInvert = docSymInstance.
Mirror;
1544 if( !docSymDefinition.
Alternate.IsEmpty() )
1545 groupName += wxT(
" (" ) + docSymDefinition.
Alternate + wxT(
")" );
1553 for( std::pair<FIGURE_ID, FIGURE> figPair : docSymDefinition.
Figures )
1555 FIGURE fig = figPair.second;
1559 m_board, groupID, moveVector, rotationAngle, scalingFactor,
1560 centreOfTransform, mirrorInvert );
1564 for( std::pair<TEXT_ID, TEXT> textPair : docSymDefinition.
Texts )
1566 TEXT txt = textPair.second;
1568 rotationAngle, scalingFactor, centreOfTransform, mirrorInvert );
1578 TEMPLATE& csTemplate = tempPair.second;
1580 int zonelinethickness = 0;
1590 if( !( csTemplate.
NetID.IsEmpty() || csTemplate.
NetID == wxT(
"NONE" ) ) )
1596 _(
"The CADSTAR template '%s' has the setting 'Allow in No Routing Areas' " 1597 "enabled. This setting has no KiCad equivalent, so it has been ignored." ),
1598 csTemplate.
Name ) );
1604 _(
"The CADSTAR template '%s' has the setting 'Box Isolated Pins' " 1605 "enabled. This setting has no KiCad equivalent, so it has been ignored." ),
1606 csTemplate.
Name ) );
1612 _(
"The CADSTAR template '%s' has the setting 'Automatic Repour' " 1613 "enabled. This setting has no KiCad equivalent, so it has been ignored." ),
1614 csTemplate.
Name ) );
1623 _(
"The CADSTAR template '%s' has a non-zero value defined for the " 1624 "'Sliver Width' setting. There is no KiCad equivalent for " 1625 "this, so this setting was ignored." ),
1626 csTemplate.
Name ) );
1633 _(
"The CADSTAR template '%s' has different settings for 'Retain Poured Copper " 1634 "- Disjoint' and 'Retain Poured Copper - Isolated'. KiCad does not " 1635 "distinguish between these two settings. The setting for disjoint copper " 1636 "has been applied as the minimum island area of the KiCad Zone." ),
1637 csTemplate.
Name ) );
1640 long long minIslandArea = -1;
1676 if( csTemplate.
Pouring.
FillType == TEMPLATE::POURING::COPPER_FILL_TYPE::HATCHED )
1693 _(
"The CADSTAR template '%s' has different settings for thermal relief " 1694 "in pads and vias. KiCad only supports one single setting for both. The " 1695 "setting for pads has been applied." ),
1696 csTemplate.
Name ) );
1716 _(
"The CADSTAR template '%s' has thermal reliefs in the original design " 1717 "but there is no KiCad equivalent to the original CADSTAR settings. " 1718 "Solid fill has been applied instead. When the template is re-filled " 1719 "the thermal reliefs will be removed." ),
1720 csTemplate.
Name ) );
1737 NET_ID netid = wxEmptyString;
1739 for( std::pair<NET_ID, NET_PCB> netPair :
Layout.
Nets )
1743 if( net.
Name == powerPlaneLayerName )
1750 if( netid.IsEmpty() )
1753 _(
"The CADSTAR layer '%s' is defined as a power plane layer. However no " 1754 "net with such name exists. The layer has been loaded but no copper zone " 1756 powerPlaneLayerName ) );
1760 for( std::pair<BOARD_ID, CADSTAR_BOARD> boardPair :
Layout.
Boards )
1785 for( std::pair<COPPER_ID, COPPER> copPair :
Layout.
Coppers )
1787 COPPER& csCopper = copPair.second;
1802 std::vector<PCB_SHAPE*> outlineSegments =
1805 for(
auto& seg : outlineSegments )
1812 seg->GetEnd(), copperWidth, ARC_HIGH_DEF,
1828 rawPolys.
Inflate( copperWidth / 2, 32 );
1855 _(
"The CADSTAR design contains COPPER elements, which have no direct KiCad " 1856 "equivalent. These have been imported as a KiCad Zone if solid or hatch " 1857 "filled, or as a KiCad Track if the shape was an unfilled outline (open or " 1866 std::vector<PCB_SHAPE*> outlineSegments =
1879 std::vector<PCB_SHAPE*> cutoutSeg =
1922 fillePolys.
Fracture( SHAPE_POLY_SET::POLYGON_MODE::PM_STRICTLY_SIMPLE );
1933 for( std::pair<NET_ID, NET_PCB> netPair :
Layout.
Nets )
1936 wxString netnameForErrorReporting = net.
Name;
1938 if( netnameForErrorReporting.IsEmpty() )
1941 for( NET_PCB::CONNECTION_PCB connection : net.
Connections )
1943 if( !connection.Unrouted )
1949 for( std::pair<NETELEMENT_ID, NET_PCB::VIA> viaPair : net.
Vias )
1955 for( std::pair<NETELEMENT_ID, NET_PCB::PIN> pinPair : net.
Pins )
1957 NET_PCB::PIN pin = pinPair.second;
1960 if( footprint ==
nullptr )
1963 _(
"The net '%s' references component ID '%s' which does not exist. " 1964 "This has been ignored." ),
1965 netnameForErrorReporting, pin.ComponentID ) );
1967 else if( ( pin.PadID - (
long) 1 ) > footprint->
Pads().size() )
1969 wxLogWarning(
wxString::Format(
_(
"The net '%s' references non-existent pad index" 1970 " '%d' in component '%s'. This has been ignored." ),
1971 netnameForErrorReporting,
1988 auto findAndReplaceTextField =
2027 wxString varValue = txtvalue.second;
2029 txtVars.insert( { varName, varValue } );
2034 wxString varName = txtvalue.first;
2035 wxString varValue = txtvalue.second;
2037 txtVars.insert( { varName, varValue } );
2042 wxLogError(
_(
"Text Variables could not be set as there is no project loaded." ) );
2050 for( std::pair<ATTRIBUTE_ID, ATTRIBUTE_VALUE> attrPair : aComponent.
AttributeValues )
2061 for( std::pair<ATTRIBUTE_ID, TEXT_LOCATION> textlocPair : aComponent.
TextLocations )
2068 attrval = wxEmptyString;
2072 attrval = wxT(
"${REFERENCE}" );
2087 const NET_ID& aCadstarNetID,
const NET_PCB::ROUTE& aCadstarRoute )
2089 std::vector<PCB_SHAPE*> shapes;
2091 POINT prevEnd = aCadstarRoute.StartPoint;
2093 for(
const NET_PCB::ROUTE_VERTEX& v : aCadstarRoute.RouteVertices )
2098 shapes.push_back( shape );
2099 prevEnd = v.Vertex.End;
2103 std::vector<TRACK*> tracks =
2127 _(
"The CADSTAR via code '%s' has different shape from a circle defined. " 2128 "KiCad only supports circular vias so this via type has been changed to " 2129 "be a via with circular shape of %.2f mm diameter." ),
2135 bool start_layer_outside =
2138 bool end_layer_outside =
2142 if( start_layer_outside && end_layer_outside )
2146 else if( ( !start_layer_outside ) && ( !end_layer_outside ) )
2164 const LAYER_ID& aCadstarLayerOverride,
const wxPoint& aMoveVector,
2165 const double& aRotationAngle,
const double& aScalingFactor,
const wxPoint& aTransformCentre,
2166 const bool& aMirrorInvert )
2169 aContainer->
Add( txt );
2173 RotatePoint( &rotatedTextPos, aTransformCentre, aRotationAngle );
2175 KiROUND( (
double) ( rotatedTextPos.x - aTransformCentre.x ) * aScalingFactor );
2177 KiROUND( (
double) ( rotatedTextPos.y - aTransformCentre.y ) * aScalingFactor );
2178 rotatedTextPos += aTransformCentre;
2184 if( aCadstarText.
Mirror != aMirrorInvert )
2193 wxSize unscaledTextSize;
2198 if( unscaledTextSize.x == 0 )
2253 wxFAIL_MSG(
"Unknown Aligment - needs review!" );
2258 txt->
Flip( aTransformCentre,
true );
2262 if( aScalingFactor != 1.0 )
2264 wxSize scaledTextSize;
2265 scaledTextSize.x =
KiROUND( (
double) unscaledTextSize.x * aScalingFactor );
2266 scaledTextSize.y =
KiROUND( (
double) unscaledTextSize.y * aScalingFactor );
2272 txt->
Move( aMoveVector );
2277 LAYER_ID layersToDrawOn = aCadstarLayerOverride;
2279 if( layersToDrawOn.IsEmpty() )
2280 layersToDrawOn = aCadstarText.
LayerID;
2292 newtxt = static_cast<PCB_TEXT*>( txt->
Duplicate() );
2295 if( !aCadstarGroupID.IsEmpty() )
2306 if( !aCadstarGroupID.IsEmpty() )
2315 const int& aLineThickness,
2316 const wxString& aShapeName,
2319 const wxPoint& aMoveVector,
2320 const double& aRotationAngle,
2321 const double& aScalingFactor,
2322 const wxPoint& aTransformCentre,
2323 const bool& aMirrorInvert )
2325 switch( aCadstarShape.
Type )
2331 aContainer, aCadstarGroupID, aMoveVector, aRotationAngle, aScalingFactor,
2332 aTransformCentre, aMirrorInvert );
2334 aContainer, aCadstarGroupID, aMoveVector, aRotationAngle, aScalingFactor,
2335 aTransformCentre, aMirrorInvert );
2341 _(
"The shape for '%s' is Hatch filled in CADSTAR, which has no KiCad equivalent. " 2342 "Using solid fill instead." ),
2362 aCadstarShape, -1, aContainer, aMoveVector, aRotationAngle, aScalingFactor,
2363 aTransformCentre, aMirrorInvert );
2365 shapePolys.
Fracture( SHAPE_POLY_SET::POLYGON_MODE::PM_STRICTLY_SIMPLE );
2372 if( !aCadstarGroupID.IsEmpty() )
2382 const int& aLineThickness,
2385 const wxPoint& aMoveVector,
2386 const double& aRotationAngle,
2387 const double& aScalingFactor,
2388 const wxPoint& aTransformCentre,
2389 const bool& aMirrorInvert )
2391 for(
CUTOUT cutout : aCutouts )
2394 aCadstarGroupID, aMoveVector, aRotationAngle, aScalingFactor,
2395 aTransformCentre, aMirrorInvert );
2401 const std::vector<VERTEX>& aCadstarVertices,
const PCB_LAYER_ID& aKiCadLayer,
2403 const GROUP_ID& aCadstarGroupID,
const wxPoint& aMoveVector,
const double& aRotationAngle,
2404 const double& aScalingFactor,
const wxPoint& aTransformCentre,
const bool& aMirrorInvert )
2406 std::vector<PCB_SHAPE*> drawSegments =
2408 aRotationAngle, aScalingFactor, aTransformCentre, aMirrorInvert );
2412 ds->SetWidth( aLineThickness );
2413 ds->SetLayer( aKiCadLayer );
2414 ds->SetParent( aContainer );
2422 const GROUP_ID& aCadstarGroupID,
const wxPoint& aMoveVector,
const double& aRotationAngle,
2423 const double& aScalingFactor,
const wxPoint& aTransformCentre,
const bool& aMirrorInvert )
2425 std::vector<PCB_SHAPE*> drawSegments;
2427 if( aCadstarVertices.size() < 2 )
2429 return drawSegments;
2431 const VERTEX* prev = &aCadstarVertices.at( 0 );
2434 for(
size_t i = 1; i < aCadstarVertices.size(); i++ )
2436 cur = &aCadstarVertices.at( i );
2437 drawSegments.push_back(
2439 aRotationAngle, aScalingFactor, aTransformCentre, aMirrorInvert ) );
2443 return drawSegments;
2448 const VERTEX& aCadstarVertex,
2451 const wxPoint& aMoveVector,
2452 const double& aRotationAngle,
2453 const double& aScalingFactor,
2454 const wxPoint& aTransformCentre,
2455 const bool& aMirrorInvert )
2459 double arcStartAngle, arcEndAngle, arcAngle;
2463 wxPoint centerPoint;
2467 centerPoint = ( startPoint + endPoint ) / 2;
2471 switch( aCadstarVertex.
Type )
2513 arcAngle = arcEndAngle - arcStartAngle;
2527 ds->
Flip( aTransformCentre,
true );
2529 if( aScalingFactor != 1.0 )
2531 ds->
Move( -aTransformCentre );
2532 ds->
Scale( aScalingFactor );
2533 ds->
Move( aTransformCentre );
2536 if( aRotationAngle != 0.0 )
2537 ds->
Rotate( aTransformCentre, aRotationAngle );
2539 if( aMoveVector != wxPoint{ 0, 0 } )
2540 ds->
Move( aMoveVector );
2543 static_cast<FP_SHAPE*>( ds )->SetLocalCoord();
2545 if( !aCadstarGroupID.IsEmpty() )
2553 const int& aLineThickness,
2572 for(
int i = 0; i < polygon.
HoleCount( 0 ); i++ )
2580 const int& aLineThickness,
2582 const wxPoint& aMoveVector,
2583 const double& aRotationAngle,
2584 const double& aScalingFactor,
2585 const wxPoint& aTransformCentre,
2586 const bool& aMirrorInvert )
2591 aContainer, noGroup,
2607 aContainer, noGroup,
2621 if( aLineThickness > 0 )
2622 polySet.
Inflate( aLineThickness / 2, 32, SHAPE_POLY_SET::CORNER_STRATEGY::ROUND_ALL_CORNERS );
2629 for(
int j = 0; j < polySet.
HoleCount( i ); ++j )
2646 switch( ds->GetShape() )
2650 if( ds->GetClass() == wxT(
"MGRAPHIC" ) )
2658 SHAPE_ARC arc( ds->GetCenter(), ds->GetArcStart(), (double) ds->GetAngle() / 10.0 );
2664 if( ds->GetClass() == wxT(
"MGRAPHIC" ) )
2672 lineChain.
Append( ds->GetStartX(), ds->GetStartY() );
2673 lineChain.
Append( ds->GetEndX(), ds->GetEndY() );
2678 wxFAIL_MSG(
"Drawsegment type is unexpected. Ignored." );
2698 const std::vector<PCB_SHAPE*> aDrawsegments,
2701 int aWidthOverride )
2703 std::vector<TRACK*> tracks;
2709 switch( ds->GetShape() )
2712 if( ds->GetClass() == wxT(
"MGRAPHIC" ) )
2716 track =
new ARC( aParentContainer, &arc );
2720 SHAPE_ARC arc( ds->GetCenter(), ds->GetArcStart(), (double) ds->GetAngle() / 10.0 );
2721 track =
new ARC( aParentContainer, &arc );
2725 if( ds->GetClass() == wxT(
"MGRAPHIC" ) )
2728 track =
new TRACK( aParentContainer );
2734 track =
new TRACK( aParentContainer );
2736 track->
SetEnd( ds->GetEnd() );
2741 wxFAIL_MSG(
"Drawsegment type is unexpected. Ignored." );
2745 if( aWidthOverride == -1 )
2755 if( aNet !=
nullptr )
2758 tracks.push_back( track );
2769 const wxString& aAttributeValue )
2782 aFootprint->
SetValue( aAttributeValue );
2783 txt = &aFootprint->
Value();
2787 txt =
new FP_TEXT( aFootprint );
2788 aFootprint->
Add( txt );
2789 txt->
SetText( aAttributeValue );
2802 aFootprint->
SetValue( aAttributeValue );
2803 txt = &aFootprint->
Value();
2808 txt =
new FP_TEXT( aFootprint );
2809 aFootprint->
Add( txt );
2810 txt->
SetText( aAttributeValue );
2819 txt->
SetPos0( rotatedTextPos );
2825 if( aCadstarAttrLoc.
Mirror )
2837 if( txtSize.x == 0 )
2895 wxFAIL_MSG(
"Unknown Aligment - needs review!" );
2978 const std::map<ATTRIBUTE_ID, ATTRIBUTE_VALUE>& aCadstarAttributeMap )
2980 wxCHECK( aCadstarAttributeMap.find( aCadstarAttributeID ) != aCadstarAttributeMap.end(),
2983 return aCadstarAttributeMap.at( aCadstarAttributeID ).Value;
2988 const PART_ID& aCadstarPartID )
3024 if( hcode.
Hatches.size() < 1 )
3037 if( hcode.
Hatches.size() < 1 )
3049 if( hcode.
Hatches.size() < 1 )
3074 if( hcode.
Hatches.size() != 2 )
3077 _(
"The CADSTAR Hatching code '%s' has %d hatches defined. " 3078 "KiCad only supports 2 hatches (crosshatching) 90 degrees apart. " 3079 "The imported hatching is crosshatched." ),
3084 if( hcode.
Hatches.at( 0 ).LineWidth != hcode.
Hatches.at( 1 ).LineWidth )
3087 _(
"The CADSTAR Hatching code '%s' has different line widths for each " 3088 "hatch. KiCad only supports one width for the haching. The imported " 3089 "hatching uses the width defined in the first hatch definition, i.e. " 3099 _(
"The CADSTAR Hatching code '%s' has different step sizes for each " 3100 "hatch. KiCad only supports one step size for the haching. The imported " 3101 "hatching uses the step size defined in the first hatching definition, " 3108 if( abs( hcode.
Hatches.at( 0 ).OrientAngle - hcode.
Hatches.at( 1 ).OrientAngle )
3112 _(
"The hatches in CADSTAR Hatching code '%s' have an angle " 3113 "difference of %.1f degrees. KiCad only supports hatching 90 " 3114 "degrees apart. The imported hatching has two hatches 90 " 3115 "degrees apart, oriented %.1f degrees from horizontal." ),
3118 - hcode.
Hatches.at( 1 ).OrientAngle ) ),
3147 wxString prefix = wxEmptyString;
3148 wxString suffix = wxEmptyString;
3149 size_t startpos = aCadstarDim.
Text.
Text.Find( wxT(
"<@DISTANCE" ) );
3151 if( startpos != wxNOT_FOUND )
3154 wxString remainingStr = aCadstarDim.
Text.
Text.Mid( startpos );
3155 size_t endpos = remainingStr.Find(
"@>" );
3159 if( suffix.StartsWith(
"mm" ) )
3162 suffix = suffix.Mid( 2 );
3180 switch( dimensionUnits )
3186 "is not supported in KiCad. Milimetres were " 3187 "applied instead." ),
3203 wxFAIL_MSG(
"We should have handled design units before coming here!" );
3211 std::map<TEMPLATE_ID, std::set<TEMPLATE_ID>> winningOverlaps;
3212 std::set<std::pair<TEMPLATE_ID, TEMPLATE_ID>> scheduleInferPriorityFromOutline;
3221 return intersectShape.Area();
3227 return winningOverlaps[b].count( a ) > 0;
3230 for( std::map<TEMPLATE_ID, ZONE*>::iterator it1 =
m_zonesMap.begin();
3235 ZONE* thisZone = it1->second;
3237 for( std::map<TEMPLATE_ID, ZONE*>::iterator it2 = it1;
3242 ZONE* otherZone = it2->second;
3244 if( thisTemplate.
ID == otherTemplate.
ID )
3247 if( thisLayer != otherLayer )
3253 if( thisZonePolyFill.
Area() > 0.0 && otherZonePolyFill.
Area() > 0.0 )
3256 double areaThis = intersectionArea( thisZonePolyFill, otherZone );
3258 double areaOther = intersectionArea( otherZonePolyFill, thisZone );
3265 if( areaThis > areaOther )
3267 winningOverlaps[thisTemplate.
ID].insert( otherTemplate.
ID );
3269 else if( areaOther > 0.0 )
3271 winningOverlaps[otherTemplate.
ID].insert( thisTemplate.
ID );
3275 scheduleInferPriorityFromOutline.insert(
3276 { thisTemplate.
ID, otherTemplate.
ID } );
3283 scheduleInferPriorityFromOutline.insert( { thisTemplate.
ID, otherTemplate.
ID } );
3289 std::set<TEMPLATE_ID> intersectingIDs;
3291 for(
const std::pair<
TEMPLATE_ID, std::set<TEMPLATE_ID>>& idPair : winningOverlaps )
3293 intersectingIDs.insert( idPair.first );
3294 intersectingIDs.insert( idPair.second.begin(), idPair.second.end() );
3298 std::vector<TEMPLATE_ID> sortedIDs;
3302 sortedIDs.push_back(
id );
3306 std::sort( sortedIDs.begin(), sortedIDs.end(), isLowerPriority );
3312 if( prevID.IsEmpty() )
3318 wxASSERT( !isLowerPriority(
id, prevID ) );
3320 int newPriority =
m_zonesMap.at( prevID )->GetPriority();
3323 if( isLowerPriority( prevID,
id ) )
3326 m_zonesMap.at(
id )->SetPriority( newPriority );
3362 if( aCadstarNetID.IsEmpty() )
3366 return m_netMap.at( aCadstarNetID );
3373 wxString newName = csNet.Name;
3375 if( csNet.Name.IsEmpty() )
3377 if( csNet.Pins.size() > 0 )
3381 NET_PCB::PIN firstPin = ( *csNet.Pins.begin() ).second;
3384 newName = wxT(
"Net-(" );
3390 wxFAIL_MSG(
"A net with no pins associated?" );
3391 newName = wxT(
"csNet-" );
3397 && csNet.NetClassID != wxT(
"NONE" ) )
3400 _(
"The CADSTAR design contains nets with a 'Net Class' assigned. KiCad does " 3401 "not have an equivalent to CADSTAR's Net Class so these elements were not " 3402 "imported. Note: KiCad's version of 'Net Class' is closer to CADSTAR's " 3403 "'Net Route Code' (which has been imported for all nets)." ) );
3408 && csNet.SpacingClassID != wxT(
"NONE" ) )
3410 wxLogWarning(
_(
"The CADSTAR design contains nets with a 'Spacing Class' assigned. " 3411 "KiCad does not have an equivalent to CADSTAR's Spacing Class so " 3412 "these elements were not imported. Please review the design rules as " 3413 "copper pours will affected by this." ) );
3422 NETCLASSPTR netclass =
m_netClassMap.at( csNet.RouteCodeID );
3434 m_netMap.insert( { aCadstarNetID, netInfo } );
3494 switch( layer.Type )
3529 switch( layer.
Type )
3553 parentGroup->AddItem( aKiCadItem );
3558 const wxString& aName )
3560 wxString groupName = aName;
3570 docSymGroup->
SetName( groupName );
3572 m_groupMap.insert( { groupID, docSymGroup } );
void SetMirrored(bool isMirrored)
static LSET UserDefinedLayers()
Return a mask with all of the allowable user defined layers.
static LSET AllCuMask(int aCuLayerCount=MAX_CU_LAYERS)
Return a mask holding the requested number of Cu PCB_LAYER_IDs.
std::vector< VERTEX > Vertices
COPPERCODE getCopperCode(const COPPERCODE_ID &aCadstaCopperCodeID)
COMPONENT_ID VariantParentComponentID
int getKiCadLength(long long aCadstarLength)
LAYER_ID LayerID
Move all objects in the Symdef to this layer.
bool AddItem(BOARD_ITEM *aItem)
Add item to group.
void addAttribute(const ATTRIBUTE_LOCATION &aCadstarAttrLoc, const ATTRIBUTE_ID &aCadstarAttributeID, FOOTPRINT *aFootprint, const wxString &aAttributeValue)
Adds a CADSTAR Attribute to a KiCad footprint.
int getKiCadHatchCodeGap(const HATCHCODE_ID &aCadstarHatchcodeID)
virtual void Add(BOARD_ITEM *aItem, ADD_MODE aMode=ADD_MODE::INSERT)=0
Adds an item to the container.
void SetIslandRemovalMode(ISLAND_REMOVAL_MODE aRemove)
void SetOffset(const wxPoint &aOffset)
virtual std::map< wxString, wxString > & GetTextVars() const
std::map< ROUTECODE_ID, ROUTECODE > RouteCodes
void SetHatchThickness(int aThickness)
T NormalizeAngleNeg(T Angle)
Normalize angle to be in the 0.0 .
POURING Pouring
Copper pour settings (e.g. relief / hatching /etc.)
PADCODE_ID PadCode
If not empty, override padcode.
bool HasFilledPolysForLayer(PCB_LAYER_ID aLayer) const
Inbuilt layer type (cannot be assigned to user layers)
int OutlineCount() const
Return the number of vertices in a given outline/hole.
Inbuilt layer type (cannot be assigned to user layers)
Inbuilt layer type (cannot be assigned to user layers)
long LeaderAngle
Only for TYPE=LEADERLINE subnode "LEADERANG".
void SetZoneName(const wxString &aName)
bool ThermalReliefOnVias
false when subnode "NOVIARELIEF" is present
static const double TXT_HEIGHT_RATIO
CADSTAR fonts are drawn on a 24x24 integer matrix, where the each axis goes from 0 to 24.
NETINFO_ITEM * getKiCadNet(const NET_ID &aCadstarNetID)
Searches m_netMap and returns the NETINFO_ITEM pointer if exists.
Container for project specific data.
std::map< PART_DEFINITION_PIN_ID, PIN > Pins
std::map< NETELEMENT_ID, PIN > Pins
void SetDoNotAllowTracks(bool aEnable)
std::pair< POINT, POINT > DesignArea
virtual void SetStart(const wxPoint &aPoint)
COPPERCODE_ID CopperCodeID
From CADSTAR Help: "Copper Code is for selecting the width of the line used to draw the outline and f...
SHAPE_POLY_SET & GetPolyShape()
double getAngleDegrees(const long long &aCadstarAngle)
long Offset
Offset from the measurement point.
wxString ReferenceName
This is the name which identifies the symbol in the library Multiple components may exist with the sa...
bool m_LegacyNetclassesLoaded
True if netclasses were loaded from the file.
ZONE * getZoneFromCadstarShape(const SHAPE &aCadstarShape, const int &aLineThickness, BOARD_ITEM_CONTAINER *aParentContainer)
virtual void SetPosition(const wxPoint &aPos) override
std::vector< HATCH > Hatches
long SignalNum
This is undefined if the net has been given a name.
std::map< COMPONENT_ID, FOOTPRINT * > m_componentMap
Map between Cadstar and KiCad components on the board.
void BooleanAdd(const SHAPE_POLY_SET &b, POLYGON_MODE aFastMode)
Perform boolean polyset difference For aFastMode meaning, see function booleanOp.
this class manage the layers needed to make a physical board they are solder mask,...
void SetPosition(const wxPoint &aPoint) override
std::map< ATTRIBUTE_ID, ATTRNAME > AttributeNames
bool NoVias
From CADSTAR Help: "Check this button to specify that any area created by the Rectangle,...
void Flip(const wxPoint &aCentre, bool aFlipLeftRight) override
Flip this object, i.e.
virtual void SetLayer(PCB_LAYER_ID aLayer)
Set the layer this item is on.
double getAngleTenthDegree(const long long &aCadstarAngle)
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
long ScaleRatioNumerator
Documentation symbols can be arbitrarily scaled when added to a design.
void SetEnd(const wxPoint &aEnd)
void Scale(double aScale)
void SetHatchStyle(ZONE_BORDER_DISPLAY_STYLE aStyle)
TEXT_FIELD_NAME
These are speccial fields in text objects enclosed between the tokens '<@' and '>' such as <@[FIELD_N...
void drawCadstarShape(const SHAPE &aCadstarShape, const PCB_LAYER_ID &aKiCadLayer, const int &aLineThickness, const wxString &aShapeName, BOARD_ITEM_CONTAINER *aContainer, const GROUP_ID &aCadstarGroupID=wxEmptyString, const wxPoint &aMoveVector={ 0, 0 }, const double &aRotationAngle=0.0, const double &aScalingFactor=1.0, const wxPoint &aTransformCentre={ 0, 0 }, const bool &aMirrorInvert=false)
void SetThermalSpokeWidth(int aWidth)
Set the width of the thermal spokes connecting the pad to a zone.
std::map< COMP_AREA_ID, COMPONENT_AREA > ComponentAreas
std::map< VARIANT_ID, VARIANT > Variants
void SetTextAngle(double aAngle) override
A set of BOARD_ITEMs (i.e., without duplicates).
std::map< LINECODE_ID, LINECODE > LineCodes
void loadNetTracks(const NET_ID &aCadstarNetID, const NET_PCB::ROUTE &aCadstarRoute)
void SetFilled(bool aFlag)
wxString getAttributeValue(const ATTRIBUTE_ID &aCadstarAttributeID, const std::map< ATTRIBUTE_ID, ATTRIBUTE_VALUE > &aCadstarAttributeMap)
LAYER_MAPPING_HANDLER m_layerMappingHandler
Callback to get layer mapping.
EXTENSION_LINE ExtensionLineParams
Not applicable to TYPE=LEADERDIM.
void SetTextAngle(double aAngle) override
void SetLayerSet(LSET aLayerSet) override
COPPERCODE_ID CopperCodeID
SHAPE_POLY_SET * Outline()
void SetLayer(PCB_LAYER_ID aLayer) override
Set the layer this item is on.
std::map< AREA_ID, AREA > Areas
#define COMPONENT_NAME_2_ATTRID
Component Name 2 Attribute ID - typically used for indicating the placement of designators in placeme...
bool BoxIsolatedPins
true when subnode "BOXPINS" is present
wxPoint m_designCenter
Used for calculating the required offset to apply to the Cadstar design so that it fits in KiCad canv...
bool NoTracks
From CADSTAR Help: "Check this button to specify that any area created by the Rectangle,...
Filled closed shape (hatch fill).
void SetAnchorPadShape(PAD_SHAPE_T aShape)
Set the shape of the anchor pad for custom shaped pads.
Smd pad, appears on the solder paste layer (default)
virtual const wxPoint & GetStart() const
The dimension's origin is the first feature point for the dimension.
void SetTextPos(const wxPoint &aPoint)
PCB_GROUP * getKiCadGroup(const GROUP_ID &aCadstarGroupID)
LAYERPAIR getLayerPair(const LAYERPAIR_ID &aCadstarLayerPairID)
polygon (not yet used for tracks, but could be in microwave apps)
PHYSICAL_LAYER_ID PhysicalLayerStart
void SetVisible(bool aVisible)
void SetName(const wxString &aName)
Set the pad name (sometimes called pad number, although it can be an array reference like AA12).
void SetUnitsFormat(const DIM_UNITS_FORMAT aFormat)
std::map< FIGURE_ID, FIGURE > Figures
void SetPrefix(const wxString &aPrefix)
double GetTextAngle() const
void SetCopperLayerCount(int aCount)
std::map< TRUNK_ID, TRUNK > Trunks
long ScaleRatioDenominator
Documentation symbols can be arbitrarily scaled when added to a design.
void remapUnsureLayers()
Callback m_layerMappingHandler for layers we aren't sure of.
SHAPE_LINE_CHAIN & Hole(int aOutline, int aHole)
Return the aIndex-th subpolygon in the set.
const wxPoint & GetStart0() const
usual segment : line with rounded ends
double Area()
Appends a vertex at the end of the given outline/hole (default: the last outline)
std::map< COPPERCODE_ID, COPPERCODE > CopperCodes
std::map< MATERIAL_ID, MATERIAL > Materials
std::vector< CONNECTION_PCB > Connections
#define COMPONENT_NAME_ATTRID
Component Name Attribute ID - typically used for placement of designators on silk screen.
bool m_doneSpacingClassWarning
Used by getKiCadNet() to avoid multiple duplicate warnings.
std::map< SYMDEF_ID, FOOTPRINT * > m_libraryMap
Map between Cadstar and KiCad components in the library.
wxString Name
Designator e.g. "C1", "R1", etc.
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
std::map< VIACODE_ID, VIACODE > ViaCodes
ROUTECODE getRouteCode(const ROUTECODE_ID &aCadstarRouteCodeID)
#define KI_FALLTHROUGH
The KI_FALLTHROUGH macro is to be used when switch statement cases should purposely fallthrough from ...
From CADSTAR Help: "Area is for creating areas within which, and nowhere else, certain operations are...
const SHAPE_POLY_SET & GetFilledPolysList(PCB_LAYER_ID aLayer) const
Function GetFilledPolysList returns a reference to the list of filled polygons.
bool HasLocation
Flag to know if this ATTRIBUTE_VALUE has a location i.e.
STYLE Style
Subnode="DIMLINETYPE".
long MinIsolatedCopper
The value is the length of one side of a notional square.
const SHAPE_LINE_CHAIN & CHole(int aOutline, int aHole) const
LSET GetEnabledLayers() const
A proxy function that calls the corresponding function in m_BoardSettings Returns a bit-mask of all t...
ALIGNMENT Alignment
In CADSTAR The default alignment for a TEXT object (when "(No Alignment()" is selected) Bottom Left o...
void checkAndLogHatchCode(const HATCHCODE_ID &aCadstarHatchcodeID)
void SetTextSize(const wxSize &aNewSize)
std::set< HATCHCODE_ID > m_hatchcodesTested
Used by checkAndLogHatchCode() to avoid multiple duplicate warnings.
virtual void SetLocked(bool aLocked)
Modify the 'lock' status for of the item.
void SetSize(const wxSize &aSize)
void loadComponentAttributes(const COMPONENT &aComponent, FOOTPRINT *aFootprint)
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.
void loadDocumentationSymbols()
bool SetLayerType(PCB_LAYER_ID aLayer, LAYER_T aLayerType)
Change the type of the layer given by aLayer.
void NORMALIZE_ANGLE_180(T &Angle)
std::map< TEXT_ID, TEXT > Texts
void RotatePoint(int *pX, int *pY, double angle)
VARIANT_HIERARCHY VariantHierarchy
LAYER_ID LayerID
ID on which to draw this [param1].
void Inflate(int aAmount, int aCircleSegmentsCount, CORNER_STRATEGY aCornerStrategy=ROUND_ALL_CORNERS)
Perform outline inflation/deflation.
like PAD_PTH, but not plated mechanical use only, no connection allowed
void loadNetVia(const NET_ID &aCadstarNetID, const NET_PCB::VIA &aCadstarVia)
A logical library item identifier and consists of various portions much like a URI.
bool Routing
From CADSTAR Help: "Area can be used to place routes during Automatic Routing.
std::map< wxString, wxString > FilenamesToTextMap
CADSTAR doesn't have user defined text fields but does allow loading text from a file.
void logBoardStackupWarning(const wxString &aCadstarLayerName, const PCB_LAYER_ID &aKiCadLayer)
virtual void Rotate(const wxPoint &aRotCentre, double aAngle) override
Rotate this object.
std::map< LAYER_ID, LAYER > Layers
void loadLibraryPads(const SYMDEF_PCB &aComponent, FOOTPRINT *aFootprint)
int PointCount() const
Function PointCount()
LSEQ Seq(const PCB_LAYER_ID *aWishListSequence, unsigned aCount) const
Return an LSEQ from the union of this LSET and a desired sequence.
void SetPriority(unsigned aPriority)
Function SetPriority.
std::map< LAYERPAIR_ID, LAYERPAIR > LayerPairs
Default vias to use between pairs of layers.
void SetFillMode(ZONE_FILL_MODE aFillMode)
long Thickness
Note: Units of length are defined in file header.
POINT Origin
Origin of the component (this is used as the reference point when placing the component in the design...
long MaxPhysicalLayer
Should equal number of copper layers.
std::map< TEMPLATE_ID, TEMPLATE > Templates
wxString Name
This name can be different to the PART name.
ALIGNMENT Alignment
In CADSTAR The default alignment for a TEXT object (when "(No Alignment()" is selected) Bottom Left o...
void Append(int aX, int aY, bool aAllowDuplication=false)
Function Append()
UNITS Units
Units to display for linear dimensions.
void SetWidth(int aWidth)
wxString HatchCodeID
Only Applicable for HATCHED Type.
std::vector< FOOTPRINT * > GetLoadedLibraryFootpints() const
Return a copy of the loaded library footprints (caller owns the objects)
void SetIsRuleArea(bool aEnable)
ATTRIBUTE_LOCATION AttributeLocation
std::set< TEXT_FIELD_NAME > InconsistentTextFields
Text fields need to be updated in CADSTAR and it is possible that they are not consistent accross tex...
void SetExtensionHeight(int aHeight)
From CADSTAR Help: "Area is for creating areas within which, and nowhere else, certain operations are...
long ReliefWidth
if undefined inherits from design
void TransformOvalToPolygon(SHAPE_POLY_SET &aCornerBuffer, wxPoint aStart, wxPoint aEnd, int aWidth, int aError, ERROR_LOC aErrorLoc)
convert a oblong shape to a polygon, using multiple segments It is similar to TransformRoundedEndsSeg...
void applyDimensionSettings(const DIMENSION &aCadstarDim, DIMENSION_BASE *aKiCadDim)
int GetLineThickness(PCB_LAYER_ID aLayer) const
Return the default graphic segment thickness from the layer class for the given layer.
A shape of copper in the component footprint.
std::map< NET_ID, NET_PCB > Nets
Contains tracks and vias.
void drawCadstarText(const TEXT &aCadstarText, BOARD_ITEM_CONTAINER *aContainer, const GROUP_ID &aCadstarGroupID=wxEmptyString, const LAYER_ID &aCadstarLayerOverride=wxEmptyString, const wxPoint &aMoveVector={ 0, 0 }, const double &aRotationAngle=0.0, const double &aScalingFactor=1.0, const wxPoint &aTransformCentre={ 0, 0 }, const bool &aMirrorInvert=false)
virtual void Move(const wxPoint &aMoveVector) override
Move this object.
std::map< GROUP_ID, PCB_GROUP * > m_groupMap
Map between Cadstar and KiCad groups.
void SetText(const wxString &aNewText)
Sets the override text - has no effect if m_overrideValue == false.
void drawCadstarVerticesAsSegments(const std::vector< VERTEX > &aCadstarVertices, const PCB_LAYER_ID &aKiCadLayer, const int &aLineThickness, BOARD_ITEM_CONTAINER *aContainer, const GROUP_ID &aCadstarGroupID=wxEmptyString, const wxPoint &aMoveVector={ 0, 0 }, const double &aRotationAngle=0.0, const double &aScalingFactor=1.0, const wxPoint &aTransformCentre={ 0, 0 }, const bool &aMirrorInvert=false)
Uses PCB_SHAPE to draw the vertices on m_board object.
void Add(BOARD_ITEM *aItem, ADD_MODE aMode=ADD_MODE::INSERT) override
Adds an item to the container.
void Parse()
Parses the file.
void SetLayerName(const wxString &aName)
void SetClosed(bool aClosed)
Function SetClosed()
long UnitDisplPrecision
Number of decimal points to display for linear dimensions.
BOARD_STACKUP & GetStackupDescriptor()
void loadLibraryAreas(const SYMDEF_PCB &aComponent, FOOTPRINT *aFootprint)
PCB_LAYER_ID
A quick note on layer IDs:
PAD * getKiCadPad(const COMPONENT_PAD &aCadstarPad, FOOTPRINT *aParent)
bool m_doneNetClassWarning
Used by getKiCadNet() to avoid multiple duplicate warnings.
void SetHeight(int aHeight)
Sets the distance from the feature points to the crossbar line.
Inherits from design units (assumed Assignments->Technology->Units)
LSET is a set of PCB_LAYER_IDs.
pads are covered by copper
Represents a point in x,y coordinates.
virtual void SetText(const wxString &aText)
PART getPart(const PART_ID &aCadstarPartID)
void SetHatchGap(int aStep)
void SetPos0(const wxPoint &aPos)
void SetShape(PCB_SHAPE_TYPE_T aShape)
long ThermalReliefPadsAngle
Orientation for the thermal reliefs. Disabled when !ThermalReliefOnPads (param5)
PAD_SIDE Side
See PAD_SIDE.
void initStackupItem(const LAYER &aCadstarLayer, BOARD_STACKUP_ITEM *aKiCadItem, int aDielectricSublayer)
bool AllowInNoRouting
true when subnode "IGNORETRN" is present
static const wxChar * Name(PCB_LAYER_ID aLayerId)
Return the fixed name association with aLayerId.
HATCHCODE_ID HatchCodeID
Only for FillType = HATCHED.
A leader is a dimension-like object pointing to a specific point.
void SetThermalGap(int aGap)
std::map< PAD_ID, COMPONENT_PAD > ComponentPads
void SetDoNotAllowPads(bool aEnable)
void loadLibraryCoppers(const SYMDEF_PCB &aComponent, FOOTPRINT *aFootprint)
void SetClearance(int aClearance)
Represent a set of closed polygons.
std::map< PART_ID, PART > PartDefinitions
DIMENSION_ID ID
Some ID (doesn't seem to be used) subnode="DIMREF".
constexpr double PCB_IU_PER_MM
void SetVisibleLayers(LSET aLayerMask)
A proxy function that calls the correspondent function in m_BoardSettings changes the bit-mask of vis...
SHAPE_LINE_CHAIN & Outline(int aIndex)
bool Placement
From CADSTAR Help: "Auto Placement can place components within this area.
bool isFootprint(BOARD_ITEM_CONTAINER *aContainer)
GROUP_ID GroupID
If not empty, this GROUP is part of another GROUP.
long Precision
Number of decimal points to display in the measurement [param3].
LINECODE_ID LineCodeID
param0
long LeaderLineLength
Only for TYPE=LEADERLINE Length of the angled part of the leader line [param5].
long Width
Defaults to 0 if using system fonts or, if using CADSTAR font, default to equal height (1:1 aspect ra...
Inbuilt layer type (cannot be assigned to user layers)
Loads a cpa file into a KiCad BOARD object.
std::set< PADCODE_ID > m_padcodesTested
Used by getKiCadPad() to avoid multiple duplicate warnings.
void SetVertJustify(EDA_TEXT_VJUSTIFY_T aType)
PCB_LAYER_ID getKiCadCopperLayerID(unsigned int aLayerNum, bool aDetectMaxLayer=true)
TECHNOLOGY_SECTION Technology
std::map< PADCODE_ID, PADCODE > PadCodes
void SetDrillSize(const wxSize &aSize)
The highest PHYSICAL_LAYER_ID currently defined (i.e.
A collection of nets and the parameters used to route or test these nets.
SHAPE_LINE_CHAIN getLineChainFromDrawsegments(const std::vector< PCB_SHAPE * > aDrawSegments)
Returns a SHAPE_LINE_CHAIN object from a series of PCB_SHAPE objects.
bool SetLayerName(PCB_LAYER_ID aLayer, const wxString &aLayerName)
Changes the name of the layer given by aLayer.
bool ThermalReliefOnPads
false when subnode "NOPINRELIEF" is present
std::map< SYMDEF_ID, SYMDEF_PCB > ComponentDefinitions
An orthogonal dimension is like an aligned dimension, but the extension lines are locked to the X or ...
const wxString & GetName() const
double getPolarAngle(wxPoint aPoint)
std::vector< COMPONENT_COPPER > ComponentCoppers
static LSET PTHMask()
layer set for a through hole pad
virtual void SetEnd(const wxPoint &aPoint)
void SetDoNotAllowVias(bool aEnable)
SYMDEF_ID SymdefID
Normally documentation symbols only have TEXT, FIGURE and TEXT_LOCATION objects which are all drawn o...
static LSET AllLayersMask()
void SetLayerPair(PCB_LAYER_ID aTopLayer, PCB_LAYER_ID aBottomLayer)
Function SetLayerPair For a via m_layer contains the top layer, the other layer is in m_bottomLayer.
void SetMaterial(const wxString &aName, int aDielectricSubLayer=0)
ZONE handles a list of polygons defining a copper zone.
LSET GetLayerSet() const override
Return a std::bitset of all layers on which the item physically resides.
int getKiCadHatchCodeThickness(const HATCHCODE_ID &aCadstarHatchcodeID)
void Load(BOARD *aBoard, PROJECT *aProject)
Loads a CADSTAR PCB Archive file into the KiCad BOARD object given.
void SetExtensionOffset(int aOffset)
void SetMinThickness(int aMinThickness)
int m_CopperEdgeClearance
void SetCenter(const wxPoint &aCenterPoint)
For arcs and circles:
void SetIsFilled(bool isFilled)
static void FixTextPositionNoAlignment(EDA_TEXT *aKiCadTextItem)
Corrects the position of a text element that had NO_ALIGNMENT in CADSTAR.
std::map< TEMPLATE_ID, ZONE * > m_zonesMap
Map between Cadstar and KiCad zones.
wxString Identifier
This is an identifier that is displayed to the user.
All physical layers currently defined.
bool AutomaticRepour
true when subnode "REGENERATE" is present
double Angle() const
Compute the angle of the vector.
void SetShape(PAD_SHAPE_T aShape)
Set the new shape of this pad.
PHYSICAL_LAYER_ID 1 (i.e.
void SetSuffix(const wxString &aSuffix)
std::map< FIGURE_ID, FIGURE > Figures
void BooleanIntersection(const SHAPE_POLY_SET &b, POLYGON_MODE aFastMode)
Perform boolean polyset union between a and b, store the result in it self For aFastMode meaning,...
wxString getAttributeName(const ATTRIBUTE_ID &aCadstarAttributeID)
this class manage one layer needed to make a physical board it can be a solder mask,...
int HoleCount(int aOutline) const
Return the reference to aIndex-th outline in the set.
void SetRoundRectRadiusRatio(double aRadiusScale)
Has meaning only for rounded rectangle pads.
POINT Origin
Origin of the component (this is used as the reference point when placing the component in the design...
GROUP_ID GroupID
If not empty, this CADSTAR_BOARD is part of a group.
std::map< REUSEBLOCK_ID, REUSEBLOCK > ReuseBlocks
void SetOrientation(DIR aOrientation)
Sets the orientation of the dimension line (so, perpendicular to the feature lines)
static const long UNDEFINED_VALUE
Corresponds to CADSTAR "origin".
virtual const VECTOR2I GetPoint(int aIndex) const override
void Fracture(POLYGON_MODE aFastMode)
Convert a single outline slitted ("fractured") polygon into a set ouf outlines with holes.
int AddHole(const SHAPE_LINE_CHAIN &aHole, int aOutline=-1)
Return the area of this poly set.
LSEQ is a sequence (and therefore also a set) of PCB_LAYER_IDs.
std::vector< VERTEX > Vertices
< Nodename = "VARIANT" or "VMASTER" (master variant
void SetEpsilonR(double aEpsilon, int aDielectricSubLayer=0)
void SetDrillShape(PAD_DRILL_SHAPE_T aShape)
void SetPos0(const wxPoint &aPos)
void SetFilledPolysList(PCB_LAYER_ID aLayer, const SHAPE_POLY_SET &aPolysList)
Function SetFilledPolysList sets the list of filled polygons.
void SetThickness(int aThickness, int aDielectricSubLayer=0)
void SetRoundRectCornerRadius(double aRadius)
Has meaning only for rounded rectangle pads.
void loadComponentLibrary()
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, const CPTREE &aTree)
Output a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
std::vector< LAYER_ID > LayerStack
std::map< SPACINGCODE_ID, SPACINGCODE > SpacingCodes
Spacing Design Rules.
void SetChamferPositions(int aPositions)
Has meaning only for chamfered rectangular pads.
PADCODE getPadCode(const PADCODE_ID &aCadstarPadCodeID)
std::map< PAD_ID, PADEXCEPTION > PadExceptions
Override pad definitions for this instance.
TEXTCODE getTextCode(const TEXTCODE_ID &aCadstarTextCodeID)
Use thermal relief for pads.
void SetKeepUpright(bool aKeepUpright)
bool Keepout
From CADSTAR Help: "Auto Placement cannot place components within this area.
int getLineThickness(const LINECODE_ID &aCadstarLineCodeID)
void TransformShapeWithClearanceToPolygon(SHAPE_POLY_SET &aCornerBuffer, PCB_LAYER_ID aLayer, int aClearanceValue, int aMaxError, ERROR_LOC aErrorLoc, bool ignoreLineWidth=false) const override
Convert the pad shape to a closed polygon.
void Move(const wxPoint &aMoveVector) override
Move this object.
Handle the data for a net.
std::vector< CUTOUT > Cutouts
Not Applicable to OPENSHAPE Type.
int Parse(const UTF8 &aId, bool aFix=false)
Parse LIB_ID with the information from aId.
void SetPadConnection(ZONE_CONNECTION aPadConnection)
std::map< TEXTCODE_ID, TEXTCODE > TextCodes
void SetLayerSet(LSET aLayers) override
TEMPLATE_ID PouredTemplateID
If not empty, it means this COPPER is part of a poured template.
PAD_EXITS Exits
See PAD_EXITS.
void SetMinIslandArea(long long int aArea)
PCB_SHAPE * getDrawSegmentFromVertex(const POINT &aCadstarStartPoint, const VERTEX &aCadstarVertex, BOARD_ITEM_CONTAINER *aContainer=nullptr, const GROUP_ID &aCadstarGroupID=wxEmptyString, const wxPoint &aMoveVector={ 0, 0 }, const double &aRotationAngle=0.0, const double &aScalingFactor=1.0, const wxPoint &aTransformCentre={ 0, 0 }, const bool &aMirrorInvert=false)
Returns a pointer to a PCB_SHAPE object.
void SetNet(NETINFO_ITEM *aNetInfo)
Set a NET_INFO object for the item.
void RemoveAll()
Delete all items in list and clear the list.
std::map< NETELEMENT_ID, VIA > Vias
Inbuilt layer type (cannot be assigned to user layers)
std::map< DIMENSION_ID, DIMENSION > Dimensions
bool NoTracks
From CADSTAR Help: "Area cannot be used to place routes during automatic routing.
double DEG2RAD(double deg)
void SetStart(const wxPoint &aStart)
std::map< NET_ID, NETINFO_ITEM * > m_netMap
Map between Cadstar and KiCad Nets.
Information pertinent to a Pcbnew printed circuit board.
wxString Name
This is undefined (wxEmptyString) if the net is unnamed.
void SetHorizJustify(EDA_TEXT_HJUSTIFY_T aType)
bool m_logLayerWarnings
Used in loadBoardStackup()
void SetDoNotAllowCopperPour(bool aEnable)
GROUP_ID createUniqueGroupID(const wxString &aName)
Adds a new PCB_GROUP* to m_groupMap.
void SetPrecision(int aPrecision)
bool m_doneCopperWarning
Used by loadCoppers() to avoid multiple duplicate warnings.
const SHAPE_LINE_CHAIN & COutline(int aIndex) const
std::map< COPPER_ID, COPPER > Coppers
T NormalizeAnglePos(T Angle)
Normalize angle to be in the 0.0 .
PCB_LAYER_ID getKiCadLayer(const LAYER_ID &aCadstarLayerID)
std::map< HATCHCODE_ID, HATCHCODE > HatchCodes
static DIRECTION_45::AngleType angle(const VECTOR2I &a, const VECTOR2I &b)
void SetPosition(const wxPoint &aPos) override
void addToGroup(const GROUP_ID &aCadstarGroupID, BOARD_ITEM *aKiCadItem)
long SliverWidth
Minimum width of copper that may be created.
void drawCadstarCutoutsAsSegments(const std::vector< CUTOUT > &aCutouts, const PCB_LAYER_ID &aKiCadLayer, const int &aLineThickness, BOARD_ITEM_CONTAINER *aContainer, const GROUP_ID &aCadstarGroupID=wxEmptyString, const wxPoint &aMoveVector={ 0, 0 }, const double &aRotationAngle=0.0, const double &aScalingFactor=1.0, const wxPoint &aTransformCentre={ 0, 0 }, const bool &aMirrorInvert=false)
Uses PCB_SHAPE to draw the cutouts on m_board object.
void loadLibraryFigures(const SYMDEF_PCB &aComponent, FOOTPRINT *aFootprint)
void SetDrill(int aDrill)
Function SetDrill sets the drill value for vias.
NETCLASS * GetDefault() const
const wxPoint & GetEnd0() const
void AddPrimitive(PCB_SHAPE *aPrimitive)
Add item to the custom shape primitives list.
void SetWidth(int aWidth)