263 bool aClosed,
bool aInFill )
const
265 std::vector<std::unique_ptr<PCB_SHAPE>> results;
268 for(
int i = 0; i < (int) polyData.size(); i++ )
270 nlohmann::json val = polyData.at( i );
272 if( val.is_string() )
275 if( str == wxS(
"CIRCLE" ) )
278 center.x = ( polyData.at( ++i ) );
279 center.y = ( polyData.at( ++i ) );
280 double r = ( polyData.at( ++i ) );
282 std::unique_ptr<PCB_SHAPE> shape =
287 shape->SetFilled( aClosed );
289 results.emplace_back( std::move( shape ) );
291 else if( str == wxS(
"R" ) )
294 start.
x = ( polyData.at( ++i ) );
295 start.
y = ( polyData.at( ++i ) );
296 size.
x = ( polyData.at( ++i ) );
297 size.
y = -( polyData.at( ++i ).get<double>() );
298 double angle = polyData.at( ++i );
299 double cr = ( i + 1 ) < (
int) polyData.size() ? polyData.at( ++i ).get<
double>() : 0;
303 std::unique_ptr<PCB_SHAPE> shape =
306 shape->SetStart(
ScalePos( start ) );
307 shape->SetEnd(
ScalePos( start + size ) );
308 shape->SetFilled( aClosed );
311 results.emplace_back( std::move( shape ) );
319 std::unique_ptr<PCB_SHAPE> shape =
322 shape->SetStart(
ScalePos( aStart ) );
324 shape->SetFilled( aClosed );
327 results.emplace_back( std::move( shape ) );
332 std::unique_ptr<PCB_SHAPE> shape =
333 std::make_unique<PCB_SHAPE>( aContainer,
SHAPE_T::ARC );
335 shape->SetStart(
ScalePos( aStart ) );
338 shape->SetFilled( aClosed );
341 results.emplace_back( std::move( shape ) );
349 addArc( {
end.x - cr, start.
y }, {
end.x, start.
y - cr },
350 {
end.x - cr, start.
y - cr } );
353 {
end.x - cr,
end.y + cr } );
355 addArc( { start.
x + cr,
end.y }, { start.
x,
end.y + cr },
356 { start.
x + cr,
end.y + cr } );
358 addArc( { start.
x, start.
y - cr }, { start.
x + cr, start.
y },
359 { start.
x + cr, start.
y - cr } );
362 else if( str == wxS(
"ARC" ) || str == wxS(
"CARC" ) )
365 double angle = polyData.at( ++i ).get<
double>() / ( aInFill ? 10 : 1 );
366 end.x = ( polyData.at( ++i ) );
367 end.y = ( polyData.at( ++i ) );
369 std::unique_ptr<PCB_SHAPE> shape =
370 std::make_unique<PCB_SHAPE>( aContainer,
SHAPE_T::ARC );
374 shape->SetStart(
ScalePos( prevPt ) );
380 shape->SetEnd(
ScalePos( prevPt ) );
386 double ha = angle / 2;
387 double hd =
delta.EuclideanNorm() / 2;
388 double cdist = hd / tan(
DEG2RAD( ha ) );
392 shape->SetFilled( aClosed );
394 results.emplace_back( std::move( shape ) );
398 else if( str == wxS(
"L" ) )
403 while( i < (
int) polyData.size() - 2 && polyData.at( i + 1 ).is_number() )
406 pt.
x = ( polyData.at( ++i ) );
407 pt.
y = ( polyData.at( ++i ) );
416 if(
chain.PointCount() > 2 )
418 std::unique_ptr<PCB_SHAPE> shape =
421 chain.SetClosed(
true );
422 shape->SetFilled(
true );
423 shape->SetPolyShape(
chain );
425 results.emplace_back( std::move( shape ) );
430 for(
int s = 0; s <
chain.SegmentCount(); s++ )
434 std::unique_ptr<PCB_SHAPE> shape =
437 shape->SetStart( seg.
A );
438 shape->SetEnd( seg.
B );
440 results.emplace_back( std::move( shape ) );
445 else if( val.is_number() )
447 prevPt.
x = ( polyData.at( i ) );
448 prevPt.
y = ( polyData.at( ++i ) );
758 const wxString& aFpUuid,
759 const std::vector<nlohmann::json>& aLines )
761 std::unique_ptr<FOOTPRINT> footprintPtr = std::make_unique<FOOTPRINT>(
m_board );
762 FOOTPRINT* footprint = footprintPtr.get();
765 const int defaultTextThickness(
pcbIUScale.mmToIU( 0.15 ) );
769 field->SetTextSize( defaultTextSize );
770 field->SetTextThickness( defaultTextThickness );
773 for(
const nlohmann::json& line : aLines )
775 if( line.size() == 0 )
778 wxString type = line.at( 0 );
780 if( type == wxS(
"POLY" ) || type == wxS(
"PAD" ) || type == wxS(
"FILL" )
781 || type == wxS(
"ATTR" ) )
783 wxString uuid = line.at( 1 );
790 wxString netname = line.at( 3 );
791 int layer = line.at( 4 ).get<
int>();
794 if( type == wxS(
"POLY" ) )
796 double thickness = ( line.at( 5 ) );
797 nlohmann::json polyData = line.at( 6 );
799 std::vector<std::unique_ptr<PCB_SHAPE>> results =
800 ParsePoly( footprint, polyData,
false,
false );
802 for(
auto& shape : results )
804 shape->SetLayer( klayer );
805 shape->SetWidth(
ScaleSize( thickness ) );
810 else if( type == wxS(
"PAD" ) )
812 std::unique_ptr<PAD>
pad =
createPAD( footprint, line );
816 else if( type == wxS(
"FILL" ) )
818 int fillLayer = line.at( 4 ).get<
int>();
821 nlohmann::json polyDataList = line.at( 7 );
823 if( !polyDataList.is_null() && !polyDataList.empty() )
825 if( !polyDataList.at( 0 ).is_array() )
826 polyDataList = nlohmann::json::array( { polyDataList } );
828 std::vector<SHAPE_LINE_CHAIN> contours;
829 for( nlohmann::json& polyData : polyDataList )
834 contours.push_back( contour );
844 std::unique_ptr<PCB_GROUP>
group;
847 group = std::make_unique<PCB_GROUP>( footprint );
851 std::unique_ptr<PCB_SHAPE> shape =
854 shape->SetFilled(
true );
855 shape->SetPolyShape( poly );
856 shape->SetLayer( fillKlayer );
857 shape->SetWidth( 0 );
860 group->AddItem( shape.get() );
869 else if( type == wxS(
"ATTR" ) )
873 if( attr.
key == wxS(
"Designator" ) )
877 else if( type == wxS(
"REGION" ) )
879 wxString uuid = line.at( 1 );
886 int layer = line.at( 3 ).get<
int>();
889 std::set<int> flags = line.at( 5 );
890 nlohmann::json polyDataList = line.at( 6 );
892 for( nlohmann::json& polyData : polyDataList )
896 std::vector<std::unique_ptr<PCB_SHAPE>> results =
897 ParsePoly(
nullptr, polyData,
true,
false );
899 for(
auto& shape : results )
901 shape->SetFilled(
true );
908 std::unique_ptr<ZONE> zone = std::make_unique<ZONE>( footprint );
910 zone->SetIsRuleArea(
true );
911 zone->SetDoNotAllowFootprints( !!flags.count( 2 ) );
912 zone->SetDoNotAllowZoneFills( !!flags.count( 7 ) || !!flags.count( 6 )
913 || !!flags.count( 8 ) );
914 zone->SetDoNotAllowPads( !!flags.count( 7 ) );
915 zone->SetDoNotAllowTracks( !!flags.count( 7 ) || !!flags.count( 5 ) );
916 zone->SetDoNotAllowVias( !!flags.count( 7 ) );
918 zone->SetLayer( klayer );
919 zone->Outline()->Append( polySet );
926 if( aProject.is_object() && aProject.contains(
"devices" ) )
928 std::map<wxString, EASYEDAPRO::PRJ_DEVICE> devicesMap = aProject.at(
"devices" );
929 std::map<wxString, wxString> compAttrs;
931 for(
auto& [devUuid, devData] : devicesMap )
933 if(
auto fp =
get_opt( devData.attributes,
"Footprint" ) )
937 compAttrs = devData.attributes;
943 wxString modelUuid, modelTitle, modelTransform;
945 modelUuid =
get_def( compAttrs,
"3D Model",
"" );
946 modelTitle =
get_def( compAttrs,
"3D Model Title", modelUuid );
947 modelTransform =
get_def( compAttrs,
"3D Model Transform",
"" );
953 std::vector<PCB_SHAPE*> edgeShapes;
958 edgeShapes.push_back(
static_cast<PCB_SHAPE*
>( item ) );
969 std::unique_ptr<PCB_SHAPE> shape =
975 shape->SetEnd( bbox.
GetEnd() );
980 bool hasFabRef =
false;
986 if(
static_cast<PCB_TEXT*
>( item )->GetText() == wxT(
"${REFERENCE}" ) )
998 int c_refTextThickness =
pcbIUScale.mmToIU( 0.1 );
999 std::unique_ptr<PCB_TEXT> refText = std::make_unique<PCB_TEXT>( footprint );
1001 refText->SetLayer(
F_Fab );
1002 refText->SetTextSize(
VECTOR2I( c_refTextSize, c_refTextSize ) );
1003 refText->SetTextThickness( c_refTextThickness );
1004 refText->SetText( wxT(
"${REFERENCE}" ) );
1009 return footprintPtr;
1014 BOARD* aBoard,
const nlohmann::json& aProject,
1015 std::map<wxString, std::unique_ptr<FOOTPRINT>>& aFootprintMap,
1016 const std::map<wxString, EASYEDAPRO::BLOB>& aBlobMap,
1017 const std::multimap<wxString, EASYEDAPRO::POURED>& aPouredMap,
1018 const std::vector<nlohmann::json>& aLines,
const wxString& aFpLibName )
1020 std::map<wxString, std::vector<nlohmann::json>> componentLines;
1021 std::map<wxString, std::vector<nlohmann::json>> ruleLines;
1023 std::multimap<wxString, EASYEDAPRO::POURED> boardPouredMap = aPouredMap;
1024 std::map<wxString, ZONE*> poursToFill;
1028 for(
const nlohmann::json& line : aLines )
1030 if( line.size() == 0 )
1033 wxString type = line.at( 0 );
1035 if( type == wxS(
"LAYER" ) )
1037 int layer = line.at( 1 );
1040 wxString layerType = line.at( 2 );
1041 wxString layerName = line.at( 3 );
1042 int layerFlag = line.at( 4 );
1044 if( layerFlag != 0 )
1047 blayers.
set( klayer );
1052 else if( type == wxS(
"NET" ) )
1054 wxString netname = line.at( 1 );
1059 else if( type == wxS(
"RULE" ) )
1061 wxString ruleType = line.at( 1 );
1062 wxString ruleName = line.at( 2 );
1063 int isDefault = line.at( 3 );
1064 nlohmann::json ruleData = line.at( 4 );
1066 if( ruleType == wxS(
"3" ) && isDefault )
1068 wxString units = ruleData.at( 0 );
1070 if( ruleData.at( 1 ).is_number() )
1073 double minVal = ruleData.at( 1 );
1082 nlohmann::json
table = ruleData.at( 1 );
1084 for(
auto& [key, arr] :
table.items() )
1086 double minVal = arr.at( 0 );
1094 else if( ruleType == wxS(
"1" ) && isDefault )
1096 wxString units = ruleData.at( 0 );
1097 nlohmann::json
table = ruleData.at( 1 );
1098 int minVal = INT_MAX;
1103 for(
const auto& arr :
table )
1105 for(
int val : arr )
1107 if( val != 0 && val < minVal )
1112 else if(
table.is_object() )
1116 for(
auto& [key, arr] :
table.items() )
1118 for(
const auto& subarr : arr )
1120 for(
int val : subarr )
1122 if( val != 0 && val < minVal )
1132 ruleLines[ruleType].push_back( line );
1134 else if( type == wxS(
"POURED" ) )
1136 if( !line.at( 2 ).is_string() )
1140 boardPouredMap.emplace( poured.
parentId, poured );
1142 else if( type == wxS(
"VIA" ) || type == wxS(
"LINE" ) || type == wxS(
"ARC" )
1143 || type == wxS(
"POLY" ) || type == wxS(
"FILL" ) || type == wxS(
"POUR" ) )
1145 wxString uuid = line.at( 1 );
1152 wxString netname = line.at( 3 );
1154 if( type == wxS(
"VIA" ) )
1160 double drill = line.at( 7 );
1161 double dia = line.at( 8 );
1163 std::unique_ptr<PCB_VIA>
via = std::make_unique<PCB_VIA>( aBoard );
1170 via->SetNet(
getNet( aBoard, netname ) );
1174 else if( type == wxS(
"LINE" ) )
1176 int layer = line.at( 4 ).get<
int>();
1180 start.
x = line.at( 5 );
1181 start.
y = line.at( 6 );
1184 end.x = line.at( 7 );
1185 end.y = line.at( 8 );
1187 double width = line.at( 9 );
1189 std::unique_ptr<PCB_TRACK> track = std::make_unique<PCB_TRACK>( aBoard );
1191 track->SetLayer( klayer );
1192 track->SetStart(
ScalePos( start ) );
1196 track->SetNet(
getNet( aBoard, netname ) );
1200 else if( type == wxS(
"ARC" ) )
1202 int layer = line.at( 4 ).get<
int>();
1206 start.
x = line.at( 5 );
1207 start.
y = line.at( 6 );
1210 end.x = line.at( 7 );
1211 end.y = line.at( 8 );
1213 double angle = line.at( 9 );
1214 double width = line.at( 10 );
1219 double ha = angle / 2;
1220 double hd =
delta.EuclideanNorm() / 2;
1221 double cdist = hd / tan(
DEG2RAD( ha ) );
1228 std::unique_ptr<PCB_ARC> arc = std::make_unique<PCB_ARC>( aBoard, &sarc );
1231 arc->SetLayer( klayer );
1232 arc->SetNet(
getNet( aBoard, netname ) );
1236 else if( type == wxS(
"FILL" ) )
1238 int layer = line.at( 4 ).get<
int>();
1241 nlohmann::json polyDataList = line.at( 7 );
1243 if( !polyDataList.at( 0 ).is_array() )
1244 polyDataList = nlohmann::json::array( { polyDataList } );
1246 std::vector<SHAPE_LINE_CHAIN> contours;
1247 for( nlohmann::json& polyData : polyDataList )
1252 contours.push_back( contour );
1263 std::unique_ptr<ZONE> zone = std::make_unique<ZONE>( aBoard );
1265 zone->SetNet(
getNet( aBoard, netname ) );
1266 zone->SetLayer( klayer );
1268 zone->SetFilledPolysList( klayer, zoneFillPoly );
1269 zone->SetAssignedPriority( 500 );
1270 zone->SetIsFilled(
true );
1271 zone->SetNeedRefill(
false );
1278 else if( type == wxS(
"POLY" ) )
1280 int layer = line.at( 4 );
1283 double thickness = line.at( 5 );
1284 nlohmann::json polyData = line.at( 6 );
1286 std::vector<std::unique_ptr<PCB_SHAPE>> results =
1287 ParsePoly( aBoard, polyData,
false,
false );
1289 for(
auto& shape : results )
1291 shape->SetLayer( klayer );
1292 shape->SetWidth(
ScaleSize( thickness ) );
1297 else if( type == wxS(
"POUR" ) )
1299 int layer = line.at( 4 ).get<
int>();
1302 wxString pourname = line.at( 6 );
1303 int fillOrder = line.at( 7 ).get<
int>();
1304 nlohmann::json polyDataList = line.at( 8 );
1306 std::unique_ptr<ZONE> zone = std::make_unique<ZONE>( aBoard );
1308 zone->SetNet(
getNet( aBoard, netname ) );
1309 zone->SetLayer( klayer );
1310 zone->SetAssignedPriority( 500 - fillOrder );
1314 for( nlohmann::json& polyData : polyDataList )
1319 zone->Outline()->Append( contour );
1322 wxASSERT( zone->Outline()->OutlineCount() == 1 );
1324 poursToFill.emplace( uuid, zone.get() );
1329 else if( type == wxS(
"TEARDROP" ) )
1331 wxString uuid = line.at( 1 );
1332 wxString netname = line.at( 2 );
1333 int layer = line.at( 3 ).get<
int>();
1336 nlohmann::json polyData = line.at( 4 );
1341 std::unique_ptr<ZONE> zone = std::make_unique<ZONE>( aBoard );
1343 zone->SetNet(
getNet( aBoard, netname ) );
1344 zone->SetLayer( klayer );
1345 zone->Outline()->Append( contour );
1346 zone->SetFilledPolysList( klayer, contour );
1347 zone->SetNeedRefill(
false );
1348 zone->SetIsFilled(
true );
1350 zone->SetAssignedPriority( 600 );
1351 zone->SetLocalClearance( 0 );
1352 zone->SetMinThickness( 0 );
1357 else if( type == wxS(
"REGION" ) )
1359 wxString uuid = line.at( 1 );
1366 int layer = line.at( 3 ).get<
int>();
1369 std::set<int> flags = line.at( 5 );
1370 nlohmann::json polyDataList = line.at( 6 );
1372 for( nlohmann::json& polyData : polyDataList )
1377 std::unique_ptr<ZONE> zone = std::make_unique<ZONE>( aBoard );
1379 zone->SetIsRuleArea(
true );
1380 zone->SetDoNotAllowFootprints( !!flags.count( 2 ) );
1381 zone->SetDoNotAllowZoneFills( !!flags.count( 7 ) || !!flags.count( 6 )
1382 || !!flags.count( 8 ) );
1383 zone->SetDoNotAllowPads( !!flags.count( 7 ) );
1384 zone->SetDoNotAllowTracks( !!flags.count( 7 ) || !!flags.count( 5 ) );
1385 zone->SetDoNotAllowVias( !!flags.count( 7 ) );
1387 zone->SetLayer( klayer );
1388 zone->Outline()->Append( contour );
1393 else if( type == wxS(
"PAD" ) )
1395 wxString netname = line.at( 3 );
1397 std::unique_ptr<FOOTPRINT> footprint = std::make_unique<FOOTPRINT>( aBoard );
1398 std::unique_ptr<PAD>
pad =
createPAD( footprint.get(), line );
1400 pad->SetNet(
getNet( aBoard, netname ) );
1409 footprint->SetPosition( pos );
1410 footprint->SetOrientation( orient );
1412 wxString fpName = wxS(
"Pad_" ) + line.at( 1 ).get<wxString>();
1415 footprint->SetFPID( fpID );
1416 footprint->Reference().SetVisible(
true );
1417 footprint->Value().SetVisible(
true );
1418 footprint->AutoPositionFields();
1422 else if( type == wxS(
"IMAGE" ) )
1424 wxString uuid = line.at( 1 );
1431 int layer = line.at( 3 ).get<
int>();
1434 VECTOR2D start( line.at( 4 ), line.at( 5 ) );
1435 VECTOR2D size( line.at( 6 ), line.at( 7 ) );
1437 double angle = line.at( 8 );
1438 int mirror = line.at( 9 );
1439 nlohmann::json polyDataList = line.at( 10 );
1442 std::vector<SHAPE_LINE_CHAIN> contours;
1443 for( nlohmann::json& polyData : polyDataList )
1448 contours.push_back( contour );
1460 for(
int i = 0; i < contour.PointCount(); i++ )
1471 std::unique_ptr<PCB_GROUP>
group;
1474 group = std::make_unique<PCB_GROUP>( aBoard );
1480 std::unique_ptr<PCB_SHAPE> shape =
1483 shape->SetFilled(
true );
1484 shape->SetPolyShape( poly );
1485 shape->SetLayer( klayer );
1486 shape->SetWidth( 0 );
1496 shape->Mirror(
ScalePos( start ), flipDirection );
1500 group->AddItem( shape.get() );
1508 else if( type == wxS(
"OBJ" ) )
1511 wxString mimeType, base64Data;
1515 if( !line.at( 3 ).is_number() )
1518 int layer = line.at( 3 ).get<
int>();
1521 start =
VECTOR2D( line.at( 5 ), line.at( 6 ) );
1522 size =
VECTOR2D( line.at( 7 ), line.at( 8 ) );
1523 angle = line.at( 9 );
1524 flipped = line.at( 10 );
1526 wxString imageUrl = line.at( 11 );
1528 if( imageUrl.BeforeFirst(
':' ) == wxS(
"blob" ) )
1530 wxString objectId = imageUrl.AfterLast(
':' );
1532 if(
auto blob =
get_opt( aBlobMap, objectId ) )
1534 wxString blobUrl = blob->url;
1536 if( blobUrl.BeforeFirst(
':' ) == wxS(
"data" ) )
1538 wxArrayString paramsArr =
1539 wxSplit( blobUrl.AfterFirst(
':' ).BeforeFirst(
',' ),
';',
'\0' );
1541 base64Data = blobUrl.AfterFirst(
',' );
1543 if( paramsArr.size() > 0 )
1544 mimeType = paramsArr[0];
1552 if( mimeType.empty() || base64Data.empty() )
1555 wxMemoryBuffer buf = wxBase64Decode( base64Data );
1557 if( mimeType == wxS(
"image/svg+xml" ) )
1563 VECTOR2D kcenter = kstart + ksize / 2;
1565 std::unique_ptr<PCB_REFERENCE_IMAGE> bitmap =
1566 std::make_unique<PCB_REFERENCE_IMAGE>( aBoard, kcenter, klayer );
1569 wxImage::SetDefaultLoadFlags( wxImage::GetDefaultLoadFlags()
1570 & ~wxImage::Load_Verbose );
1582 int x = bitmap->GetPosition().x;
1593 else if( type == wxS(
"STRING" ) )
1595 wxString uuid = line.at( 1 );
1602 int layer = line.at( 3 ).get<
int>();
1606 wxString
string = line.at( 6 );
1607 wxString font = line.at( 7 );
1609 double height = line.at( 8 );
1610 double strokew = line.at( 9 );
1612 int align = line.at( 12 );
1613 double angle = line.at( 13 );
1614 int inverted = line.at( 14 );
1615 int mirror = line.at( 16 );
1619 text->SetText(
string );
1620 text->SetLayer( klayer );
1622 text->SetIsKnockout( inverted );
1626 if( font != wxS(
"default" ) )
1639 text->SetMirrored(
true );
1640 text->SetTextAngleDegrees( -angle );
1644 text->SetTextAngleDegrees( angle );
1649 else if( type == wxS(
"COMPONENT" ) )
1651 wxString compId = line.at( 1 );
1652 componentLines[compId].push_back( line );
1654 else if( type == wxS(
"ATTR" ) )
1656 wxString compId = line.at( 3 );
1657 componentLines[compId].push_back( line );
1659 else if( type == wxS(
"PAD_NET" ) )
1661 wxString compId = line.at( 1 );
1662 componentLines[compId].push_back( line );
1666 for(
auto const& [compId, lines] : componentLines )
1669 wxString fpIdOverride;
1670 wxString fpDesignator;
1671 std::map<wxString, wxString> localCompAttribs;
1673 for(
auto& line : lines )
1675 if( line.size() == 0 )
1678 wxString type = line.at( 0 );
1680 if( type == wxS(
"COMPONENT" ) )
1682 localCompAttribs = line.at( 7 );
1684 else if( type == wxS(
"ATTR" ) )
1688 if( attr.
key == wxS(
"Device" ) )
1689 deviceId = attr.
value;
1691 else if( attr.
key == wxS(
"Footprint" ) )
1692 fpIdOverride = attr.
value;
1694 else if( attr.
key == wxS(
"Designator" ) )
1695 fpDesignator = attr.
value;
1699 if( deviceId.empty() )
1702 nlohmann::json compAttrs = aProject.at(
"devices" ).at( deviceId ).at(
"attributes" );
1706 if( !fpIdOverride.IsEmpty() )
1707 fpId = fpIdOverride;
1709 fpId = compAttrs.at(
"Footprint" ).get<wxString>();
1711 auto it = aFootprintMap.find( fpId );
1712 if( it == aFootprintMap.end() )
1714 wxLogTrace(
traceEasyEdaIo,
"Footprint of '%s' with uuid '%s' not found.", fpDesignator, fpId );
1718 std::unique_ptr<FOOTPRINT>& footprintOrig = it->second;
1719 std::unique_ptr<FOOTPRINT> footprint(
static_cast<FOOTPRINT*
>( footprintOrig->Clone() ) );
1721 wxString modelUuid, modelTitle, modelTransform;
1723 if(
auto val =
get_opt( localCompAttribs,
"3D Model" ) )
1726 modelUuid = compAttrs.value<wxString>(
"3D Model",
"" );
1728 if(
auto val =
get_opt( localCompAttribs,
"3D Model Title" ) )
1729 modelTitle = val->Trim();
1731 modelTitle = compAttrs.value<wxString>(
"3D Model Title", modelUuid ).Trim();
1733 if(
auto val =
get_opt( localCompAttribs,
"3D Model Transform" ) )
1734 modelTransform = *val;
1736 modelTransform = compAttrs.value<wxString>(
"3D Model Transform",
"" );
1740 footprint->SetParent( aBoard );
1742 for(
auto& line : lines )
1744 if( line.size() == 0 )
1747 wxString type = line.at( 0 );
1749 if( type == wxS(
"COMPONENT" ) )
1751 int layer = line.at( 3 );
1756 double orient = line.at( 6 );
1759 if( klayer ==
B_Cu )
1762 footprint->SetOrientationDegrees( orient );
1765 else if( type == wxS(
"ATTR" ) )
1773 if( attr.
key == wxS(
"Designator" ) )
1775 if( attr.
key == wxS(
"Designator" ) )
1785 if( attr.
fontName != wxS(
"default" ) )
1814 else if( type == wxS(
"PAD_NET" ) )
1816 wxString padNumber = line.at( 2 );
1817 wxString padNet = line.at( 3 );
1819 PAD*
pad = footprint->FindPadByNumber( padNumber );
1822 pad->SetNet(
getNet( aBoard, padNet ) );
1837 for(
auto& [uuid, zone] : poursToFill )
1842 auto range = boardPouredMap.equal_range( uuid );
1843 for(
auto& it = range.first; it != range.second; ++it )
1849 for(
int dataId = 0; dataId < (int) poured.
polyData.size(); dataId++ )
1851 const nlohmann::json& fillData = poured.
polyData[dataId];
1852 const double ptScale = 10;
1857 for(
int i = 0; i < contour.
PointCount(); i++ )
1870 thisPoly.
Append( simple );
1879 const int thermalWidth =
pcbIUScale.mmToIU( 0.2 );
1881 for(
int segId = 0; segId < contour.
SegmentCount(); segId++ )
1891 fillPolySet.
Append( thisPoly );
1898 const int strokeWidth =
pcbIUScale.MilsToIU( 8 );
1907 zone->SetFilledPolysList( zone->GetFirstLayer(), fillPolySet );
1908 zone->SetNeedRefill(
false );
1909 zone->SetIsFilled(
true );
1915 std::vector<PCB_SHAPE*> shapes;
1923 shapes.push_back(
static_cast<PCB_SHAPE*
>( item ) );
1938 offset.
x =
KiROUND( offset.
x / alignGrid ) * alignGrid;
1939 offset.
y =
KiROUND( offset.
y / alignGrid ) * alignGrid;
1941 aBoard->
Move( offset );