266 bool aClosed,
bool aInFill )
const
268 std::vector<std::unique_ptr<PCB_SHAPE>> results;
271 for(
int i = 0; i < polyData.size(); i++ )
273 nlohmann::json val = polyData.at( i );
275 if( val.is_string() )
278 if( str == wxS(
"CIRCLE" ) )
281 center.x = ( polyData.at( ++i ) );
282 center.y = ( polyData.at( ++i ) );
283 double r = ( polyData.at( ++i ) );
285 std::unique_ptr<PCB_SHAPE> shape =
290 shape->SetFilled( aClosed );
292 results.emplace_back( std::move( shape ) );
294 else if( str == wxS(
"R" ) )
297 start.
x = ( polyData.at( ++i ) );
298 start.
y = ( polyData.at( ++i ) );
299 size.
x = ( polyData.at( ++i ) );
300 size.
y = -( polyData.at( ++i ).get<double>() );
301 double angle = polyData.at( ++i );
302 double cr = ( i + 1 ) < polyData.size() ? polyData.at( ++i ).get<
double>() : 0;
306 std::unique_ptr<PCB_SHAPE> shape =
309 shape->SetStart(
ScalePos( start ) );
310 shape->SetEnd(
ScalePos( start + size ) );
311 shape->SetFilled( aClosed );
314 results.emplace_back( std::move( shape ) );
322 std::unique_ptr<PCB_SHAPE> shape =
325 shape->SetStart(
ScalePos( aStart ) );
327 shape->SetFilled( aClosed );
330 results.emplace_back( std::move( shape ) );
335 std::unique_ptr<PCB_SHAPE> shape =
336 std::make_unique<PCB_SHAPE>( aContainer,
SHAPE_T::ARC );
338 shape->SetStart(
ScalePos( aStart ) );
341 shape->SetFilled( aClosed );
344 results.emplace_back( std::move( shape ) );
352 addArc( {
end.x - cr, start.
y }, {
end.x, start.
y - cr },
353 {
end.x - cr, start.
y - cr } );
356 {
end.x - cr,
end.y + cr } );
358 addArc( { start.
x + cr,
end.y }, { start.
x,
end.y + cr },
359 { start.
x + cr,
end.y + cr } );
361 addArc( { start.
x, start.
y - cr }, { start.
x + cr, start.
y },
362 { start.
x + cr, start.
y - cr } );
365 else if( str == wxS(
"ARC" ) || str == wxS(
"CARC" ) )
368 double angle = polyData.at( ++i ).get<
double>() / ( aInFill ? 10 : 1 );
369 end.x = ( polyData.at( ++i ) );
370 end.y = ( polyData.at( ++i ) );
372 std::unique_ptr<PCB_SHAPE> shape =
373 std::make_unique<PCB_SHAPE>( aContainer,
SHAPE_T::ARC );
377 shape->SetStart(
ScalePos( prevPt ) );
383 shape->SetEnd(
ScalePos( prevPt ) );
389 double ha = angle / 2;
390 double hd =
delta.EuclideanNorm() / 2;
391 double cdist = hd / tan(
DEG2RAD( ha ) );
395 shape->SetFilled( aClosed );
397 results.emplace_back( std::move( shape ) );
401 else if( str == wxS(
"L" ) )
406 while( i < polyData.size() - 2 && polyData.at( i + 1 ).is_number() )
409 pt.
x = ( polyData.at( ++i ) );
410 pt.
y = ( polyData.at( ++i ) );
419 std::unique_ptr<PCB_SHAPE> shape =
422 wxASSERT(
chain.PointCount() > 2 );
424 if(
chain.PointCount() > 2 )
426 chain.SetClosed(
true );
427 shape->SetFilled(
true );
428 shape->SetPolyShape(
chain );
430 results.emplace_back( std::move( shape ) );
435 for(
int s = 0; s <
chain.SegmentCount(); s++ )
439 std::unique_ptr<PCB_SHAPE> shape =
442 shape->SetStart( seg.
A );
443 shape->SetEnd( seg.
B );
445 results.emplace_back( std::move( shape ) );
450 else if( val.is_number() )
452 prevPt.
x = ( polyData.at( i ) );
453 prevPt.
y = ( polyData.at( ++i ) );
744 const wxString& aFpUuid,
745 const std::vector<nlohmann::json>& aLines )
747 std::unique_ptr<FOOTPRINT> footprintPtr = std::make_unique<FOOTPRINT>(
m_board );
748 FOOTPRINT* footprint = footprintPtr.get();
751 const int defaultTextThickness(
pcbIUScale.mmToIU( 0.15 ) );
755 field->SetTextSize( defaultTextSize );
756 field->SetTextThickness( defaultTextThickness );
759 for(
const nlohmann::json& line : aLines )
761 if( line.size() == 0 )
764 wxString type = line.at( 0 );
766 if( type == wxS(
"POLY" ) || type == wxS(
"PAD" ) || type == wxS(
"FILL" )
767 || type == wxS(
"ATTR" ) )
769 wxString uuid = line.at( 1 );
776 wxString netname = line.at( 3 );
777 int layer = line.at( 4 ).get<
int>();
780 if( type == wxS(
"POLY" ) )
782 double thickness = ( line.at( 5 ) );
783 nlohmann::json polyData = line.at( 6 );
785 std::vector<std::unique_ptr<PCB_SHAPE>> results =
786 ParsePoly( footprint, polyData,
false,
false );
788 for(
auto& shape : results )
790 shape->SetLayer( klayer );
791 shape->SetWidth(
ScaleSize( thickness ) );
796 else if( type == wxS(
"PAD" ) )
798 std::unique_ptr<PAD>
pad =
createPAD( footprint, line );
802 else if( type == wxS(
"FILL" ) )
804 int layer = line.at( 4 ).get<
int>();
807 double width = line.at( 5 );
809 nlohmann::json polyDataList = line.at( 7 );
811 if( !polyDataList.is_null() && !polyDataList.empty() )
813 if( !polyDataList.at( 0 ).is_array() )
814 polyDataList = nlohmann::json::array( { polyDataList } );
816 std::vector<SHAPE_LINE_CHAIN> contours;
817 for( nlohmann::json& polyData : polyDataList )
822 contours.push_back( contour );
832 std::unique_ptr<PCB_GROUP>
group;
835 group = std::make_unique<PCB_GROUP>( footprint );
841 std::unique_ptr<PCB_SHAPE> shape =
844 shape->SetFilled(
true );
845 shape->SetPolyShape( poly );
846 shape->SetLayer( klayer );
847 shape->SetWidth( 0 );
850 group->AddItem( shape.get() );
859 else if( type == wxS(
"ATTR" ) )
863 if( attr.
key == wxS(
"Designator" ) )
867 else if( type == wxS(
"REGION" ) )
869 wxString uuid = line.at( 1 );
876 int layer = line.at( 3 ).get<
int>();
879 double width = line.at( 4 );
880 std::set<int> flags = line.at( 5 );
881 nlohmann::json polyDataList = line.at( 6 );
883 for( nlohmann::json& polyData : polyDataList )
887 std::vector<std::unique_ptr<PCB_SHAPE>> results =
888 ParsePoly(
nullptr, polyData,
true,
false );
890 for(
auto& shape : results )
892 shape->SetFilled(
true );
899 std::unique_ptr<ZONE> zone = std::make_unique<ZONE>( footprint );
901 zone->SetIsRuleArea(
true );
902 zone->SetDoNotAllowFootprints( !!flags.count( 2 ) );
903 zone->SetDoNotAllowZoneFills( !!flags.count( 7 ) || !!flags.count( 6 )
904 || !!flags.count( 8 ) );
905 zone->SetDoNotAllowPads( !!flags.count( 7 ) );
906 zone->SetDoNotAllowTracks( !!flags.count( 7 ) || !!flags.count( 5 ) );
907 zone->SetDoNotAllowVias( !!flags.count( 7 ) );
909 zone->SetLayer( klayer );
910 zone->Outline()->Append( polySet );
917 if( aProject.is_object() && aProject.contains(
"devices" ) )
919 std::map<wxString, EASYEDAPRO::PRJ_DEVICE> devicesMap = aProject.at(
"devices" );
920 std::map<wxString, wxString> compAttrs;
922 for(
auto& [devUuid, devData] : devicesMap )
924 if(
auto fp =
get_opt( devData.attributes,
"Footprint" ) )
928 compAttrs = devData.attributes;
934 wxString modelUuid, modelTitle, modelTransform;
936 modelUuid =
get_def( compAttrs,
"3D Model",
"" );
937 modelTitle =
get_def( compAttrs,
"3D Model Title", modelUuid );
938 modelTransform =
get_def( compAttrs,
"3D Model Transform",
"" );
944 std::vector<PCB_SHAPE*> edgeShapes;
949 edgeShapes.push_back(
static_cast<PCB_SHAPE*
>( item ) );
960 std::unique_ptr<PCB_SHAPE> shape =
966 shape->SetEnd( bbox.
GetEnd() );
971 bool hasFabRef =
false;
977 if(
static_cast<PCB_TEXT*
>( item )->GetText() == wxT(
"${REFERENCE}" ) )
989 int c_refTextThickness =
pcbIUScale.mmToIU( 0.1 );
990 std::unique_ptr<PCB_TEXT> refText = std::make_unique<PCB_TEXT>( footprint );
992 refText->SetLayer(
F_Fab );
993 refText->SetTextSize(
VECTOR2I( c_refTextSize, c_refTextSize ) );
994 refText->SetTextThickness( c_refTextThickness );
995 refText->SetText( wxT(
"${REFERENCE}" ) );
1000 return footprintPtr.release();
1005 BOARD* aBoard,
const nlohmann::json& aProject,
1006 std::map<wxString, std::unique_ptr<FOOTPRINT>>& aFootprintMap,
1007 const std::map<wxString, EASYEDAPRO::BLOB>& aBlobMap,
1008 const std::multimap<wxString, EASYEDAPRO::POURED>& aPouredMap,
1009 const std::vector<nlohmann::json>& aLines,
const wxString& aFpLibName )
1011 std::map<wxString, std::vector<nlohmann::json>> componentLines;
1012 std::map<wxString, std::vector<nlohmann::json>> ruleLines;
1014 std::multimap<wxString, EASYEDAPRO::POURED> boardPouredMap = aPouredMap;
1015 std::map<wxString, ZONE*> poursToFill;
1019 for(
const nlohmann::json& line : aLines )
1021 if( line.size() == 0 )
1024 wxString type = line.at( 0 );
1026 if( type == wxS(
"LAYER" ) )
1028 int layer = line.at( 1 );
1031 wxString layerType = line.at( 2 );
1032 wxString layerName = line.at( 3 );
1033 int layerFlag = line.at( 4 );
1035 if( layerFlag != 0 )
1038 blayers.
set( klayer );
1043 else if( type == wxS(
"NET" ) )
1045 wxString netname = line.at( 1 );
1050 else if( type == wxS(
"RULE" ) )
1052 wxString ruleType = line.at( 1 );
1053 wxString ruleName = line.at( 2 );
1054 int isDefault = line.at( 3 );
1055 nlohmann::json ruleData = line.at( 4 );
1057 if( ruleType == wxS(
"3" ) && isDefault )
1059 wxString units = ruleData.at( 0 );
1060 double minVal = ruleData.at( 1 );
1061 double optVal = ruleData.at( 2 );
1062 double maxVal = ruleData.at( 3 );
1066 else if( ruleType == wxS(
"1" ) && isDefault )
1068 wxString units = ruleData.at( 0 );
1069 nlohmann::json
table = ruleData.at( 1 );
1071 int minVal = INT_MAX;
1072 for(
const std::vector<int>& arr :
table )
1074 for(
int val : arr )
1084 ruleLines[ruleType].push_back( line );
1086 else if( type == wxS(
"POURED" ) )
1088 if( !line.at( 2 ).is_string() )
1092 boardPouredMap.emplace( poured.
parentId, poured );
1094 else if( type == wxS(
"VIA" ) || type == wxS(
"LINE" ) || type == wxS(
"ARC" )
1095 || type == wxS(
"POLY" ) || type == wxS(
"FILL" ) || type == wxS(
"POUR" ) )
1097 wxString uuid = line.at( 1 );
1104 wxString netname = line.at( 3 );
1106 if( type == wxS(
"VIA" ) )
1112 double drill = line.at( 7 );
1113 double dia = line.at( 8 );
1115 std::unique_ptr<PCB_VIA>
via = std::make_unique<PCB_VIA>( aBoard );
1125 else if( type == wxS(
"LINE" ) )
1127 int layer = line.at( 4 ).get<
int>();
1131 start.
x = line.at( 5 );
1132 start.
y = line.at( 6 );
1135 end.x = line.at( 7 );
1136 end.y = line.at( 8 );
1138 double width = line.at( 9 );
1140 std::unique_ptr<PCB_TRACK> track = std::make_unique<PCB_TRACK>( aBoard );
1142 track->SetLayer( klayer );
1143 track->SetStart(
ScalePos( start ) );
1147 track->SetNet( aBoard->
FindNet( netname ) );
1151 else if( type == wxS(
"ARC" ) )
1153 int layer = line.at( 4 ).get<
int>();
1157 start.
x = line.at( 5 );
1158 start.
y = line.at( 6 );
1161 end.x = line.at( 7 );
1162 end.y = line.at( 8 );
1164 double angle = line.at( 9 );
1165 double width = line.at( 10 );
1170 double ha = angle / 2;
1171 double hd =
delta.EuclideanNorm() / 2;
1172 double cdist = hd / tan(
DEG2RAD( ha ) );
1179 std::unique_ptr<PCB_ARC> arc = std::make_unique<PCB_ARC>( aBoard, &sarc );
1182 arc->SetLayer( klayer );
1183 arc->SetNet( aBoard->
FindNet( netname ) );
1187 else if( type == wxS(
"FILL" ) )
1189 int layer = line.at( 4 ).get<
int>();
1192 double width = line.at( 5 );
1194 nlohmann::json polyDataList = line.at( 7 );
1196 if( !polyDataList.at( 0 ).is_array() )
1197 polyDataList = nlohmann::json::array( { polyDataList } );
1199 std::vector<SHAPE_LINE_CHAIN> contours;
1200 for( nlohmann::json& polyData : polyDataList )
1205 contours.push_back( contour );
1216 std::unique_ptr<ZONE> zone = std::make_unique<ZONE>( aBoard );
1218 zone->SetNet( aBoard->
FindNet( netname ) );
1219 zone->SetLayer( klayer );
1221 zone->SetFilledPolysList( klayer, zoneFillPoly );
1222 zone->SetAssignedPriority( 500 );
1223 zone->SetIsFilled(
true );
1224 zone->SetNeedRefill(
false );
1231 else if( type == wxS(
"POLY" ) )
1233 int layer = line.at( 4 );
1236 double thickness = line.at( 5 );
1237 nlohmann::json polyData = line.at( 6 );
1239 std::vector<std::unique_ptr<PCB_SHAPE>> results =
1240 ParsePoly( aBoard, polyData,
false,
false );
1242 for(
auto& shape : results )
1244 shape->SetLayer( klayer );
1245 shape->SetWidth(
ScaleSize( thickness ) );
1250 else if( type == wxS(
"POUR" ) )
1252 int layer = line.at( 4 ).get<
int>();
1255 double lineWidth = line.at( 5 );
1256 wxString pourname = line.at( 6 );
1257 int fillOrder = line.at( 7 ).get<
int>();
1258 nlohmann::json polyDataList = line.at( 8 );
1260 std::unique_ptr<ZONE> zone = std::make_unique<ZONE>( aBoard );
1262 zone->SetNet( aBoard->
FindNet( netname ) );
1263 zone->SetLayer( klayer );
1264 zone->SetAssignedPriority( 500 - fillOrder );
1268 for( nlohmann::json& polyData : polyDataList )
1273 zone->Outline()->Append( contour );
1276 wxASSERT( zone->Outline()->OutlineCount() == 1 );
1278 poursToFill.emplace( uuid, zone.get() );
1283 else if( type == wxS(
"TEARDROP" ) )
1285 wxString uuid = line.at( 1 );
1286 wxString netname = line.at( 2 );
1287 int layer = line.at( 3 ).get<
int>();
1290 nlohmann::json polyData = line.at( 4 );
1295 std::unique_ptr<ZONE> zone = std::make_unique<ZONE>( aBoard );
1297 zone->SetNet( aBoard->
FindNet( netname ) );
1298 zone->SetLayer( klayer );
1299 zone->Outline()->Append( contour );
1300 zone->SetFilledPolysList( klayer, contour );
1301 zone->SetNeedRefill(
false );
1302 zone->SetIsFilled(
true );
1304 zone->SetAssignedPriority( 600 );
1305 zone->SetLocalClearance( 0 );
1306 zone->SetMinThickness( 0 );
1311 else if( type == wxS(
"REGION" ) )
1313 wxString uuid = line.at( 1 );
1320 int layer = line.at( 3 ).get<
int>();
1323 double width = line.at( 4 );
1324 std::set<int> flags = line.at( 5 );
1325 nlohmann::json polyDataList = line.at( 6 );
1327 for( nlohmann::json& polyData : polyDataList )
1332 std::unique_ptr<ZONE> zone = std::make_unique<ZONE>( aBoard );
1334 zone->SetIsRuleArea(
true );
1335 zone->SetDoNotAllowFootprints( !!flags.count( 2 ) );
1336 zone->SetDoNotAllowZoneFills( !!flags.count( 7 ) || !!flags.count( 6 )
1337 || !!flags.count( 8 ) );
1338 zone->SetDoNotAllowPads( !!flags.count( 7 ) );
1339 zone->SetDoNotAllowTracks( !!flags.count( 7 ) || !!flags.count( 5 ) );
1340 zone->SetDoNotAllowVias( !!flags.count( 7 ) );
1342 zone->SetLayer( klayer );
1343 zone->Outline()->Append( contour );
1348 else if( type == wxS(
"PAD" ) )
1350 wxString netname = line.at( 3 );
1352 std::unique_ptr<FOOTPRINT> footprint = std::make_unique<FOOTPRINT>( aBoard );
1353 std::unique_ptr<PAD>
pad =
createPAD( footprint.get(), line );
1364 footprint->SetPosition( pos );
1365 footprint->SetOrientation( orient );
1367 wxString fpName = wxS(
"Pad_" ) + line.at( 1 ).get<wxString>();
1370 footprint->SetFPID( fpID );
1371 footprint->Reference().SetVisible(
true );
1372 footprint->Value().SetVisible(
true );
1373 footprint->AutoPositionFields();
1377 else if( type == wxS(
"IMAGE" ) )
1379 wxString uuid = line.at( 1 );
1386 int layer = line.at( 3 ).get<
int>();
1389 VECTOR2D start( line.at( 4 ), line.at( 5 ) );
1390 VECTOR2D size( line.at( 6 ), line.at( 7 ) );
1392 double angle = line.at( 8 );
1393 int mirror = line.at( 9 );
1394 nlohmann::json polyDataList = line.at( 10 );
1397 std::vector<SHAPE_LINE_CHAIN> contours;
1398 for( nlohmann::json& polyData : polyDataList )
1403 contours.push_back( contour );
1415 for(
int i = 0; i < contour.PointCount(); i++ )
1426 std::unique_ptr<PCB_GROUP>
group;
1429 group = std::make_unique<PCB_GROUP>( aBoard );
1435 std::unique_ptr<PCB_SHAPE> shape =
1438 shape->SetFilled(
true );
1439 shape->SetPolyShape( poly );
1440 shape->SetLayer( klayer );
1441 shape->SetWidth( 0 );
1451 shape->Mirror(
ScalePos( start ), flipDirection );
1455 group->AddItem( shape.get() );
1463 else if( type == wxS(
"OBJ" ) )
1466 wxString mimeType, base64Data;
1470 if( !line.at( 3 ).is_number() )
1473 int layer = line.at( 3 ).get<
int>();
1476 start =
VECTOR2D( line.at( 5 ), line.at( 6 ) );
1477 size =
VECTOR2D( line.at( 7 ), line.at( 8 ) );
1478 angle = line.at( 9 );
1479 flipped = line.at( 10 );
1481 wxString imageUrl = line.at( 11 );
1483 if( imageUrl.BeforeFirst(
':' ) == wxS(
"blob" ) )
1485 wxString objectId = imageUrl.AfterLast(
':' );
1487 if(
auto blob =
get_opt( aBlobMap, objectId ) )
1489 wxString blobUrl = blob->url;
1491 if( blobUrl.BeforeFirst(
':' ) == wxS(
"data" ) )
1493 wxArrayString paramsArr =
1494 wxSplit( blobUrl.AfterFirst(
':' ).BeforeFirst(
',' ),
';',
'\0' );
1496 base64Data = blobUrl.AfterFirst(
',' );
1498 if( paramsArr.size() > 0 )
1499 mimeType = paramsArr[0];
1507 if( mimeType.empty() || base64Data.empty() )
1510 wxMemoryBuffer buf = wxBase64Decode( base64Data );
1512 if( mimeType == wxS(
"image/svg+xml" ) )
1518 VECTOR2D kcenter = kstart + ksize / 2;
1520 std::unique_ptr<PCB_REFERENCE_IMAGE> bitmap =
1521 std::make_unique<PCB_REFERENCE_IMAGE>( aBoard, kcenter, klayer );
1524 wxImage::SetDefaultLoadFlags( wxImage::GetDefaultLoadFlags()
1525 & ~wxImage::Load_Verbose );
1537 int x = bitmap->GetPosition().x;
1548 else if( type == wxS(
"STRING" ) )
1550 wxString uuid = line.at( 1 );
1557 int layer = line.at( 3 ).get<
int>();
1561 wxString
string = line.at( 6 );
1562 wxString font = line.at( 7 );
1564 double height = line.at( 8 );
1565 double strokew = line.at( 9 );
1567 int align = line.at( 12 );
1568 double angle = line.at( 13 );
1569 int inverted = line.at( 14 );
1570 int mirror = line.at( 16 );
1574 text->SetText(
string );
1575 text->SetLayer( klayer );
1577 text->SetIsKnockout( inverted );
1581 if( font != wxS(
"default" ) )
1594 text->SetMirrored(
true );
1595 text->SetTextAngleDegrees( -angle );
1599 text->SetTextAngleDegrees( angle );
1604 else if( type == wxS(
"COMPONENT" ) )
1606 wxString compId = line.at( 1 );
1607 componentLines[compId].push_back( line );
1609 else if( type == wxS(
"ATTR" ) )
1611 wxString compId = line.at( 3 );
1612 componentLines[compId].push_back( line );
1614 else if( type == wxS(
"PAD_NET" ) )
1616 wxString compId = line.at( 1 );
1617 componentLines[compId].push_back( line );
1621 for(
auto const& [compId, lines] : componentLines )
1624 wxString fpIdOverride;
1625 wxString fpDesignator;
1626 std::map<wxString, wxString> localCompAttribs;
1628 for(
auto& line : lines )
1630 if( line.size() == 0 )
1633 wxString type = line.at( 0 );
1635 if( type == wxS(
"COMPONENT" ) )
1637 localCompAttribs = line.at( 7 );
1639 else if( type == wxS(
"ATTR" ) )
1643 if( attr.
key == wxS(
"Device" ) )
1644 deviceId = attr.
value;
1646 else if( attr.
key == wxS(
"Footprint" ) )
1647 fpIdOverride = attr.
value;
1649 else if( attr.
key == wxS(
"Designator" ) )
1650 fpDesignator = attr.
value;
1654 if( deviceId.empty() )
1657 nlohmann::json compAttrs = aProject.at(
"devices" ).at( deviceId ).at(
"attributes" );
1661 if( !fpIdOverride.IsEmpty() )
1662 fpId = fpIdOverride;
1664 fpId = compAttrs.at(
"Footprint" ).get<wxString>();
1666 auto it = aFootprintMap.find( fpId );
1667 if( it == aFootprintMap.end() )
1669 wxLogError(
"Footprint of '%s' with uuid '%s' not found.", fpDesignator, fpId );
1673 std::unique_ptr<FOOTPRINT>& footprintOrig = it->second;
1674 std::unique_ptr<FOOTPRINT> footprint(
static_cast<FOOTPRINT*
>( footprintOrig->Clone() ) );
1676 wxString modelUuid, modelTitle, modelTransform;
1678 if(
auto val =
get_opt( localCompAttribs,
"3D Model" ) )
1681 modelUuid = compAttrs.value<wxString>(
"3D Model",
"" );
1683 if(
auto val =
get_opt( localCompAttribs,
"3D Model Title" ) )
1684 modelTitle = val->Trim();
1686 modelTitle = compAttrs.value<wxString>(
"3D Model Title", modelUuid ).Trim();
1688 if(
auto val =
get_opt( localCompAttribs,
"3D Model Transform" ) )
1689 modelTransform = *val;
1691 modelTransform = compAttrs.value<wxString>(
"3D Model Transform",
"" );
1695 footprint->SetParent( aBoard );
1697 for(
auto& line : lines )
1699 if( line.size() == 0 )
1702 wxString type = line.at( 0 );
1704 if( type == wxS(
"COMPONENT" ) )
1706 int layer = line.at( 3 );
1711 double orient = line.at( 6 );
1714 if( klayer ==
B_Cu )
1717 footprint->SetOrientationDegrees( orient );
1720 else if( type == wxS(
"ATTR" ) )
1728 if( attr.
key == wxS(
"Designator" ) )
1730 if( attr.
key == wxS(
"Designator" ) )
1740 if( attr.
fontName != wxS(
"default" ) )
1769 else if( type == wxS(
"PAD_NET" ) )
1771 wxString padNumber = line.at( 2 );
1772 wxString padNet = line.at( 3 );
1774 PAD*
pad = footprint->FindPadByNumber( padNumber );
1792 for(
auto& [uuid, zone] : poursToFill )
1797 auto range = boardPouredMap.equal_range( uuid );
1798 for(
auto& it = range.first; it != range.second; ++it )
1801 int unki = poured.
unki;
1805 for(
int dataId = 0; dataId < poured.
polyData.size(); dataId++ )
1807 const nlohmann::json& fillData = poured.
polyData[dataId];
1808 const double ptScale = 10;
1813 for(
int i = 0; i < contour.
PointCount(); i++ )
1826 thisPoly.
Append( simple );
1835 const int thermalWidth =
pcbIUScale.mmToIU( 0.2 );
1837 for(
int segId = 0; segId < contour.
SegmentCount(); segId++ )
1847 fillPolySet.
Append( thisPoly );
1854 const int strokeWidth =
pcbIUScale.MilsToIU( 8 );
1863 zone->SetFilledPolysList( zone->GetFirstLayer(), fillPolySet );
1864 zone->SetNeedRefill(
false );
1865 zone->SetIsFilled(
true );
1871 std::vector<PCB_SHAPE*> shapes;
1879 shapes.push_back(
static_cast<PCB_SHAPE*
>( item ) );
1894 offset.
x =
KiROUND( offset.
x / alignGrid ) * alignGrid;
1895 offset.
y =
KiROUND( offset.
y / alignGrid ) * alignGrid;
1897 aBoard->
Move( offset );