29#include <wx/filename.h>
31#include <wx/tokenzr.h>
32#include <wx/wfstream.h>
33#include <wx/txtstrm.h>
34#include <wx/mstream.h>
35#include <wx/xml/xml.h>
91 bbox.
Merge( item->GetBoundingBox() );
100 return aPinName.BeforeFirst(
'@' );
113 wxCHECK( currentSheet,
nullptr );
158 for(
const std::unique_ptr<ELAYER>& elayer : aLayers )
177 switch ( elayer->number)
207 int roti = int( eagleDegrees );
217 wxASSERT_MSG(
false, wxString::Format( wxT(
"Unhandled orientation (%d degrees)" ),
226 bool aMirror,
bool aSpin,
int aAbsDegress )
228 int align = aEagleAlignment;
230 if( aRelDegress == 90 )
234 else if( aRelDegress == 180 )
238 else if( aRelDegress == 270 )
244 if( aMirror ==
true )
246 if( aAbsDegress == 90 || aAbsDegress == 270 )
257 else if( aAbsDegress == 0 || aAbsDegress == 180 )
351 const std::map<std::string, UTF8>* aProperties )
353 wxASSERT( !aFileName || aSchematic !=
nullptr );
373 wxXmlNode* currentNode = xmlDocument.GetRoot();
383 unique_ptr<SCH_SHEET> tempVROwner;
387 wxCHECK_MSG( aSchematic->
IsValid(),
nullptr,
388 wxT(
"Can't append to a schematic with no root!" ) );
399 if( sheetPath.Last() == aAppendToMe )
411 tempVROwner = std::make_unique<SCH_SHEET>( aSchematic );
431 wxCHECK_MSG(
table,
nullptr,
"Could not load symbol lib table." );
433 m_pi.reset( SCH_IO_MGR::FindPlugin( SCH_IO_MGR::SCH_KICAD ) );
441 wxString libTableUri = wxT(
"${KIPRJMOD}/" ) +
getLibFileName().GetFullName();
446 row.
SetURI( libTableUri );
454 m_eagleDoc = std::make_unique<EAGLE_DOC>( currentNode,
this );
476 const wxString& aLibraryPath,
477 const std::map<std::string, UTF8>* aProperties )
488 for(
const auto& [symName, libSymbol] : it->second.KiCadSymbols )
489 aSymbolNameList.push_back( symName );
495 const wxString& aLibraryPath,
496 const std::map<std::string, UTF8>* aProperties )
507 for(
const auto& [symName, libSymbol] : it->second.KiCadSymbols )
508 aSymbolList.push_back( libSymbol.get() );
514 const std::map<std::string, UTF8>* aProperties )
525 auto it2 = it->second.KiCadSymbols.find( aAliasName );
527 if( it2 != it->second.KiCadSymbols.end() )
528 return it2->second.get();
537 wxFileName fn( aLibraryPath );
539 if( fn.IsFileReadable() && fn.GetModificationTime().IsValid() )
540 return fn.GetModificationTime().GetValue().GetValue();
571 std::unique_ptr<EAGLE_DOC> doc = std::make_unique<EAGLE_DOC>( xmlDocument.GetRoot(),
this );
575 m_version = ( doc->version.IsEmpty() ) ? wxString( wxS(
"0.0" ) ) : doc->version;
587 wxXmlDocument xmlDocument;
588 wxFFileInputStream stream(
m_filename.GetFullPath() );
593 wxString::Format(
_(
"Unable to read file '%s'." ),
m_filename.GetFullPath() ) );
597 wxTextInputStream
text( stream );
598 wxString line =
text.ReadLine();
600 if( !line.StartsWith( wxT(
"<?xml" ) ) && !line.StartsWith( wxT(
"<!--" ) )
601 && !line.StartsWith( wxT(
"<eagle " ) ) )
603 THROW_IO_ERROR( wxString::Format(
_(
"'%s' is an Eagle binary-format file; "
604 "only Eagle XML-format files can be imported." ),
608#if wxCHECK_VERSION( 3, 3, 0 )
611 if( !xmlDocument.Load( stream, wxXMLDOC_NONE, &err ) )
613 if( err.message == wxS(
"no element found" ) )
617 wxMemoryOutputStream memOutput;
620 header <<
"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n";
621 header <<
"<!DOCTYPE eagle SYSTEM \"eagle.dtd\">\n";
623 wxScopedCharBuffer headerBuf =
header.utf8_str();
624 memOutput.Write( headerBuf.data(), headerBuf.length() );
626 wxFFileInputStream stream2(
m_filename.GetFullPath() );
627 memOutput.Write( stream2 );
629 wxMemoryInputStream memInput( memOutput );
631 if( !xmlDocument.Load( memInput, wxXMLDOC_NONE, &err ) )
638 THROW_IO_ERROR( wxString::Format(
_(
"Unable to read file '%s'.\n'%s' at line %d, column %d, offset %d" ),
639 m_filename.GetFullPath(), err.message, err.line, err.column,
644 if( !xmlDocument.Load( stream ) )
648 wxMemoryOutputStream memOutput;
651 header <<
"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n";
652 header <<
"<!DOCTYPE eagle SYSTEM \"eagle.dtd\">\n";
654 wxScopedCharBuffer headerBuf =
header.utf8_str();
655 memOutput.Write( headerBuf.data(), headerBuf.length() );
657 wxFFileInputStream stream2(
m_filename.GetFullPath() );
658 memOutput.Write( stream2 );
660 wxMemoryInputStream memInput( memOutput );
662 if( !xmlDocument.Load( memInput ) )
675 wxCHECK( aDrawing, );
679 if( aDrawing->library )
687 if( aDrawing->schematic )
694 for(
const std::unique_ptr<ESHEET>& esheet : aSchematic.
sheets )
696 for(
const std::unique_ptr<ENET>& enet : esheet->nets )
698 wxString netName = enet->netname;
707 for(
const auto& [modname, emodule] : aSchematic.
modules )
709 for(
const std::unique_ptr<ESHEET>& esheet : emodule->sheets )
711 for(
const std::unique_ptr<ENET>& enet : esheet->nets )
713 wxString netName = enet->netname;
728 if( aSchematic.
sheets.empty() )
732 for(
const auto& [
name, epart] : aSchematic.
parts )
735 for(
const auto& [modName, emodule] : aSchematic.
modules )
737 for(
const auto& [partName, epart] : emodule->parts )
743 for(
const auto& [libName, elibrary] : aSchematic.
libraries )
746 elib->
name = elibrary->GetName();
761 std::vector<SCH_SHEET*> eaglePages;
762 eaglePages.reserve( aSchematic.
sheets.size() );
764 for(
const std::unique_ptr<ESHEET>& esheet : aSchematic.
sheets )
768 std::unique_ptr<SCH_SHEET> sheet = std::make_unique<SCH_SHEET>(
m_rootSheet );
770 sheet->SetScreen( screen );
772 wxCHECK2( sheet && screen,
continue );
774 wxString pageNo = wxString::Format( wxT(
"%d" ),
m_sheetIndex );
782 eaglePages.push_back( sheet.release() );
787 if( !eaglePages.empty() )
812 struct MISSING_UNIT_PLACEMENT
822 std::map<SCH_SCREEN*, MISSING_UNIT_PLACEMENT> placements;
826 const SCH_SYMBOL* origSymbol = cmp.second.cmp;
828 for(
auto& unitEntry : cmp.second.units )
830 if( unitEntry.second ==
false )
834 int unit = unitEntry.first;
845 targetScreen = fallbackSheet->
GetScreen();
847 targetScreen = schematicRoot->
GetScreen();
850 auto placementIt = placements.find( targetScreen );
852 if( placementIt == placements.end() )
854 MISSING_UNIT_PLACEMENT placement;
855 placement.screen = targetScreen;
859 SCH_SHEET* targetSheet = placement.sheetpath.Last();
864 placement.newCmpPosition =
VECTOR2I( placement.sheetBbox.GetLeft(),
865 placement.sheetBbox.GetBottom() );
866 placement.maxY = placement.sheetBbox.GetY();
867 placementIt = placements.emplace( targetScreen, placement ).first;
870 MISSING_UNIT_PLACEMENT& placement = placementIt->second;
872 symbol->SetUnitSelection( &placement.sheetpath, unit );
873 symbol->SetUnit( unit );
874 symbol->SetOrientation( 0 );
875 symbol->AddHierarchicalReference( placement.sheetpath.Path(), reference, unit );
878 BOX2I cmpBbox = symbol->GetBoundingBox();
879 int posY = placement.newCmpPosition.y + cmpBbox.
GetHeight();
880 symbol->SetPosition(
VECTOR2I( placement.newCmpPosition.x, posY ) );
881 placement.newCmpPosition.x += cmpBbox.
GetWidth();
882 placement.maxY = std::max( placement.maxY, posY );
884 if( placement.newCmpPosition.x >= placement.pageSizeIU.x )
885 placement.newCmpPosition =
VECTOR2I( placement.sheetBbox.GetLeft(),
890 placement.screen->Append( symbol.release() );
903 wxCHECK( sheet && screen, );
907 std::string filename;
911 if( aSheet->description )
912 sheet->
SetName( aSheet->description.value().text );
917 replace( filename.begin(), filename.end(),
' ',
'_' );
922 fn.SetPath(
m_schematic->Project().GetProjectPath() );
923 fn.SetName( filename );
930 for(
const auto& [
name, moduleinst] : aSheet->moduleinsts )
937 for(
const std::unique_ptr<EPOLYGON>& epoly : aSheet->plain->polygons )
940 for(
const std::unique_ptr<EWIRE>& ewire : aSheet->plain->wires )
946 for(
const std::unique_ptr<ETEXT>& etext : aSheet->plain->texts )
949 for(
const std::unique_ptr<ECIRCLE>& ecircle : aSheet->plain->circles )
952 for(
const std::unique_ptr<ERECT>& erectangle : aSheet->plain->rectangles )
955 for(
const std::unique_ptr<EFRAME>& eframe : aSheet->plain->frames )
957 std::vector<SCH_ITEM*> frameItems;
968 for(
const std::unique_ptr<EINSTANCE>& einstance : aSheet->instances )
976 for(
const std::unique_ptr<EBUS>& ebus : aSheet->busses )
985 for(
const std::unique_ptr<ENET>& enet : aSheet->nets )
988 wxString netName = enet->netname;
989 wxString netClass = wxString::Format( wxS(
"%i" ), enet->netcode );
1008 if( pageSizeIU.
x < targetSheetSize.
x )
1011 if( pageSizeIU.
y < targetSheetSize.
y )
1018 VECTOR2I sheetcentre( pageSizeIU.
x / 2, pageSizeIU.
y / 2 );
1022 VECTOR2I translation = sheetcentre - itemsCentre;
1023 translation.
x = translation.
x - translation.
x %
schIUScale.MilsToIU( 100 );
1024 translation.
y = translation.
y - translation.
y %
schIUScale.MilsToIU( 100 );
1036 std::vector<SCH_ITEM*> allItems;
1038 std::copy( screen->
Items().
begin(), screen->
Items().
end(), std::back_inserter( allItems ) );
1042 item->SetPosition( item->GetPosition() + translation );
1060 wxCHECK( currentSheet &¤tScreen, );
1066 auto it =
m_eagleDoc->drawing->schematic->modules.find( aModuleInstance->moduleinst );
1069 if( it ==
m_eagleDoc->drawing->schematic->modules.end() )
1071 THROW_IO_ERROR( wxString::Format(
_(
"No module instance '%s' found in schematic "
1073 aModuleInstance->name,
m_filename.GetFullPath() ) );
1077 fn.SetName( aModuleInstance->moduleinst );
1081 VECTOR2I size( it->second->dx.ToSchUnits(), it->second->dy.ToSchUnits() );
1083 int halfX =
KiROUND( size.
x / 2.0 );
1084 int halfY =
KiROUND( size.
y / 2.0 );
1085 int portExtWireLength =
schIUScale.mmToIU( 5.08 );
1086 VECTOR2I pos( aModuleInstance->x.ToSchUnits() - halfX,
1087 -aModuleInstance->y.ToSchUnits() - halfY );
1089 std::unique_ptr<SCH_SHEET> newSheet = std::make_unique<SCH_SHEET>( currentSheet, pos, size );
1097 if( schFile->GetFileName() == fn.GetFullPath() )
1099 newScreen = schFile;
1104 bool isNewSchFile = ( newScreen == nullptr );
1112 wxCHECK( newSheet && newScreen, );
1114 newSheet->SetScreen( newScreen );
1115 newSheet->SetFileName( fn.GetFullName() );
1116 newSheet->SetName( aModuleInstance->name );
1118 for(
const auto& [portName, port] : it->second->ports )
1121 int pinOffset = port->coord.ToSchUnits();
1124 if( port->side ==
"left" )
1128 pinPos.
y = pos.
y + halfY - pinOffset;
1129 portExtWireEndpoint = pinPos;
1130 portExtWireEndpoint.
x -= portExtWireLength;
1132 else if( port->side ==
"right" )
1135 pinPos.
x = pos.
x + size.
x;
1136 pinPos.
y = pos.
y + halfY - pinOffset;
1137 portExtWireEndpoint = pinPos;
1138 portExtWireEndpoint.
x += portExtWireLength;
1140 else if( port->side ==
"top" )
1143 pinPos.
x = pos.
x + halfX + pinOffset;
1145 portExtWireEndpoint = pinPos;
1146 portExtWireEndpoint.
y -= portExtWireLength;
1148 else if( port->side ==
"bottom" )
1151 pinPos.
x = pos.
x + halfX + pinOffset;
1152 pinPos.
y = pos.
y + size.
y;
1153 portExtWireEndpoint = pinPos;
1154 portExtWireEndpoint.
y += portExtWireLength;
1159 currentScreen->
Append( portExtWire );
1163 if( port->direction )
1165 if( *port->direction ==
"in" )
1167 else if( *port->direction ==
"out" )
1169 else if( *port->direction ==
"io" )
1171 else if( *port->direction ==
"hiz" )
1186 newSheet->AddPin( sheetPin );
1189 wxString pageNo = wxString::Format( wxT(
"%d" ),
m_sheetIndex );
1191 newSheet->SetParent( currentSheet );
1194 currentScreen->
Append( newSheet.release() );
1196 m_modules.push_back( it->second.get() );
1202 for(
const std::unique_ptr<ESHEET>& esheet : it->second->sheets )
1212 wxCHECK2( emoduleInst,
continue );
1214 refPrefix += emoduleInst->name + wxS(
":" );
1225 wxCHECK2( symbol && !symbol->
GetInstances().empty(),
continue );
1228 wxString newReference = refPrefix + inst.
m_Reference.AfterLast(
':' );
1242 std::vector<SCH_ITEM*>& aItems )
1244 int xMin = aFrame->x1.ToSchUnits();
1245 int xMax = aFrame->x2.ToSchUnits();
1246 int yMin = -aFrame->y1.ToSchUnits();
1247 int yMax = -aFrame->y2.ToSchUnits();
1250 std::swap( xMin, xMax );
1253 std::swap( yMin, yMax );
1261 aItems.push_back( lines );
1263 if( !( aFrame->border_left ==
false ) )
1270 aItems.push_back( lines );
1273 int height = yMax - yMin;
1276 int legendPosX = xMin +
schIUScale.MilsToIU( 75 );
1277 double rowSpacing = height / double( aFrame->rows );
1278 double legendPosY = yMin + ( rowSpacing / 2 );
1280 for( i = 1; i < aFrame->rows; i++ )
1282 int newY =
KiROUND( yMin + ( rowSpacing * (
double) i ) );
1286 aItems.push_back( lines );
1289 char legendChar =
'A';
1291 for( i = 0; i < aFrame->rows; i++ )
1297 legendText->
SetText( wxString( legendChar ) );
1300 aItems.push_back( legendText );
1302 legendPosY += rowSpacing;
1306 if( !( aFrame->border_right ==
false ) )
1313 aItems.push_back( lines );
1316 int height = yMax - yMin;
1319 int legendPosX = xMax -
schIUScale.MilsToIU( 75 );
1320 double rowSpacing = height / double( aFrame->rows );
1321 double legendPosY = yMin + ( rowSpacing / 2 );
1323 for( i = 1; i < aFrame->rows; i++ )
1325 int newY =
KiROUND( yMin + ( rowSpacing * (
double) i ) );
1329 aItems.push_back( lines );
1332 char legendChar =
'A';
1334 for( i = 0; i < aFrame->rows; i++ )
1340 legendText->
SetText( wxString( legendChar ) );
1343 aItems.push_back( legendText );
1345 legendPosY += rowSpacing;
1349 if( !( aFrame->border_top ==
false ) )
1356 aItems.push_back( lines );
1359 int width = xMax - xMin;
1362 int legendPosY = yMin +
schIUScale.MilsToIU( 75 );
1363 double columnSpacing = width / double( aFrame->columns );
1364 double legendPosX = xMin + ( columnSpacing / 2 );
1366 for( i = 1; i < aFrame->columns; i++ )
1368 int newX =
KiROUND( xMin + ( columnSpacing * (
double) i ) );
1372 aItems.push_back( lines );
1375 char legendChar =
'1';
1377 for( i = 0; i < aFrame->columns; i++ )
1383 legendText->
SetText( wxString( legendChar ) );
1386 aItems.push_back( legendText );
1388 legendPosX += columnSpacing;
1392 if( !( aFrame->border_bottom ==
false ) )
1399 aItems.push_back( lines );
1402 int width = xMax - xMin;
1405 int legendPosY = yMax -
schIUScale.MilsToIU( 75 );
1406 double columnSpacing = width / double( aFrame->columns );
1407 double legendPosX = xMin + ( columnSpacing / 2 );
1409 for( i = 1; i < aFrame->columns; i++ )
1411 int newX =
KiROUND( xMin + ( columnSpacing * (
double) i ) );
1415 aItems.push_back( lines );
1418 char legendChar =
'1';
1420 for( i = 0; i < aFrame->columns; i++ )
1426 legendText->
SetText( wxString( legendChar ) );
1429 aItems.push_back( legendText );
1431 legendPosX += columnSpacing;
1438 const wxString& netName,
1439 const wxString& aNetClass )
1446 size_t segmentCount = aSegments.size();
1448 for(
const std::unique_ptr<ESEGMENT>& esegment : aSegments )
1450 bool labelled =
false;
1451 bool firstWireFound =
false;
1457 for(
const std::unique_ptr<EWIRE>& ewire : esegment->wires )
1466 if( !firstWireFound )
1468 firstWire = thisWire;
1469 firstWireFound =
true;
1475 if( !desc.labels.empty() && desc.labels.front()->GetText() == netName )
1478 for(
const SEG& seg : desc.segs )
1487 segDesc.
segs.push_back( thisWire );
1491 for(
const std::unique_ptr<EJUNCTION>& ejunction : esegment->junctions )
1494 for(
const std::unique_ptr<ELABEL>& elabel : esegment->labels )
1499 wxASSERT( segDesc.
labels.empty()
1502 segDesc.
labels.push_back( label );
1506 for(
const std::unique_ptr<EPINREF>& epinref : esegment->pinRefs )
1508 wxString part = epinref->part;
1509 wxString
pin = epinref->pin;
1511 auto powerPort =
m_powerPorts.find( wxT(
"#" ) + part );
1523 if( !labelled && firstWireFound )
1525 std::unique_ptr<SCH_LABEL_BASE> label;
1530 else if( segmentCount > 1 )
1535 label->SetPosition( firstWire.
A );
1540 if( firstWire.
B.
x > firstWire.
A.
x )
1545 screen->
Append( label.release() );
1554 std::unique_ptr<SCH_SHAPE> poly = std::make_unique<SCH_SHAPE>(
SHAPE_T::POLY );
1558 for(
const std::unique_ptr<EVERTEX>& evertex : aPolygon->vertices )
1560 pt =
VECTOR2I( evertex->x.ToSchUnits(), -evertex->y.ToSchUnits() );
1566 poly->GetPolyShape().Append( arc, -1, -1,
ARC_ACCURACY );
1570 poly->AddPoint( pt );
1574 prev_curve = evertex->curve;
1577 poly->SetLayer(
kiCadLayer( aPolygon->layer ) );
1581 return poly.release();
1589 start.
x = aWire->x1.ToSchUnits();
1590 start.
y = -aWire->y1.ToSchUnits();
1591 end.x = aWire->x2.ToSchUnits();
1592 end.y = -aWire->y2.ToSchUnits();
1595 endpoints =
SEG( start,
end );
1599 std::unique_ptr<SCH_SHAPE> arc = std::make_unique<SCH_SHAPE>(
SHAPE_T::ARC );
1602 arc->SetCenter(
center );
1603 arc->SetStart( start );
1610 return arc.release();
1614 std::unique_ptr<SCH_LINE> line = std::make_unique<SCH_LINE>();
1616 line->SetStartPoint( start );
1617 line->SetEndPoint(
end );
1618 line->SetLayer(
kiCadLayer( aWire->layer ) );
1621 return line.release();
1629 VECTOR2I center( aCircle->x.ToSchUnits(), -aCircle->y.ToSchUnits() );
1642 std::unique_ptr<SCH_SHAPE> rectangle = std::make_unique<SCH_SHAPE>(
SHAPE_T::RECTANGLE );
1644 rectangle->SetLayer(
kiCadLayer( aRectangle->layer ) );
1645 rectangle->SetPosition(
VECTOR2I( aRectangle->x1.ToSchUnits(), -aRectangle->y1.ToSchUnits() ) );
1646 rectangle->SetEnd(
VECTOR2I( aRectangle->x2.ToSchUnits(), -aRectangle->y2.ToSchUnits() ) );
1648 if( aRectangle->rot )
1650 VECTOR2I pos( rectangle->GetPosition() );
1657 rectangle->SetPosition( pos );
1658 rectangle->SetEnd(
end );
1664 return rectangle.release();
1670 std::unique_ptr<SCH_JUNCTION> junction = std::make_unique<SCH_JUNCTION>();
1672 VECTOR2I pos( aJunction->x.ToSchUnits(), -aJunction->y.ToSchUnits() );
1674 junction->SetPosition( pos );
1676 return junction.release();
1681 const wxString& aNetName )
1683 VECTOR2I elabelpos( aLabel->x.ToSchUnits(), -aLabel->y.ToSchUnits() );
1688 std::unique_ptr<SCH_LABEL_BASE> label;
1690 VECTOR2I textSize =
KiROUND( aLabel->size.ToSchUnits() * 0.7, aLabel->size.ToSchUnits() * 0.7 );
1696 label = std::make_unique<SCH_HIERLABEL>();
1699 const auto it =
m_modules.back()->ports.find( aNetName );
1703 if( it->second->direction )
1705 wxString direction = *it->second->direction;
1707 if( direction ==
"in" )
1709 else if( direction ==
"out" )
1711 else if( direction ==
"io" )
1713 else if( direction ==
"hiz" )
1721 label->SetLabelShape( type );
1726 label = std::make_unique<SCH_LABEL>();
1732 label = std::make_unique<SCH_GLOBALLABEL>();
1737 label = std::make_unique<SCH_LABEL>();
1741 label->SetPosition( elabelpos );
1742 label->SetTextSize( textSize );
1747 for(
int i = 0; i <
KiROUND( aLabel->rot->degrees / 90.0 ) %4; ++i )
1748 label->Rotate90(
false );
1750 if( aLabel->rot->mirror )
1751 label->MirrorSpinStyle(
false );
1754 return label.release();
1758std::pair<VECTOR2I, const SEG*>
1760 const std::vector<SEG>& aLines )
const
1763 const SEG* nearestLine =
nullptr;
1765 double d, mindistance = std::numeric_limits<double>::max();
1768 for(
const SEG& line : aLines )
1773 if( d < mindistance )
1776 nearestPoint = testpoint;
1777 nearestLine = &line;
1780 testpoint = line.Center();
1783 if( d < mindistance )
1786 nearestPoint = testpoint;
1787 nearestLine = &line;
1793 if( d < mindistance )
1796 nearestPoint = testpoint;
1797 nearestLine = &line;
1801 return std::make_pair( nearestPoint, nearestLine );
1806 const std::map<wxString, std::unique_ptr<EPART>>& aParts )
1808 wxCHECK( aInstance, );
1814 const auto partIt = aParts.find( aInstance->part );
1816 if( partIt == aParts.end() )
1818 Report( wxString::Format(
_(
"Error parsing Eagle file. Could not find '%s' "
1819 "instance but it is referenced in the schematic." ),
1826 const std::unique_ptr<EPART>& epart = partIt->second;
1828 wxString libName = epart->library;
1831 if( epart->libraryUrn )
1832 libName += wxS(
"_" ) + epart->libraryUrn->assetId;
1834 wxString gatename = epart->deviceset + wxS(
"_" ) + epart->device + wxS(
"_" ) +
1836 wxString symbolname = wxString( epart->deviceset + epart->device );
1837 symbolname.Replace( wxT(
"*" ), wxEmptyString );
1845 wxString altSymbolName = libName + wxT(
"_" ) + symbolname;
1848 wxString libIdSymbolName = altSymbolName;
1854 Report( wxString::Format( wxS(
"Eagle library '%s' not found while looking up symbol for "
1855 "deviceset '%s', device '%s', and gate '%s." ),
1856 libName, epart->deviceset, epart->device, aInstance->gate ) );
1860 const auto gateIt = libIt->second.GateToUnitMap.find( gatename );
1862 if( gateIt == libIt->second.GateToUnitMap.end() )
1864 Report( wxString::Format( wxS(
"Symbol not found for deviceset '%s', device '%s', and "
1865 "gate '%s in library '%s'." ),
1866 epart->deviceset, epart->device, aInstance->gate, libName ) );
1870 int unit = gateIt->second;
1875 auto p = elib->
package.find( kisymbolname );
1877 if( p != elib->
package.end() )
1878 package = p->second;
1881 std::map<std::string, UTF8> properties;
1888 part =
m_pi->LoadSymbol(
getLibFileName().GetFullPath(), kisymbolname, &properties );
1889 libIdSymbolName = kisymbolname;
1894 Report( wxString::Format(
_(
"Could not find '%s' in the imported library." ),
1901 std::unique_ptr<SCH_SYMBOL> symbol = std::make_unique<SCH_SYMBOL>();
1902 symbol->SetLibId( libId );
1903 symbol->SetUnit( unit );
1904 symbol->SetPosition(
VECTOR2I( aInstance->x.ToSchUnits(), -aInstance->y.ToSchUnits() ) );
1907 if( !package.IsEmpty() )
1909 wxString footprint =
m_schematic->Project().GetProjectName() + wxT(
":" ) + package;
1913 if( aInstance->rot )
1917 if( aInstance->rot->mirror )
1918 symbol->MirrorHorizontally( aInstance->x.ToSchUnits() );
1921 std::vector<SCH_FIELD*> partFields;
1924 for(
const SCH_FIELD* partField : partFields )
1928 if( partField->IsMandatory() )
1929 symbolField = symbol->GetField( partField->GetId() );
1931 symbolField = symbol->GetField( partField->GetName() );
1933 wxCHECK2( symbolField,
continue );
1936 symbolField->
SetTextPos( symbol->GetPosition() + partField->GetTextPos() );
1941 wxString reference = package.IsEmpty() ?
'#' + aInstance->part : aInstance->part;
1944 if( reference.find_last_not_of( wxT(
"0123456789" ) ) == ( reference.Length()-1 ) )
1945 reference.Append( wxT(
"0" ) );
1950 if( reference.find_first_not_of( wxT(
"0123456789" ) ) != 0 )
1951 reference.Prepend( wxT(
"UNK" ) );
1955 if( aInstance->part.find_first_not_of( wxT(
"#" ) ) != 0 )
1956 reference.Prepend( wxT(
"UNK" ) );
1959 referenceField->
SetText( reference );
1962 bool userValue =
m_userValue.at( libIdSymbolName );
1970 if( epart->value && !epart->value.CGet().IsEmpty() )
1972 valueField->
SetText( *epart->value );
1976 valueField->
SetText( kisymbolname );
1982 for(
const auto& [ attrName, attr ] : epart->attributes )
1988 if( !symbol->GetFields().empty() )
1989 newField.
SetTextPos( symbol->GetFields().back().GetPosition() );
1992 newField.
SetText( *attr->value );
1996 symbol->AddField( newField );
1999 for(
const auto& [variantName, variant] : epart->variants )
2002 field->
SetName( wxT(
"VARIANT_" ) + variant->name );
2004 if( variant->value )
2005 field->
SetText( *variant->value );
2010 bool valueAttributeFound =
false;
2011 bool nameAttributeFound =
false;
2014 for(
auto& [
name, eattr] : aInstance->attributes )
2018 if( eattr->name.Lower() == wxT(
"name" ) )
2021 nameAttributeFound =
true;
2023 else if( eattr->name.Lower() == wxT(
"value" ) )
2026 valueAttributeFound =
true;
2030 field = symbol->GetField( eattr->name );
2040 int absdegrees = eattr->rot ? eattr->rot->degrees : 0;
2041 bool mirror = eattr->rot ? eattr->rot->mirror :
false;
2043 if( aInstance->rot && aInstance->rot->mirror )
2046 bool spin = eattr->rot ? eattr->rot->spin :
false;
2051 int rotation = aInstance->rot ? aInstance->rot->degrees : 0;
2052 int reldegrees = ( absdegrees - rotation + 360.0 );
2060 if( aInstance->smashed && aInstance->smashed.Get() )
2062 symbol->GetField(
FIELD_T::VALUE )->SetVisible( valueAttributeFound );
2074 wxCHECK2( emoduleInst,
continue );
2076 refPrefix += emoduleInst->name + wxS(
":" );
2079 symbol->AddHierarchicalReference(
m_sheetPath.Path(), refPrefix + reference, unit );
2085 symbol->SetLibSymbol(
new LIB_SYMBOL( *part ) );
2087 for(
const SCH_PIN*
pin : symbol->GetLibPins() )
2093 symbol->ClearFlags();
2095 screen->
Append( symbol.release() );
2101 wxCHECK( aLibrary && aEagleLibrary,
nullptr );
2107 wxString prefix = edeviceset->prefix ? edeviceset->prefix.Get() : wxString( wxT(
"" ) );
2108 wxString deviceSetDescr;
2110 if( edeviceset->description )
2114 for(
const std::unique_ptr<EDEVICE>& edevice : edeviceset->devices )
2117 wxString symbolName = edeviceset->name + edevice->name;
2118 symbolName.Replace( wxT(
"*" ), wxEmptyString );
2119 wxASSERT( !symbolName.IsEmpty() );
2122 if( edevice->package )
2123 aEagleLibrary->
package[symbolName] = edevice->package.Get();
2126 std::unique_ptr<LIB_SYMBOL> libSymbol = std::make_unique<LIB_SYMBOL>( symbolName );
2129 int gate_count =
static_cast<int>( edeviceset->gates.size() );
2130 libSymbol->SetUnitCount( gate_count,
true );
2131 libSymbol->LockUnits(
true );
2135 if( prefix.length() == 0 )
2143 reference->
SetText( edevice->package ? prefix :
'#' + prefix );
2146 libSymbol->GetValueField().SetVisible(
true );
2149 bool ispower =
false;
2151 for(
const auto& [gateName, egate] : edeviceset->gates )
2153 const auto it = aLibrary->
symbols.find( egate->symbol );
2155 if( it == aLibrary->
symbols.end() )
2157 Report( wxString::Format( wxS(
"Eagle symbol '%s' not found in library '%s'." ),
2158 egate->symbol, aLibrary->
GetName() ) );
2162 wxString gateMapName = edeviceset->name + wxS(
"_" ) + edevice->name +
2163 wxS(
"_" ) + egate->name;
2165 ispower =
loadSymbol( it->second, libSymbol, edevice, gateindex, egate->name );
2170 libSymbol->SetUnitCount( gate_count,
true );
2172 if( gate_count == 1 && ispower )
2173 libSymbol->SetGlobalPower();
2176 if( edevice->package )
2183 libName =
m_schematic->Project().GetProjectName();
2190 wxString packageString = libName + wxT(
":" ) + aEagleLibrary->
package[symbolName];
2192 libSymbol->GetFootprintField().SetText( packageString );
2195 wxString libName = libSymbol->GetName();
2196 libSymbol->SetName( libName );
2197 libSymbol->SetDescription( deviceSetDescr );
2207 libName = aEagleLibrary->
name + wxT(
"_" ) + libName;
2209 libSymbol->SetName( libName );
2213 std::map<std::string, UTF8> properties;
2227 aEagleLibrary->
KiCadSymbols[ libName ] = std::move( libSymbol );
2231 m_userValue.emplace( std::make_pair( libName, edeviceset->uservalue ==
true ) );
2235 return aEagleLibrary;
2240 std::unique_ptr<LIB_SYMBOL>& aSymbol,
2241 const std::unique_ptr<EDEVICE>& aDevice,
int aGateNumber,
2242 const wxString& aGateName )
2244 wxCHECK( aEsymbol && aSymbol && aDevice,
false );
2246 std::vector<SCH_ITEM*> items;
2248 bool showRefDes =
false;
2249 bool showValue =
false;
2250 bool ispower =
false;
2253 for(
const std::unique_ptr<ECIRCLE>& ecircle : aEsymbol->circles )
2256 for(
const std::unique_ptr<EPIN>& epin : aEsymbol->pins )
2258 std::unique_ptr<SCH_PIN>
pin(
loadPin( aSymbol, epin, aGateNumber ) );
2263 if( epin->direction )
2267 if( epin->direction->Lower() == pinDir.first )
2269 pin->SetType( pinDir.second );
2271 if( pinDir.first == wxT(
"sup" ) )
2280 if( aDevice->connects.size() != 0 )
2282 for(
const std::unique_ptr<ECONNECT>& connect : aDevice->connects )
2284 if( connect->gate == aGateName &&
pin->GetName() == connect->pin )
2286 wxArrayString pads = wxSplit( wxString( connect->pad ),
' ' );
2288 pin->SetUnit( aGateNumber );
2291 if( pads.GetCount() > 1 )
2293 pin->SetNumberTextSize( 0 );
2296 for(
unsigned i = 0; i < pads.GetCount(); i++ )
2300 wxString padname( pads[i] );
2302 aSymbol->AddDrawItem( apin );
2311 pin->SetUnit( aGateNumber );
2312 pin->SetNumber( wxString::Format( wxT(
"%i" ), pincount ) );
2313 aSymbol->AddDrawItem(
pin.release() );
2317 for(
const std::unique_ptr<EPOLYGON>& epolygon : aEsymbol->polygons )
2320 for(
const std::unique_ptr<ERECT>& erectangle : aEsymbol->rectangles )
2323 for(
const std::unique_ptr<ETEXT>& etext : aEsymbol->texts )
2325 std::unique_ptr<SCH_TEXT> libtext(
loadSymbolText( aSymbol, etext, aGateNumber ) );
2327 if( libtext->GetText() == wxT(
"${REFERENCE}" ) )
2333 showRefDes = etext->text == wxT(
">NAME" );
2335 else if( libtext->GetText() == wxT(
"${VALUE}" ) )
2341 showValue = etext->text == wxT(
">VALUE" );
2345 aSymbol->AddDrawItem( libtext.release() );
2349 for(
const std::unique_ptr<EWIRE>& ewire : aEsymbol->wires )
2350 aSymbol->AddDrawItem(
loadSymbolWire( aSymbol, ewire, aGateNumber ) );
2352 for(
const std::unique_ptr<EFRAME>& eframe : aEsymbol->frames )
2354 std::vector<SCH_ITEM*> frameItems;
2360 item->SetParent( aSymbol.get() );
2361 item->SetUnit( aGateNumber );
2362 aSymbol->AddDrawItem( item );
2366 aSymbol->GetReferenceField().SetVisible( showRefDes );
2367 aSymbol->GetValueField().SetVisible( showValue );
2369 return pincount == 1 ? ispower :
false;
2374 const std::unique_ptr<ECIRCLE>& aCircle,
2377 wxCHECK( aSymbol && aCircle,
nullptr );
2381 VECTOR2I center( aCircle->x.ToSchUnits(), -aCircle->y.ToSchUnits() );
2383 circle->SetParent( aSymbol.get() );
2387 circle->SetUnit( aGateNumber );
2394 const std::unique_ptr<ERECT>& aRectangle,
2397 wxCHECK( aSymbol && aRectangle,
nullptr );
2402 rectangle->
SetPosition(
VECTOR2I( aRectangle->x1.ToSchUnits(), -aRectangle->y1.ToSchUnits() ) );
2403 rectangle->
SetEnd(
VECTOR2I( aRectangle->x2.ToSchUnits(), -aRectangle->y2.ToSchUnits() ) );
2405 if( aRectangle->rot )
2418 rectangle->
SetUnit( aGateNumber );
2428 const std::unique_ptr<EWIRE>& aWire,
int aGateNumber )
2430 wxCHECK( aSymbol && aWire,
nullptr );
2434 begin.
x = aWire->x1.ToSchUnits();
2435 begin.
y = -aWire->y1.ToSchUnits();
2436 end.x = aWire->x2.ToSchUnits();
2437 end.y = -aWire->y2.ToSchUnits();
2456 ( aWire->width.ToSchUnits() /
radius );
2457 begin =
center + centerStartVector;
2491 const std::unique_ptr<EPOLYGON>& aPolygon,
2494 wxCHECK( aSymbol && aPolygon,
nullptr );
2502 for(
const std::unique_ptr<EVERTEX>& evertex : aPolygon->vertices )
2504 pt =
VECTOR2I( evertex->x.ToSchUnits(), evertex->y.ToSchUnits() );
2518 prev_curve = evertex->curve;
2530 const std::unique_ptr<EPIN>& aPin,
int aGateNumber )
2532 wxCHECK( aSymbol && aPin,
nullptr );
2534 std::unique_ptr<SCH_PIN>
pin = std::make_unique<SCH_PIN>( aSymbol.get() );
2535 pin->SetPosition(
VECTOR2I( aPin->x.ToSchUnits(), -aPin->y.ToSchUnits() ) );
2536 pin->SetName( aPin->name );
2537 pin->SetUnit( aGateNumber );
2539 int roti = aPin->rot ? aPin->rot->degrees : 0;
2547 default: wxFAIL_MSG( wxString::Format( wxT(
"Unhandled orientation (%d degrees)." ), roti ) );
2554 wxString length = aPin->length.Get();
2556 if( length == wxT(
"short" ) )
2558 else if( length == wxT(
"middle" ) )
2560 else if( length == wxT(
"long" ) )
2562 else if( length == wxT(
"point" ) )
2573 wxString visible = aPin->visible.Get();
2575 if( visible == wxT(
"off" ) )
2577 pin->SetNameTextSize( 0 );
2578 pin->SetNumberTextSize( 0 );
2580 else if( visible == wxT(
"pad" ) )
2582 pin->SetNameTextSize( 0 );
2584 else if( visible == wxT(
"pin" ) )
2586 pin->SetNumberTextSize( 0 );
2596 if( aPin->function )
2598 wxString function = aPin->function.Get();
2600 if( function == wxT(
"dot" ) )
2602 else if( function == wxT(
"clk" ) )
2604 else if( function == wxT(
"dotclk" ) )
2608 return pin.release();
2613 const std::unique_ptr<ETEXT>& aText,
int aGateNumber )
2615 wxCHECK( aSymbol && aText,
nullptr );
2617 std::unique_ptr<SCH_TEXT> libtext = std::make_unique<SCH_TEXT>();
2619 libtext->SetParent( aSymbol.get() );
2620 libtext->SetUnit( aGateNumber );
2621 libtext->SetPosition(
VECTOR2I( aText->x.ToSchUnits(), -aText->y.ToSchUnits() ) );
2623 const wxString& eagleText = aText->text;
2624 wxString adjustedText;
2625 wxStringTokenizer tokenizer( eagleText,
"\r\n" );
2628 while( tokenizer.HasMoreTokens() )
2630 wxString tmp =
interpretText( tokenizer.GetNextToken().Trim(
true ).Trim(
false ) );
2632 if( tokenizer.HasMoreTokens() )
2635 adjustedText += tmp;
2638 libtext->SetText( adjustedText.IsEmpty() ? wxString( wxS(
"~" ) ) : adjustedText );
2642 return libtext.release();
2648 wxCHECK( aText,
nullptr );
2650 std::unique_ptr<SCH_TEXT> schtext = std::make_unique<SCH_TEXT>();
2652 const wxString& eagleText = aText->text;
2653 wxString adjustedText;
2654 wxStringTokenizer tokenizer( eagleText,
"\r\n" );
2657 while( tokenizer.HasMoreTokens() )
2659 wxString tmp =
interpretText( tokenizer.GetNextToken().Trim(
true ).Trim(
false ) );
2661 if( tokenizer.HasMoreTokens() )
2664 adjustedText += tmp;
2667 schtext->SetText( adjustedText.IsEmpty() ? wxString( wxS(
"\" \"" ) )
2670 schtext->SetPosition(
VECTOR2I( aText->x.ToSchUnits(), -aText->y.ToSchUnits() ) );
2672 schtext->SetItalic(
false );
2674 return schtext.release();
2679 const std::unique_ptr<ETEXT>& aAttributes )
const
2681 wxCHECK( aText && aAttributes, );
2686 if( aAttributes->ratio && aAttributes->ratio.CGet() > 12 )
2690 int degrees = aAttributes->rot ? aAttributes->rot->degrees : 0;
2691 bool mirror = aAttributes->rot ? aAttributes->rot->mirror :
false;
2692 bool spin = aAttributes->rot ? aAttributes->rot->spin :
false;
2700 wxCHECK( aField && aText, );
2724 auto onIntersection =
2733 for(
SCH_TEXT* label : segDesc.labels )
2736 const SEG* segAttached = segDesc.LabelAttached( label );
2738 if( segAttached && !onIntersection( labelPos ) )
2752 VECTOR2I wireDirection( segAttached->
B - segAttached->
A );
2754 const VECTOR2I origPos( labelPos );
2757 bool checkPositive =
true, checkNegative =
true,
move =
false;
2761 while( ( !
move || onIntersection( labelPos ) ) && ( checkPositive || checkNegative ) )
2766 if( trial % 2 == 1 )
2768 labelPos =
VECTOR2I( origPos + wireDirection * trial / 2 );
2769 move = checkPositive = segAttached->
Contains( labelPos );
2773 labelPos =
VECTOR2I( origPos - wireDirection * trial / 2 );
2774 move = checkNegative = segAttached->
Contains( labelPos );
2810 wxFileInputStream input( aFileName );
2815 wxTextInputStream
text( input );
2817 for(
int i = 0; i < 8; i++ )
2822 if(
text.ReadLine().Contains( wxS(
"<eagle" ) ) )
2840 if( !item->IsType( { SCH_LABEL_LOCATE_ANY_T } ) )
2844 item->SetPosition( aNewEndPoint );
2857 std::vector<SCH_LINE*> buses;
2858 std::vector<SCH_LINE*> wires;
2869 buses.push_back( line );
2870 else if( line->
IsWire() )
2871 wires.push_back( line );
2876 VECTOR2I wireStart = wire->GetStartPoint();
2877 VECTOR2I wireEnd = wire->GetEndPoint();
2881 VECTOR2I busStart = bus->GetStartPoint();
2882 VECTOR2I busEnd = bus->GetEndPoint();
2885 [](
int signX,
int signY ) ->
VECTOR2I
2897 if( wireStart.
y == wireEnd.
y && busStart.
x == busEnd.
x )
2901 if( testBusHit( wireStart ) )
2905 if( wireEnd.
x < busStart.
x )
2912 VECTOR2I p = wireStart + entrySize( -1, 0 );
2914 if( testBusHit( wireStart + entrySize( 0, -1 ) ) )
2923 screen->
Append( busEntry );
2925 wire->SetStartPoint( p );
2927 else if( testBusHit( wireStart + entrySize( 0, 1 ) ) )
2936 screen->
Append( busEntry );
2938 wire->SetStartPoint( p );
2953 VECTOR2I p = wireStart + entrySize( 1, 0 );
2955 if( testBusHit( wireStart + entrySize( 0, -1 ) ) )
2964 screen->
Append( busEntry );
2966 wire->SetStartPoint( p );
2968 else if( testBusHit( wireStart + entrySize( 0, 1 ) ) )
2977 screen->
Append( busEntry );
2979 wire->SetStartPoint( p );
2990 else if( testBusHit( wireEnd ) )
2994 if( wireStart.
x < busStart.
x )
3001 VECTOR2I p = wireEnd + entrySize( -1, 0 );
3003 if( testBusHit( wireEnd + entrySize( 0, -1 ) ) )
3012 screen->
Append( busEntry );
3014 wire->SetEndPoint( p );
3016 else if( testBusHit( wireEnd + entrySize( 0, -1 ) ) )
3025 screen->
Append( busEntry );
3026 moveLabels( wire, wireEnd + entrySize( -1, 0 ) );
3027 wire->SetEndPoint( wireEnd + entrySize( -1, 0 ) );
3042 VECTOR2I p = wireEnd + entrySize( 1, 0 );
3044 if( testBusHit( wireEnd + entrySize( 0, -1 ) ) )
3053 screen->
Append( busEntry );
3055 wire->SetEndPoint( p );
3057 else if( testBusHit( wireEnd + entrySize( 0, 1 ) ) )
3066 screen->
Append( busEntry );
3068 wire->SetEndPoint( p );
3080 else if( wireStart.
x == wireEnd.
x && busStart.
y == busEnd.
y )
3084 if( testBusHit( wireStart ) )
3088 if( wireEnd.
y < busStart.
y )
3096 VECTOR2I p = wireStart + entrySize( 0, -1 );
3098 if( testBusHit( wireStart + entrySize( -1, 0 ) ) )
3108 screen->
Append( busEntry );
3110 wire->SetStartPoint( p );
3112 else if( testBusHit( wireStart + entrySize( 1, 0 ) ) )
3122 screen->
Append( busEntry );
3124 wire->SetStartPoint( p );
3140 VECTOR2I p = wireStart + entrySize( 0, 1 );
3142 if( testBusHit( wireStart + entrySize( -1, 0 ) ) )
3152 screen->
Append( busEntry );
3154 wire->SetStartPoint( p );
3156 else if( testBusHit( wireStart + entrySize( 1, 0 ) ) )
3166 screen->
Append( busEntry );
3168 wire->SetStartPoint( p );
3179 else if( testBusHit( wireEnd ) )
3183 if( wireStart.
y < busStart.
y )
3191 VECTOR2I p = wireEnd + entrySize( 0, -1 );
3193 if( testBusHit( wireEnd + entrySize( -1, 0 ) ) )
3203 screen->
Append( busEntry );
3205 wire->SetEndPoint( p );
3207 else if( testBusHit( wireEnd + entrySize( 1, 0 ) ) )
3217 screen->
Append( busEntry );
3219 wire->SetEndPoint( p );
3235 VECTOR2I p = wireEnd + entrySize( 0, 1 );
3237 if( testBusHit( wireEnd + entrySize( -1, 0 ) ) )
3247 screen->
Append( busEntry );
3249 wire->SetEndPoint( p );
3251 else if( testBusHit( wireEnd + entrySize( 1, 0 ) ) )
3261 screen->
Append( busEntry );
3263 wire->SetEndPoint( p );
3279 if( testBusHit( wireStart ) )
3281 VECTOR2I wirevector = wireStart - wireEnd;
3283 if( wirevector.
x > 0 )
3285 if( wirevector.
y > 0 )
3287 VECTOR2I p = wireStart + entrySize( -1, -1 );
3290 screen->
Append( busEntry );
3293 wire->SetStartPoint( p );
3297 VECTOR2I p = wireStart + entrySize( -1, 1 );
3300 screen->
Append( busEntry );
3303 wire->SetStartPoint( p );
3308 if( wirevector.
y > 0 )
3310 VECTOR2I p = wireStart + entrySize( 1, -1 );
3313 screen->
Append( busEntry );
3316 wire->SetStartPoint( p );
3320 VECTOR2I p = wireStart + entrySize( 1, 1 );
3323 screen->
Append( busEntry );
3326 wire->SetStartPoint( p );
3332 else if( testBusHit( wireEnd ) )
3334 VECTOR2I wirevector = wireStart - wireEnd;
3336 if( wirevector.
x > 0 )
3338 if( wirevector.
y > 0 )
3340 VECTOR2I p = wireEnd + entrySize( 1, 1 );
3343 screen->
Append( busEntry );
3346 wire->SetEndPoint( p );
3350 VECTOR2I p = wireEnd + entrySize( 1, -1 );
3353 screen->
Append( busEntry );
3356 wire->SetEndPoint( p );
3361 if( wirevector.
y > 0 )
3363 VECTOR2I p = wireEnd + entrySize( -1, 1 );
3366 screen->
Append( busEntry );
3369 wire->SetEndPoint( p );
3373 VECTOR2I p = wireEnd + entrySize( -1, -1 );
3376 screen->
Append( busEntry );
3379 wire->SetEndPoint( p );
3393 wxCHECK( aLabel,
nullptr );
3399 if( seg.Contains( labelPos ) )
3411 wxCHECK( aSymbol && aPin,
false );
3419 const auto& items = pointIt->second;
3421 wxCHECK( items.find( aPin ) != items.end(),
false );
3423 return items.size() > 1;
3437 int unit = aSymbol->
GetUnit();
3440 std::set<int> missingUnits;
3447 bool pinInUnit = !unit ||
pin->GetUnit() == unit;
3461 switch(
pin->GetOrientation() )
3478 aScreen->
Append( netLabel );
3481 else if( aUpdateSet )
3486 wxASSERT(
pin->GetUnit() );
3487 missingUnits.insert(
pin->GetUnit() );
3500 entry.
cmp = aSymbol;
3502 entry.
units.emplace( unit,
false );
3507 cmpIt->second.units[unit] =
false;
3510 if( !missingUnits.empty() )
3513 entry.
cmp = aSymbol;
3517 for(
int i : missingUnits )
3519 if( entry.
units.find( i ) != entry.
units.end() )
3520 entry.
units.emplace( i,
true );
3532 wxString ret = wxT(
"{" );
3534 wxStringTokenizer tokenizer( aEagleName,
"," );
3536 while( tokenizer.HasMoreTokens() )
3538 wxString member = tokenizer.GetNextToken();
3545 if( member.Freq(
'!' ) % 2 > 0 )
3546 member << wxT(
"!" );
3548 ret << member << wxS(
" " );
3563 std::unique_ptr<EPART>& epart =
m_eagleDoc->drawing->schematic->parts[aInstance->part];
3565 if( !epart || epart->deviceset.IsEmpty() )
3568 std::unique_ptr<ELIBRARY>& elibrary =
m_eagleDoc->drawing->schematic->libraries[epart->library];
3573 std::unique_ptr<EDEVICE_SET>& edeviceset = elibrary->devicesets[epart->deviceset];
3578 std::unique_ptr<EGATE>& egate = edeviceset->gates[aInstance->gate];
3583 std::unique_ptr<ESYMBOL>& esymbol = elibrary->symbols[egate->symbol];
3586 return esymbol.get();
3593 const wxString& aEagleFieldName,
3596 wxCHECK( aField && !aEagleFieldName.
IsEmpty(), );
3602 for(
const std::unique_ptr<ETEXT>&
text : esymbol->
texts )
3604 if(
text->text == aEagleFieldName )
3607 VECTOR2I pos(
text->x.ToSchUnits() + aInstance->x.ToSchUnits(),
3608 -
text->y.ToSchUnits() - aInstance->y.ToSchUnits() );
3610 bool mirror =
text->rot ?
text->rot->mirror :
false;
3612 if( aInstance->rot && aInstance->rot->mirror )
3616 pos.
y = -aInstance->y.ToSchUnits() +
text->y.ToSchUnits();
constexpr EDA_IU_SCALE schIUScale
constexpr BOX2I KiROUND(const BOX2D &aBoxD)
constexpr size_type GetWidth() const
constexpr Vec Centre() const
constexpr BOX2< Vec > & Merge(const BOX2< Vec > &aRect)
Modify the position and size of the rectangle in order to contain aRect.
constexpr size_type GetHeight() const
constexpr const SizeVec & GetSize() const
void SetFlags(EDA_ITEM_FLAGS aMask)
virtual void SetParent(EDA_ITEM *aParent)
void SetCenter(const VECTOR2I &aCenter)
SHAPE_POLY_SET & GetPolyShape()
const VECTOR2I & GetEnd() const
Return the ending point of the graphic.
void SetStart(const VECTOR2I &aStart)
void SetEnd(const VECTOR2I &aEnd)
void SetArcAngleAndEnd(const EDA_ANGLE &aAngle, bool aCheckNegativeAngle=false)
Set the end point from the angle center and start.
void SetFillMode(FILL_T aFill)
A mix-in class (via multiple inheritance) that handles texts such as labels, parts,...
const EDA_ANGLE & GetTextAngle() const
void SetTextSize(VECTOR2I aNewSize, bool aEnforceMinTextSize=true)
virtual const wxString & GetText() const
Return the string associated with the text object.
void SetTextPos(const VECTOR2I &aPoint)
void SetVertJustify(GR_TEXT_V_ALIGN_T aType)
GR_TEXT_H_ALIGN_T GetHorizJustify() const
virtual void SetVisible(bool aVisible)
void SetBold(bool aBold)
Set the text to be bold - this will also update the font if needed.
GR_TEXT_V_ALIGN_T GetVertJustify() const
virtual void SetText(const wxString &aText)
virtual void SetTextAngle(const EDA_ANGLE &aAngle)
void SetItalic(bool aItalic)
Set the text to be italic - this will also update the font if needed.
VECTOR2I GetTextSize() const
void SetHorizJustify(GR_TEXT_H_ALIGN_T aType)
EE_TYPE Overlapping(const BOX2I &aRect) const
ee_rtree::Iterator begin() const
Return a read/write iterator that points to the first.
ee_rtree::Iterator end() const
Return a read/write iterator that points to one past the last element in the EE_RTREE.
EE_TYPE OfType(KICAD_T aType) const
static std::shared_ptr< ERC_ITEM > Create(int aErrorCode)
Constructs an ERC_ITEM for the given error code.
RAII class to set and restore the fontconfig reporter.
REPORTER * m_reporter
Reporter to log errors/warnings to, may be nullptr.
PROGRESS_REPORTER * m_progressReporter
Progress reporter to track the progress of the operation, may be nullptr.
virtual bool CanReadLibrary(const wxString &aFileName) const
Checks if this IO object can read the specified library file/directory.
virtual void Report(const wxString &aText, SEVERITY aSeverity=RPT_SEVERITY_UNDEFINED)
std::optional< LIBRARY_TABLE * > ProjectTable() const
Retrieves the project library table for this adapter type, or nullopt if one doesn't exist.
void SetNickname(const wxString &aNickname)
void SetType(const wxString &aType)
void SetURI(const wxString &aUri)
A logical library item identifier and consists of various portions much like a URI.
static UTF8 FixIllegalChars(const UTF8 &aLibItemName, bool aLib)
Replace illegal LIB_ID item name characters with underscores '_'.
Define a library symbol object.
std::vector< const SCH_PIN * > GetGraphicalPins(int aUnit=0, int aBodyStyle=0) const
Graphical pins: Return schematic pin objects as drawn (unexpanded), filtered by unit/body.
void GetFields(std::vector< SCH_FIELD * > &aList, bool aVisibleOnly=false) const override
Populate a std::vector with SCH_FIELDs, sorted in ordinal order.
bool IsGlobalPower() const override
int GetUnitCount() const override
static LOAD_INFO_REPORTER & GetInstance()
static bool ParseBusVector(const wxString &aBus, wxString *aName, std::vector< wxString > *aMemberList)
Parse a bus vector (e.g.
Describe the page size and margins of a paper page on which to eventually print or plot.
void SetHeightMils(double aHeightInMils)
const VECTOR2D GetSizeIU(double aIUScale) const
Gets the page size in internal units.
void SetWidthMils(double aWidthInMils)
static SYMBOL_LIBRARY_ADAPTER * SymbolLibAdapter(PROJECT *aProject)
Accessor for project symbol library manager adapter.
Holds all the data relating to one schematic.
PROJECT & Project() const
Return a reference to the project this schematic is part of.
bool IsValid() const
A simple test if the schematic is loaded, not a complete one.
Class for a wire to bus entry.
virtual const wxString & GetText() const override
Return the string associated with the text object.
void ImportValues(const SCH_FIELD &aSource)
Copy parameters from a SCH_FIELD source.
bool IsEmpty()
Return true if both the name and value of the field are empty.
void SetPosition(const VECTOR2I &aPosition) override
void SetName(const wxString &aName)
void SetText(const wxString &aText) override
void SetSpinStyle(SPIN_STYLE aSpinStyle) override
std::unique_ptr< EAGLE_DOC > m_eagleDoc
SCH_ITEM * loadWire(const std::unique_ptr< EWIRE > &aWire, SEG &endpoints)
void loadTextAttributes(EDA_TEXT *aText, const std::unique_ptr< ETEXT > &aAttributes) const
void loadModuleInstance(const std::unique_ptr< EMODULEINST > &aModuleInstance)
SCH_TEXT * loadLabel(const std::unique_ptr< ELABEL > &aLabel, const wxString &aNetName)
void ensureLoadedLibrary(const wxString &aLibraryPath)
void loadSchematic(const ESCHEMATIC &aSchematic)
SCH_TEXT * loadPlainText(const std::unique_ptr< ETEXT > &aSchText)
void loadSheet(const std::unique_ptr< ESHEET > &aSheet)
void loadLayerDefs(const std::vector< std::unique_ptr< ELAYER > > &aLayers)
const ESYMBOL * getEagleSymbol(const std::unique_ptr< EINSTANCE > &aInstance)
EAGLE_LIBRARY * loadLibrary(const ELIBRARY *aLibrary, EAGLE_LIBRARY *aEagleLib)
wxXmlDocument loadXmlDocument(const wxString &aFileName)
wxString translateEagleBusName(const wxString &aEagleName) const
Translate an Eagle-style bus name into one that is KiCad-compatible.
void loadFieldAttributes(SCH_FIELD *aField, const SCH_TEXT *aText) const
Move net labels that are detached from any wire to the nearest wire.
std::map< wxString, wxString > m_powerPorts
map from symbol reference to global label equivalent
SCH_SHEET_PATH m_sheetPath
The current sheet path of the schematic being loaded.
wxString m_libName
Library name to save symbols.
SCH_TEXT * loadSymbolText(std::unique_ptr< LIB_SYMBOL > &aSymbol, const std::unique_ptr< ETEXT > &aText, int aGateNumber)
std::pair< VECTOR2I, const SEG * > findNearestLinePoint(const VECTOR2I &aPoint, const std::vector< SEG > &aLines) const
std::map< wxString, long long > m_timestamps
void loadInstance(const std::unique_ptr< EINSTANCE > &aInstance, const std::map< wxString, std::unique_ptr< EPART > > &aParts)
LIB_SYMBOL * LoadSymbol(const wxString &aLibraryPath, const wxString &aAliasName, const std::map< std::string, UTF8 > *aProperties) override
Load a LIB_SYMBOL object having aPartName from the aLibraryPath containing a library format that this...
std::unordered_map< wxString, bool > m_userValue
deviceset/@uservalue for device.
int GetModifyHash() const override
Return the modification hash from the library cache.
std::map< wxString, int > m_netCounts
std::map< wxString, EAGLE_LIBRARY > m_eagleLibs
bool loadSymbol(const std::unique_ptr< ESYMBOL > &aEsymbol, std::unique_ptr< LIB_SYMBOL > &aSymbol, const std::unique_ptr< EDEVICE > &aDevice, int aGateNumber, const wxString &aGateName)
SCH_SHEET * getCurrentSheet()
void loadDrawing(const std::unique_ptr< EDRAWING > &aDrawing)
void EnumerateSymbolLib(wxArrayString &aSymbolNameList, const wxString &aLibraryPath, const std::map< std::string, UTF8 > *aProperties) override
Populate a list of LIB_SYMBOL alias names contained within the library aLibraryPath.
SCH_SHAPE * loadSymbolPolyLine(std::unique_ptr< LIB_SYMBOL > &aSymbol, const std::unique_ptr< EPOLYGON > &aPolygon, int aGateNumber)
std::vector< VECTOR2I > m_wireIntersections
Wires and labels of a single connection (segment in Eagle nomenclature)
std::map< VECTOR2I, std::set< const EDA_ITEM * > > m_connPoints
The fully parsed Eagle schematic file.
void loadSegments(const std::vector< std::unique_ptr< ESEGMENT > > &aSegments, const wxString &aNetName, const wxString &aNetClass)
bool checkConnections(const SCH_SYMBOL *aSymbol, const SCH_PIN *aPin) const
IO_RELEASER< SCH_IO > m_pi
PI to create KiCad symbol library.
SCH_SHAPE * loadRectangle(const std::unique_ptr< ERECT > &aRect)
void addBusEntries()
This function finds best way to place a bus entry symbol for when an Eagle wire segment ends on an Ea...
bool CanReadSchematicFile(const wxString &aFileName) const override
Checks if this SCH_IO can read the specified schematic file.
void addImplicitConnections(SCH_SYMBOL *aSymbol, SCH_SCREEN *aScreen, bool aUpdateSet)
Create net labels to emulate implicit connections in Eagle.
std::map< int, SCH_LAYER_ID > m_layerMap
SCH_LAYER_ID kiCadLayer(int aEagleLayer)
Return the matching layer or return LAYER_NOTES.
SCH_SHEET * LoadSchematicFile(const wxString &aFileName, SCHEMATIC *aSchematic, SCH_SHEET *aAppendToMe=nullptr, const std::map< std::string, UTF8 > *aProperties=nullptr) override
Load information from some input file format that this SCH_IO implementation knows about,...
SCH_PIN * loadPin(std::unique_ptr< LIB_SYMBOL > &aSymbol, const std::unique_ptr< EPIN > &aPin, int aGateNumber)
SCH_SHAPE * loadCircle(const std::unique_ptr< ECIRCLE > &aCircle)
wxFileName getLibFileName()
Checks if there are other wires or pins at the position of the tested pin.
SCH_SHAPE * loadSymbolRectangle(std::unique_ptr< LIB_SYMBOL > &aSymbol, const std::unique_ptr< ERECT > &aRectangle, int aGateNumber)
SCH_JUNCTION * loadJunction(const std::unique_ptr< EJUNCTION > &aJunction)
wxString m_version
Eagle file version.
void getEagleSymbolFieldAttributes(const std::unique_ptr< EINSTANCE > &aInstance, const wxString &aEagleFieldName, SCH_FIELD *aField)
std::map< wxString, const EPART * > m_partlist
void moveLabels(SCH_LINE *aWire, const VECTOR2I &aNewEndPoint)
Move any labels on the wire to the new end point of the wire.
bool checkHeader(const wxString &aFileName) const
SCHEMATIC * m_schematic
Passed to Load(), the schematic object being loaded.
void countNets(const ESCHEMATIC &aSchematic)
SCH_SHEET * m_rootSheet
The root sheet of the schematic being loaded.
SCH_SHAPE * loadPolyLine(const std::unique_ptr< EPOLYGON > &aPolygon)
SCH_SHAPE * loadSymbolCircle(std::unique_ptr< LIB_SYMBOL > &aSymbol, const std::unique_ptr< ECIRCLE > &aCircle, int aGateNumber)
SCH_SCREEN * getCurrentScreen()
bool CanReadLibrary(const wxString &aFileName) const override
Checks if this IO object can read the specified library file/directory.
std::map< wxString, EAGLE_MISSING_CMP > m_missingCmps
void loadFrame(const std::unique_ptr< EFRAME > &aFrame, std::vector< SCH_ITEM * > &aItems)
std::vector< SEG_DESC > m_segments
Nets as defined in the <nets> sections of an Eagle schematic file.
std::vector< EMODULE * > m_modules
The current module stack being loaded.
std::vector< EMODULEINST * > m_moduleInstances
SCH_ITEM * loadSymbolWire(std::unique_ptr< LIB_SYMBOL > &aSymbol, const std::unique_ptr< EWIRE > &aWire, int aGateNumber)
long long getLibraryTimestamp(const wxString &aLibraryPath) const
static const char * PropBuffering
The property used internally by the plugin to enable cache buffering which prevents the library file ...
virtual bool CanReadSchematicFile(const wxString &aFileName) const
Checks if this SCH_IO can read the specified schematic file.
SCH_IO(const wxString &aName)
Base class for any item which can be embedded within the SCHEMATIC container class,...
SCH_ITEM * Duplicate(bool addToParentGroup, SCH_COMMIT *aCommit=nullptr, bool doClone=false) const
Routine to create a new copy of given item.
virtual void SetUnit(int aUnit)
void SetShape(LABEL_FLAG_SHAPE aShape)
void SetPosition(const VECTOR2I &aPosition) override
Segment description base class to describe items which have 2 end points (track, wire,...
bool IsWire() const
Return true if the line is a wire.
const BOX2I GetBoundingBox() const override
Return the orthogonal bounding box of this object for display purposes.
VECTOR2I GetEndPoint() const
VECTOR2I GetStartPoint() const
bool IsBus() const
Return true if the line is a bus.
void SetEndPoint(const VECTOR2I &aPosition)
void SetNumber(const wxString &aNumber)
Container class that holds multiple SCH_SCREEN objects in a hierarchy.
void UpdateSymbolLinks(REPORTER *aReporter=nullptr)
Initialize the LIB_SYMBOL reference for each SCH_SYMBOL found in the full schematic.
const PAGE_INFO & GetPageSettings() const
void Append(SCH_ITEM *aItem, bool aUpdateLibSymbol=true)
void SetPageSettings(const PAGE_INFO &aPageSettings)
EE_RTREE & Items()
Get the full RTree, usually for iterating.
void SetFileName(const wxString &aFileName)
Set the file name for this screen to aFileName.
void Update(SCH_ITEM *aItem, bool aUpdateLibSymbol=true)
Update aItem's bounding box in the tree.
void SetPosition(const VECTOR2I &aPos) override
void SetStroke(const STROKE_PARAMS &aStroke) override
VECTOR2I GetCenter() const
void AddPoint(const VECTOR2I &aPosition)
VECTOR2I GetPosition() const override
A container for handling SCH_SHEET_PATH objects in a flattened hierarchy.
Handle access to a stack of flattened SCH_SHEET objects by way of a path for creating a flattened sch...
Define a sheet pin (label) used in sheets to create hierarchical schematics.
void SetPosition(const VECTOR2I &aPosition) override
void SetSide(SHEET_SIDE aEdge)
Sheet symbol placed in a schematic, and is the entry point for a sub schematic.
void SetFileName(const wxString &aFilename)
bool LocatePathOfScreen(SCH_SCREEN *aScreen, SCH_SHEET_PATH *aList)
Search the existing hierarchy for an instance of screen loaded from aFileName.
void SetName(const wxString &aName)
SCH_SCREEN * GetScreen() const
void AutoplaceFields(SCH_SCREEN *aScreen, AUTOPLACE_ALGO aAlgo) override
const std::vector< SCH_SYMBOL_INSTANCE > & GetInstances() const
void AddHierarchicalReference(const KIID_PATH &aPath, const wxString &aRef, int aUnit)
Add a full hierarchical reference to this symbol.
std::unique_ptr< LIB_SYMBOL > & GetLibSymbolRef()
VECTOR2I GetPinPhysicalPosition(const SCH_PIN *Pin) const
SCH_FIELD * GetField(FIELD_T aFieldType)
Return a mandatory field in this symbol.
VECTOR2I GetPosition() const override
void SetPosition(const VECTOR2I &aPosition) override
OPT_VECTOR2I Intersect(const SEG &aSeg, bool aIgnoreEndpoints=false, bool aLines=false) const
Compute intersection point of segment (this) with segment aSeg.
bool Contains(const SEG &aSeg) const
SHAPE_ARC & ConstructFromStartEndAngle(const VECTOR2I &aStart, const VECTOR2I &aEnd, const EDA_ANGLE &aAngle, double aWidth=0)
Construct this arc from the given start, end and angle.
int Append(int x, int y, int aOutline=-1, int aHole=-1, bool aAllowDuplication=false)
Appends a vertex at the end of the given outline/hole (default: the last outline)
Simple container to manage line stroke parameters.
An interface to the global shared library manager that is schematic-specific and linked to one projec...
std::optional< LIB_STATUS > LoadOne(LIB_DATA *aLib) override
Loads or reloads the given library, if it exists.
double Distance(const VECTOR2< extended_type > &aVector) const
Compute the distance between two vectors.
VECTOR2< T > Resize(T aNewLength) const
Return a vector of the same direction, but length specified in aNewLength.
static REPORTER & GetInstance()
#define DEFAULT_SCH_ENTRY_SIZE
The default text size in mils. (can be changed in preference menu)
wxString escapeName(const wxString &aNetName)
Translates Eagle special characters to their counterparts in KiCad.
wxString interpretText(const wxString &aText)
Interprets special characters in Eagle text and converts them to KiCAD notation.
size_t GetNodeCount(const wxXmlNode *aNode)
Fetch the number of XML nodes within aNode.
VECTOR2I ConvertArcCenter(const VECTOR2I &aStart, const VECTOR2I &aEnd, double aAngle)
Convert an Eagle curve end to a KiCad center for S_ARC.
wxString convertDescription(wxString aDescr)
Converts Eagle's HTML description into KiCad description format.
OPTIONAL_XML_ATTRIBUTE< double > opt_double
static constexpr EDA_ANGLE ANGLE_VERTICAL
#define IGNORE_PARENT_GROUP
#define IS_NEW
New item, just created.
@ RECTANGLE
Use RECTANGLE instead of RECT to avoid collision in a Windows header.
@ FILLED_SHAPE
Fill with object color.
@ ERCE_BUS_ENTRY_NEEDED
Importer failed to auto-place a bus entry.
static const std::string KiCadSchematicFileExtension
static const std::string KiCadSymbolLibFileExtension
#define THROW_IO_ERROR(msg)
macro which captures the "call site" values of FILE_, __FUNCTION & LINE
SCH_LAYER_ID
Eeschema drawing layers.
@ PT_INPUT
usual pin input: must be connected
@ PT_NC
not connected (must be left open)
@ PT_TRISTATE
tri state bus pin
@ PT_BIDI
input or output (like port for a microprocessor)
@ PT_OPENCOLLECTOR
pin type open collector
@ PT_POWER_IN
power input (GND, VCC for ICs). Must be connected to a power output.
@ PT_PASSIVE
pin for passive symbols: must be connected, and can be connected to any pin.
@ PIN_UP
The pin extends upwards from the connection point: Probably on the bottom side of the symbol.
@ PIN_RIGHT
The pin extends rightwards from the connection point.
@ PIN_LEFT
The pin extends leftwards from the connection point: Probably on the right side of the symbol.
@ PIN_DOWN
The pin extends downwards from the connection: Probably on the top side of the symbol.
static wxString extractNetName(const wxString &aPinName)
static const std::map< wxString, ELECTRICAL_PINTYPE > pinDirectionsMap
Map of EAGLE pin type values to KiCad pin type values.
static SYMBOL_ORIENTATION_T kiCadComponentRotation(float eagleDegrees)
static void eagleToKicadAlignment(EDA_TEXT *aText, int aEagleAlignment, int aRelDegress, bool aMirror, bool aSpin, int aAbsDegress)
static BOX2I getSheetBbox(SCH_SHEET *aSheet)
Extract the net name part from a pin name (e.g. return 'GND' for pin named 'GND@2')
Definition of the SCH_SHEET_PATH and SCH_SHEET_LIST classes for Eeschema.
SHEET_SIDE
Define the edge of the sheet that the sheet pin is positioned.
std::optional< VECTOR2I > OPT_VECTOR2I
wxString UnescapeString(const wxString &aSource)
bool ReplaceIllegalFileNameChars(std::string &aName, int aReplaceChar)
Checks aName for illegal file name characters.
wxString EscapeString(const wxString &aSource, ESCAPE_CONTEXT aContext)
The Escape/Unescape routines use HTML-entity-reference-style encoding to handle characters which are:...
wxString UnescapeHTML(const wxString &aString)
Return a new wxString unescaped from HTML format.
std::map< wxString, std::unique_ptr< LIB_SYMBOL > > KiCadSymbols
std::unordered_map< wxString, wxString > package
std::unordered_map< wxString, int > GateToUnitMap
Map Eagle gate unit number (which are strings) to KiCad library symbol unit number.
std::map< wxString, std::unique_ptr< EDEVICE_SET > > devicesets
wxString GetName() const
Fetch the fully unique library name.
std::map< wxString, std::unique_ptr< ESYMBOL > > symbols
std::map< wxString, std::unique_ptr< EMODULE > > modules
std::vector< std::unique_ptr< ESHEET > > sheets
std::map< wxString, std::unique_ptr< EPART > > parts
std::map< wxString, std::unique_ptr< ELIBRARY > > libraries
std::vector< std::unique_ptr< ETEXT > > texts
Map references to missing symbol units data.
const SCH_SYMBOL * cmp
Screen where the parent symbol is located.
std::map< int, bool > units
Segments representing wires for intersection checking.
std::vector< SCH_TEXT * > labels
const SEG * LabelAttached(const SCH_TEXT *aLabel) const
< Test if a particular label is attached to any of the stored segments
A simple container for schematic symbol instance information.
SYMBOL_ORIENTATION_T
enum used in RotationMiroir()
@ USER
The field ID hasn't been set yet; field is invalid.
@ FOOTPRINT
Field Name Module PCB, i.e. "16DIP300".
@ REFERENCE
Field Reference of part, i.e. "IC21".
@ VALUE
Field Value of part, i.e. "3.3K".
std::vector< std::string > header
std::vector< std::vector< std::string > > table
SHAPE_CIRCLE circle(c.m_circle_center, c.m_circle_radius)
bool TestSegmentHit(const VECTOR2I &aRefPoint, const VECTOR2I &aStart, const VECTOR2I &aEnd, int aDist)
Test if aRefPoint is with aDistance on the line defined by aStart and aEnd.
void RotatePoint(int *pX, int *pY, const EDA_ANGLE &aAngle)
Calculate the new point of coord coord pX, pY, for a rotation center 0, 0.
VECTOR2< int32_t > VECTOR2I
Definition of file extensions used in Kicad.