36#include <wx/wfstream.h>
55 wxFFileOutputStream stream( aOutFileName );
63 return xdoc.Save( stream, 2 );
112 wxString description;
114 nlohmann::ordered_map<wxString, wxString> fields;
125 wxString ref = aSymbol->
GetRef( &aSheet );
135 wxString ref2 = symbol2->
GetRef( &sheet );
137 if( ref2.CmpNoCase( ref ) != 0 )
147 if( !candidate.IsEmpty() && ( unit < minUnit || value.IsEmpty() ) )
153 if( !candidate.IsEmpty() && ( unit < minUnit || footprint.IsEmpty() ) )
154 footprint = candidate;
161 if( !candidate.IsEmpty() && ( unit < minUnit ||
datasheet.IsEmpty() ) )
169 if( !candidate.IsEmpty() && ( unit < minUnit || description.IsEmpty() ) )
170 description = candidate;
175 if( field.IsMandatory() || field.IsPrivate() )
178 if( unit < minUnit || fields.count( field.GetName() ) == 0 )
181 fields[field.GetName()] = field.GetShownText( &aSheet,
false );
183 fields[field.GetName()] = field.GetText();
187 minUnit = std::min( unit, minUnit );
207 description = descriptionField->
GetShownText( &aSheet,
false );
209 description = descriptionField->
GetText();
213 if( field.IsMandatory() || field.IsPrivate() )
217 fields[field.GetName()] = field.GetShownText( &aSheet,
false );
219 fields[field.GetName()] = field.GetText();
231 aNode->AddChild(
node( wxT(
"value" ), wxT(
"~" ) ) );
233 if( footprint.size() )
239 if( description.size() )
243 aNode->AddChild( xfields =
node( wxT(
"fields" ) ) );
245 for(
const auto& [ fieldName, fieldValue ] : fields )
249 xfields->AddChild( xfield );
256 XNODE* xcomps =
node( wxT(
"components" ) );
278 b->GetRef( &sheet,
false ),
true ) < 0 );
281 std::set<
SCH_SYMBOL*,
decltype( cmp )> ordered_symbols( cmp );
282 std::multiset<
SCH_SYMBOL*,
decltype( cmp )> extra_units( cmp );
287 auto test = ordered_symbols.insert( symbol );
291 if( ( *(
test.first ) )->m_Uuid > symbol->
m_Uuid )
293 extra_units.insert( *(
test.first ) );
294 ordered_symbols.erase(
test.first );
295 ordered_symbols.insert( symbol );
299 extra_units.insert( symbol );
304 for(
EDA_ITEM* item : ordered_symbols )
324 xcomps->AddChild( xcomp =
node( wxT(
"comp" ) ) );
330 xcomp->AddChild( xlibsource =
node( wxT(
"libsource" ) ) );
361 std::vector<SCH_FIELD>& fields = symbol->
GetFields();
365 if( field.IsMandatory() || field.IsPrivate() )
368 xcomp->AddChild( xproperty =
node( wxT(
"property" ) ) );
369 xproperty->
AddAttribute( wxT(
"name" ), field.GetCanonicalName() );
372 xproperty->
AddAttribute( wxT(
"value" ), field.GetShownText( &sheet,
false ) );
374 xproperty->
AddAttribute( wxT(
"value" ), field.GetText() );
377 for(
const SCH_FIELD& sheetField : sheet.Last()->GetFields() )
379 xcomp->AddChild( xproperty =
node( wxT(
"property" ) ) );
380 xproperty->
AddAttribute( wxT(
"name" ), sheetField.GetCanonicalName() );
385 xproperty->
AddAttribute( wxT(
"value" ), sheetField.GetShownText( &sheet,
false ) );
387 xproperty->
AddAttribute( wxT(
"value" ), sheetField.GetText() );
392 xcomp->AddChild( xproperty =
node( wxT(
"property" ) ) );
393 xproperty->
AddAttribute( wxT(
"name" ), wxT(
"exclude_from_bom" ) );
398 xcomp->AddChild( xproperty =
node( wxT(
"property" ) ) );
399 xproperty->
AddAttribute( wxT(
"name" ), wxT(
"exclude_from_board" ) );
404 xcomp->AddChild( xproperty =
node( wxT(
"property" ) ) );
405 xproperty->
AddAttribute( wxT(
"name" ), wxT(
"exclude_from_pos_files" ) );
410 xcomp->AddChild( xproperty =
node( wxT(
"property" ) ) );
418 const bool baseDnp = symbol->
GetDNP( &sheet );
422 XNODE* xvariants =
nullptr;
424 for(
const auto& [variantName, variant] : instance.
m_Variants )
426 XNODE* xvariant =
node( wxT(
"variant" ) );
427 bool hasVariantData =
false;
431 if( variant.m_DNP != baseDnp )
433 XNODE* xvarprop =
node( wxT(
"property" ) );
435 xvarprop->
AddAttribute( wxT(
"value" ), variant.m_DNP ? wxT(
"1" ) : wxT(
"0" ) );
436 xvariant->AddChild( xvarprop );
437 hasVariantData =
true;
440 if( variant.m_ExcludedFromBOM != baseExcludedFromBOM )
442 XNODE* xvarprop =
node( wxT(
"property" ) );
443 xvarprop->
AddAttribute( wxT(
"name" ), wxT(
"exclude_from_bom" ) );
444 xvarprop->
AddAttribute( wxT(
"value" ), variant.m_ExcludedFromBOM ? wxT(
"1" ) : wxT(
"0" ) );
445 xvariant->AddChild( xvarprop );
446 hasVariantData =
true;
449 if( variant.m_ExcludedFromSim != baseExcludedFromSim )
451 XNODE* xvarprop =
node( wxT(
"property" ) );
452 xvarprop->
AddAttribute( wxT(
"name" ), wxT(
"exclude_from_sim" ) );
453 xvarprop->
AddAttribute( wxT(
"value" ), variant.m_ExcludedFromSim ? wxT(
"1" ) : wxT(
"0" ) );
454 xvariant->AddChild( xvarprop );
455 hasVariantData =
true;
458 if( variant.m_ExcludedFromPosFiles != baseExcludedFromPosFiles )
460 XNODE* xvarprop =
node( wxT(
"property" ) );
461 xvarprop->
AddAttribute( wxT(
"name" ), wxT(
"exclude_from_pos_files" ) );
462 xvarprop->
AddAttribute( wxT(
"value" ), variant.m_ExcludedFromPosFiles ? wxT(
"1" ) : wxT(
"0" ) );
463 xvariant->AddChild( xvarprop );
464 hasVariantData =
true;
467 if( !variant.m_Fields.empty() )
469 XNODE* xfields =
nullptr;
471 for(
const auto& [fieldName, fieldValue] : variant.m_Fields )
473 const wxString baseValue =
474 symbol->
GetFieldText( fieldName, &sheet, wxEmptyString );
476 if( fieldValue == baseValue )
480 xfields =
node( wxT(
"fields" ) );
482 wxString resolvedValue = fieldValue;
485 resolvedValue = symbol->
ResolveText( fieldValue, &sheet );
489 xfields->AddChild( xfield );
490 hasVariantData =
true;
494 xvariant->AddChild( xfields );
500 xvariants =
node( wxT(
"variants" ) );
502 xvariants->AddChild( xvariant );
511 xcomp->AddChild( xvariants );
514 if(
const std::unique_ptr<LIB_SYMBOL>& part = symbol->
GetLibSymbolRef() )
516 if( part->GetKeyWords().size() )
518 xcomp->AddChild( xproperty =
node( wxT(
"property" ) ) );
519 xproperty->
AddAttribute( wxT(
"name" ), wxT(
"ki_keywords" ) );
520 xproperty->
AddAttribute( wxT(
"value" ), part->GetKeyWords() );
523 if( !part->GetFPFilters().IsEmpty() )
527 for(
const wxString&
filter : part->GetFPFilters() )
530 xcomp->AddChild( xproperty =
node( wxT(
"property" ) ) );
531 xproperty->
AddAttribute( wxT(
"name" ), wxT(
"ki_fp_filters" ) );
532 xproperty->
AddAttribute( wxT(
"value" ), filters.Trim(
false ) );
535 if( part->GetDuplicatePinNumbersAreJumpers() )
536 xcomp->AddChild(
node( wxT(
"duplicate_pin_numbers_are_jumpers" ), wxT(
"1" ) ) );
538 const std::vector<std::set<wxString>>& jumperGroups = part->JumperPinGroups();
540 if( !jumperGroups.empty() )
543 xcomp->AddChild( xproperty =
node( wxT(
"jumper_pin_groups" ) ) );
545 for(
const std::set<wxString>&
group : jumperGroups )
547 xproperty->AddChild( groupNode =
node( wxT(
"group" ) ) );
549 for(
const wxString& pinName :
group )
550 groupNode->AddChild(
node( wxT(
"pin" ), pinName ) );
556 xcomp->AddChild( xsheetpath =
node( wxT(
"sheetpath" ) ) );
558 xsheetpath->
AddAttribute( wxT(
"names" ), sheet.PathHumanReadable() );
559 xsheetpath->
AddAttribute( wxT(
"tstamps" ), sheet.PathAsString() );
562 std::vector<wxString> compClassNames =
565 if( compClassNames.size() > 0 )
567 XNODE* xcompclasslist;
568 xcomp->AddChild( xcompclasslist =
node( wxT(
"component_classes" ) ) );
570 for(
const wxString& compClass : compClassNames )
577 xcomp->AddChild( xunits =
node( wxT(
"tstamps" ) ) );
579 auto range = extra_units.equal_range( symbol );
583 for(
auto it = range.first; it != range.second; ++it )
585 uuid = ( *it )->m_Uuid.AsString();
592 xunits->AddChild(
new XNODE( wxXML_TEXT_NODE, wxEmptyString, uuid ) );
597 xunits->AddChild(
new XNODE( wxXML_TEXT_NODE, wxEmptyString, uuid ) );
601 xcomp->AddChild( xunitInfo =
node( wxT(
"units" ) ) );
611 xunitInfo->AddChild( xunit =
node( wxT(
"unit" ) ) );
612 xunit->
AddAttribute( wxT(
"name" ), unitInfo.m_unitName );
615 xunit->AddChild( xpins =
node( wxT(
"pins" ) ) );
617 for(
const wxString& number : unitInfo.m_pinNumbers )
620 xpins->AddChild( xpin =
node( wxT(
"pin" ) ) );
656 xcomps->AddChild( xgroup =
node( wxT(
"group" ) ) );
663 xgroup->AddChild( xmembers =
node( wxT(
"members" ) ) );
670 xmembers->AddChild( xmember =
node( wxT(
"member" ) ) );
671 xmember->
AddAttribute( wxT(
"uuid" ), member->m_Uuid.AsString() );
685 XNODE* xvariants =
node( wxT(
"variants" ) );
687 std::set<wxString> variantNames =
m_schematic->GetVariantNames();
689 for(
const wxString& variantName : variantNames )
692 xvariants->AddChild( xvariant =
node( wxT(
"variant" ) ) );
695 wxString description =
m_schematic->GetVariantDescription( variantName );
697 if( !description.IsEmpty() )
698 xvariant->
AddAttribute( wxT(
"description" ), description );
708 std::vector<SCH_SHEET_PATH> symbolSheets;
709 symbolSheets.push_back( aSymbolSheet );
716 const wxString ref = aSymbol->
GetRef( &aSymbolSheet );
724 wxString ref2 = symbol2->
GetRef( &sheet );
727 if( ref2.CmpNoCase( ref ) != 0 )
730 if( otherUnit == primaryUnit )
733 symbolSheets.push_back( sheet );
735 std::unordered_set<wxString> otherClassNames =
737 compClassNames.insert( otherClassNames.begin(), otherClassNames.end() );
747 if( symbolSheetPath.IsContainedWithin( sheetPath ) )
749 compClassNames.insert( sheetCompClasses.begin(), sheetCompClasses.end() );
754 std::vector<wxString> sortedCompClassNames( compClassNames.begin(), compClassNames.end() );
755 std::sort( sortedCompClassNames.begin(), sortedCompClassNames.end(),
756 [](
const wxString& str1,
const wxString& str2 )
758 return str1.Cmp( str2 ) < 0;
761 return sortedCompClassNames;
768 XNODE* xdesign =
node( wxT(
"design" ) );
774 wxFileName sourceFileName;
777 xdesign->AddChild(
node( wxT(
"source" ),
m_schematic->GetFileName() ) );
784 const std::map<wxString, wxString>& properties =
m_schematic->Project().GetTextVars();
786 for(
const std::pair<const wxString, wxString>& prop : properties )
788 xdesign->AddChild( xtextvar =
node( wxT(
"textvar" ), prop.second ) );
795 unsigned sheetIndex = 1;
799 screen = sheet.LastScreen();
801 xdesign->AddChild( xsheet =
node( wxT(
"sheet" ) ) );
804 sheetTxt.Printf( wxT(
"%u" ), sheetIndex++ );
806 xsheet->
AddAttribute( wxT(
"name" ), sheet.PathHumanReadable() );
807 xsheet->
AddAttribute( wxT(
"tstamps" ), sheet.PathAsString() );
812 xsheet->AddChild( xtitleBlock =
node( wxT(
"title_block" ) ) );
820 sourceFileName = wxFileName( screen->
GetFileName() );
821 xtitleBlock->AddChild(
node( wxT(
"source" ), sourceFileName.GetFullName() ) );
823 xtitleBlock->AddChild( xcomment =
node( wxT(
"comment" ) ) );
827 xtitleBlock->AddChild( xcomment =
node( wxT(
"comment" ) ) );
831 xtitleBlock->AddChild( xcomment =
node( wxT(
"comment" ) ) );
835 xtitleBlock->AddChild( xcomment =
node( wxT(
"comment" ) ) );
839 xtitleBlock->AddChild( xcomment =
node( wxT(
"comment" ) ) );
843 xtitleBlock->AddChild( xcomment =
node( wxT(
"comment" ) ) );
847 xtitleBlock->AddChild( xcomment =
node( wxT(
"comment" ) ) );
851 xtitleBlock->AddChild( xcomment =
node( wxT(
"comment" ) ) );
855 xtitleBlock->AddChild( xcomment =
node( wxT(
"comment" ) ) );
866 XNODE* xlibs =
node( wxT(
"libraries" ) );
871 wxString libNickname = *it;
878 xlibs->AddChild( xlibrary =
node( wxT(
"library" ) ) );
879 xlibrary->
AddAttribute( wxT(
"logical" ), libNickname );
880 xlibrary->AddChild(
node( wxT(
"uri" ), *uri ) );
892 XNODE* xlibparts =
node( wxT(
"libparts" ) );
893 std::vector<SCH_FIELD*> fieldList;
899 wxString libNickname = lcomp->GetLibId().GetLibNickname();;
902 if( !libNickname.IsEmpty() )
906 xlibparts->AddChild( xlibpart =
node( wxT(
"libpart" ) ) );
908 xlibpart->
AddAttribute( wxT(
"part" ), lcomp->GetName() );
911 if( !lcomp->GetDescription().IsEmpty() )
912 xlibpart->AddChild(
node( wxT(
"description" ), lcomp->GetDescription() ) );
914 if( !lcomp->GetDatasheetField().GetText().IsEmpty() )
915 xlibpart->AddChild(
node( wxT(
"docs" ), lcomp->GetDatasheetField().GetText() ) );
918 if( lcomp->GetFPFilters().GetCount() )
921 xlibpart->AddChild( xfootprints =
node( wxT(
"footprints" ) ) );
923 for(
unsigned i = 0; i < lcomp->GetFPFilters().GetCount(); ++i )
925 if( !lcomp->GetFPFilters()[i].IsEmpty() )
926 xfootprints->AddChild(
node( wxT(
"fp" ), lcomp->GetFPFilters()[i] ) );
932 lcomp->GetFields( fieldList );
935 xlibpart->AddChild( xfields =
node(
"fields" ) );
937 for(
const SCH_FIELD* field : fieldList )
940 xfields->AddChild( xfield =
node( wxT(
"field" ), field->GetText() ) );
941 xfield->
AddAttribute( wxT(
"name" ), field->GetCanonicalName() );
947 std::vector<SCH_PIN*> pinList = lcomp->GetGraphicalPins( 0, 0 );
959 for(
int ii = 0; ii < (int)pinList.size()-1; ii++ )
961 if( pinList[ii]->GetNumber() == pinList[ii+1]->GetNumber() )
963 pinList.erase(pinList.begin() + ii + 1);
968 wxLogTrace(
"CVPCB_PINCOUNT",
969 wxString::Format(
"makeLibParts: lib='%s' part='%s' pinList(size)=%zu",
970 libNickname, lcomp->GetName(), pinList.size() ) );
976 xlibpart->AddChild( pins =
node( wxT(
"pins" ) ) );
978 for(
unsigned i=0; i<pinList.size(); ++i )
982 bool stackedValid =
false;
986 if( stackedValid && !expandedNums.empty() )
988 for(
const wxString& num : expandedNums )
991 pins->AddChild(
pin =
node( wxT(
"pin" ) ) );
992 pin->AddAttribute( wxT(
"num" ), num );
996 wxLogTrace(
"CVPCB_PINCOUNT",
997 wxString::Format(
"makeLibParts: -> pin num='%s' name='%s' (expanded)",
1004 pins->AddChild(
pin =
node( wxT(
"pin" ) ) );
1009 wxLogTrace(
"CVPCB_PINCOUNT",
1010 wxString::Format(
"makeLibParts: -> pin num='%s' name='%s'",
1026 wxString netCodeTxt;
1028 XNODE* xnet =
nullptr;
1050 NET_RECORD(
const wxString& aName ) :
1052 m_HasNoConnect(
false )
1057 bool m_HasNoConnect;
1058 std::vector<NET_NODE> m_Nodes;
1061 std::vector<NET_RECORD*> nets;
1063 for(
const auto& [ key, subgraphs ] :
m_schematic->ConnectionGraph()->GetNetMap() )
1065 wxString net_name = key.Name;
1066 NET_RECORD* net_record =
nullptr;
1071 if( subgraphs.empty() )
1074 nets.emplace_back(
new NET_RECORD( net_name ) );
1075 net_record = nets.back();
1079 bool nc = subgraph->GetNoConnect() && subgraph->GetNoConnect()->Type() ==
SCH_NO_CONNECT_T;
1082 if( net_record->m_Class.IsEmpty() && subgraph->GetDriver() )
1084 if( subgraph->GetDriver()->GetEffectiveNetClass() )
1086 net_record->m_Class = subgraph->GetDriver()->GetEffectiveNetClass()->GetName();
1092 net_record->m_HasNoConnect =
true;
1094 for(
SCH_ITEM* item : subgraph->GetItems() )
1112 net_record->m_Nodes.emplace_back(
pin, sheet );
1119 std::sort( nets.begin(), nets.end(),
1120 [](
const NET_RECORD* a,
const NET_RECORD*b )
1122 return StrNumCmp( a->m_Name, b->m_Name ) < 0;
1125 for(
int i = 0; i < (int) nets.size(); ++i )
1127 NET_RECORD* net_record = nets[i];
1132 std::sort( net_record->m_Nodes.begin(), net_record->m_Nodes.end(),
1133 [](
const NET_NODE& a,
const NET_NODE& b )
1135 wxString refA = a.m_Pin->GetParentSymbol()->GetRef( &a.m_Sheet );
1136 wxString refB = b.m_Pin->GetParentSymbol()->GetRef( &b.m_Sheet );
1139 return a.m_Pin->GetShownNumber() < b.m_Pin->GetShownNumber();
1148 [](
const NET_NODE& a,
const NET_NODE& b )
1150 wxString refA = a.m_Pin->GetParentSymbol()->GetRef( &a.m_Sheet );
1151 wxString refB = b.m_Pin->GetParentSymbol()->GetRef( &b.m_Sheet );
1153 return refA == refB && a.m_Pin->GetShownNumber() == b.m_Pin->GetShownNumber();
1158 bool allNetPinsStacked =
true;
1160 if( net_record->m_Nodes.size() > 1 )
1162 SCH_PIN* firstPin = net_record->m_Nodes.begin()->m_Pin;
1164 std::all_of( net_record->m_Nodes.begin() + 1, net_record->m_Nodes.end(),
1167 return firstPin->GetParent() == node.m_Pin->GetParent()
1168 && firstPin->GetPosition() == node.m_Pin->GetPosition()
1169 && firstPin->GetName() == node.m_Pin->GetName();
1173 for(
const NET_NODE& netNode : net_record->m_Nodes )
1175 wxString refText = netNode.m_Pin->GetParentSymbol()->GetRef( &netNode.m_Sheet );
1178 if( refText[0] == wxChar(
'#' ) )
1183 netCodeTxt.Printf( wxT(
"%d" ), i + 1 );
1185 xnets->AddChild( xnet =
node( wxT(
"net" ) ) );
1187 xnet->
AddAttribute( wxT(
"name" ), net_record->m_Name );
1188 xnet->
AddAttribute( wxT(
"class" ), net_record->m_Class );
1193 std::vector<wxString> nums = netNode.m_Pin->GetStackedPinNumbers();
1194 wxString baseName = netNode.m_Pin->GetShownName();
1195 wxString pinType = netNode.m_Pin->GetCanonicalElectricalTypeName();
1198 wxString::Format(
"XML: net='%s' ref='%s' base='%s' shownNum='%s' expand=%zu",
1199 net_record->m_Name, refText, baseName,
1200 netNode.m_Pin->GetShownNumber(), nums.size() ) );
1202 for(
const wxString& num : nums )
1204 xnet->AddChild( xnode =
node( wxT(
"node" ) ) );
1208 wxString fullName = baseName.IsEmpty() ? num : baseName + wxT(
"_" ) + num;
1210 if( !baseName.IsEmpty() || nums.size() > 1 )
1213 wxString typeAttr = pinType;
1215 if( net_record->m_HasNoConnect
1216 && ( net_record->m_Nodes.size() == 1 || allNetPinsStacked ) )
1218 typeAttr += wxT(
"+no_connect" );
1220 wxString::Format(
"XML: marking node ref='%s' pin='%s' as no_connect",
1229 for( NET_RECORD* record : nets )
1237 const wxString& aTextualContent )
1239 XNODE* n =
new XNODE( wxXML_ELEMENT_NODE, aName );
1241 if( aTextualContent.Len() > 0 )
1242 n->AddChild(
new XNODE( wxXML_TEXT_NODE, wxEmptyString, aTextualContent ) );
1259 auto getComponentClassFields = [&](
const std::vector<SCH_FIELD>& fields,
const SCH_SHEET_PATH* sheetPath )
1261 std::unordered_set<wxString> componentClasses;
1265 if( field.GetCanonicalName() == wxT(
"Component Class" ) )
1267 if( field.GetShownText( sheetPath,
false ) != wxEmptyString )
1268 componentClasses.insert( field.GetShownText( sheetPath,
false ) );
1272 return componentClasses;
1280 std::unordered_set<wxString> sheetComponentClasses;
1281 const std::unordered_set<SCH_RULE_AREA*>& sheetRuleAreas = sheetItem->
GetRuleAreaCache();
1287 std::unordered_set<wxString> ruleAreaComponentClasses =
1288 getComponentClassFields( label->GetFields(), &sheet );
1289 sheetComponentClasses.insert( ruleAreaComponentClasses.begin(), ruleAreaComponentClasses.end() );
wxString GetBuildVersion()
Get the full KiCad version string.
A subgraph is a set of items that are electrically connected on a single sheet.
A base class for most all the KiCad significant classes used in schematics and boards.
wxString AsString() const
std::optional< wxString > GetFullURI(LIBRARY_TABLE_TYPE aType, const wxString &aNickname, bool aSubstituted=false) const
Return the full location specifying URI for the LIB, either in original UI form or in environment var...
const wxString GetUniStringLibItemName() const
Get strings for display messages in dialogs.
const wxString GetUniStringLibNickname() const
Define a library symbol object.
SCHEMATIC * m_schematic
The schematic we're generating a netlist for.
SCH_SYMBOL * findNextSymbol(EDA_ITEM *aItem, const SCH_SHEET_PATH &aSheetPath)
Check if the given symbol should be processed for netlisting.
std::set< LIB_SYMBOL *, LIB_SYMBOL_LESS_THAN > m_libParts
unique library symbols used. LIB_SYMBOL items are sorted by names
UNIQUE_STRINGS m_referencesAlreadyFound
Used for "multiple symbols per package" symbols to avoid processing a lib symbol more than once.
void getSheetComponentClasses()
std::map< SCH_SHEET_PATH, std::unordered_set< wxString > > m_sheetComponentClasses
Map of all sheets to component classes covering the whole sheet.
XNODE * makeDesignHeader()
Fill out a project "design" header into an XML node.
XNODE * makeLibraries()
Fill out an XML node with a list of used libraries and returns it.
bool WriteNetlist(const wxString &aOutFileName, unsigned aNetlistOptions, REPORTER &aReporter) override
Write generic netlist to aOutFileName.
XNODE * node(const wxString &aName, const wxString &aTextualContent=wxEmptyString)
A convenience function that creates a new XNODE with an optional textual child.
XNODE * makeListOfNets(unsigned aCtl)
Fill out an XML node with a list of nets and returns it.
void addSymbolFields(XNODE *aNode, SCH_SYMBOL *aSymbol, const SCH_SHEET_PATH &aSheet, const SCH_SHEET_LIST &aSheetList)
Holder for multi-unit symbol fields.
std::vector< wxString > getComponentClassNamesForAllSymbolUnits(SCH_SYMBOL *aSymbol, const SCH_SHEET_PATH &aSymbolSheet, const SCH_SHEET_LIST &aSheetList)
Finds all component class names attached to any sub-unit of a given symbol.
XNODE * makeSymbols(unsigned aCtl)
XNODE * makeRoot(unsigned aCtl=GNL_ALL)
Build the entire document tree for the generic export.
std::set< wxString > m_libraries
XNODE * makeLibParts()
Fill out an XML node with the unique library parts and returns it.
virtual LIBRARY_MANAGER & GetLibraryManager() const
Container for project specific data.
A pure virtual class used to derive REPORTER objects from.
virtual const wxString & GetText() const override
Return the string associated with the text object.
wxString GetShownText(const SCH_SHEET_PATH *aPath, bool aAllowExtraText, int aDepth=0, const wxString &aVariantName=wxEmptyString) const
A set of SCH_ITEMs (i.e., without duplicates).
Base class for any item which can be embedded within the SCHEMATIC container class,...
bool ResolveExcludedFromPosFiles(const SCH_SHEET_PATH *aInstance=nullptr, const wxString &aVariantName=wxEmptyString) const
const std::unordered_set< SCH_RULE_AREA * > & GetRuleAreaCache() const
Get the cache of rule areas enclosing this item.
bool ResolveExcludedFromBOM(const SCH_SHEET_PATH *aInstance=nullptr, const wxString &aVariantName=wxEmptyString) const
wxString ResolveText(const wxString &aText, const SCH_SHEET_PATH *aPath, int aDepth=0) const
bool ResolveExcludedFromBoard(const SCH_SHEET_PATH *aInstance=nullptr, const wxString &aVariantName=wxEmptyString) const
bool ResolveDNP(const SCH_SHEET_PATH *aInstance=nullptr, const wxString &aVariantName=wxEmptyString) const
wxString GetShownNumber() const
std::vector< wxString > GetStackedPinNumbers(bool *aValid=nullptr) const
wxString GetCanonicalElectricalTypeName() const
wxString GetShownName() const
const wxString & GetFileName() const
const TITLE_BLOCK & GetTitleBlock() const
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...
bool GetExcludedFromBOM() const
const SCH_SHEET * GetSheet(unsigned aIndex) const
bool GetExcludedFromBoard() const
void push_back(SCH_SHEET *aSheet)
Forwarded method from std::vector.
Sheet symbol placed in a schematic, and is the entry point for a sub schematic.
wxString GetDescription() const override
bool GetExcludedFromSim(const SCH_SHEET_PATH *aInstance=nullptr, const wxString &aVariantName=wxEmptyString) const override
bool UseLibIdLookup() const
wxString GetFieldText(const wxString &aFieldName, const SCH_SHEET_PATH *aPath=nullptr, const wxString &aVariantName=wxEmptyString) const
wxString GetSchSymbolLibraryName() const
bool GetExcludedFromBOM(const SCH_SHEET_PATH *aInstance=nullptr, const wxString &aVariantName=wxEmptyString) const override
const wxString GetValue(bool aResolve, const SCH_SHEET_PATH *aPath, bool aAllowExtraText, const wxString &aVariantName=wxEmptyString) const override
void GetFields(std::vector< SCH_FIELD * > &aVector, bool aVisibleOnly) const override
Populate a std::vector with SCH_FIELDs, sorted in ordinal order.
const wxString GetFootprintFieldText(bool aResolve, const SCH_SHEET_PATH *aPath, bool aAllowExtraText) const
wxString GetShownDescription(int aDepth=0) const override
const LIB_ID & GetLibId() const override
bool GetExcludedFromPosFiles(const SCH_SHEET_PATH *aInstance=nullptr, const wxString &aVariantName=wxEmptyString) const override
bool GetInstance(SCH_SYMBOL_INSTANCE &aInstance, const KIID_PATH &aSheetPath, bool aTestFromEnd=false) const
int GetUnitSelection(const SCH_SHEET_PATH *aSheet) const
Return the instance-specific unit selection for the given sheet path.
int GetUnitCount() const override
Return the number of units per package of the symbol.
std::unique_ptr< LIB_SYMBOL > & GetLibSymbolRef()
std::unordered_set< wxString > GetComponentClassNames(const SCH_SHEET_PATH *aPath) const
Return the component classes this symbol belongs in.
virtual bool GetDNP(const SCH_SHEET_PATH *aInstance=nullptr, const wxString &aVariantName=wxEmptyString) const override
Set or clear the 'Do Not Populate' flag.
const wxString GetRef(const SCH_SHEET_PATH *aSheet, bool aIncludeUnit=false) const override
SCH_FIELD * GetField(FIELD_T aFieldType)
Return a mandatory field in this symbol.
Hold the information shown in the lower right corner of a plot, printout, or editing view.
const wxString & GetCompany() const
const wxString & GetRevision() const
const wxString & GetDate() const
const wxString & GetComment(int aIdx) const
const wxString & GetTitle() const
An extension of wxXmlNode that can format its contents as KiCad-style s-expressions.
void AddAttribute(const wxString &aName, const wxString &aValue) override
wxString ExpandTextVars(const wxString &aSource, const PROJECT *aProject, int aFlags)
const wxChar *const traceStackedPins
Flag to enable debug output for stacked pins handling in symbol/pin code.
void remove_duplicates(_Container &__c)
Deletes all duplicate values from __c.
static bool sortPinsByNumber(SCH_PIN *aPin1, SCH_PIN *aPin2)
PGM_BASE & Pgm()
The global program "get" accessor.
Class to handle a set of SCH_ITEMs.
int StrNumCmp(const wxString &aString1, const wxString &aString2, bool aIgnoreCase)
Compare two strings with alphanumerical content.
wxString UnescapeString(const wxString &aSource)
wxString GetISO8601CurrentDateTime()
A simple container for schematic symbol instance information.
std::map< wxString, SCH_SYMBOL_VARIANT > m_Variants
A list of symbol variants.
@ DESCRIPTION
Field Description of part, i.e. "1/4W 1% Metal Film Resistor".
@ FOOTPRINT
Field Name Module PCB, i.e. "16DIP300".
@ DATASHEET
name of datasheet
wxString GetCanonicalFieldName(FIELD_T aFieldType)
wxLogTrace helper definitions.