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;
160 if( !candidate.IsEmpty() && ( unit < minUnit ||
datasheet.IsEmpty() ) )
167 if( !candidate.IsEmpty() && ( unit < minUnit || description.IsEmpty() ) )
168 description = candidate;
173 if( field.IsMandatory() || field.IsPrivate() )
176 if( unit < minUnit || fields.count( field.GetName() ) == 0 )
179 fields[field.GetName()] = field.GetShownText( &aSheet,
false );
181 fields[field.GetName()] = field.GetText();
185 minUnit = std::min( unit, minUnit );
205 description = descriptionField->
GetShownText( &aSheet,
false );
207 description = descriptionField->
GetText();
211 if( field.IsMandatory() || field.IsPrivate() )
215 fields[field.GetName()] = field.GetShownText( &aSheet,
false );
217 fields[field.GetName()] = field.GetText();
229 aNode->AddChild(
node( wxT(
"value" ), wxT(
"~" ) ) );
231 if( footprint.size() )
237 if( description.size() )
241 aNode->AddChild( xfields =
node( wxT(
"fields" ) ) );
243 for(
const auto& [ fieldName, fieldValue ] : fields )
247 xfields->AddChild( xfield );
254 XNODE* xcomps =
node( wxT(
"components" ) );
276 b->GetRef( &sheet,
false ),
true ) < 0 );
279 std::set<
SCH_SYMBOL*,
decltype( cmp )> ordered_symbols( cmp );
280 std::multiset<
SCH_SYMBOL*,
decltype( cmp )> extra_units( cmp );
285 auto test = ordered_symbols.insert( symbol );
289 if( ( *(
test.first ) )->m_Uuid > symbol->
m_Uuid )
291 extra_units.insert( *(
test.first ) );
292 ordered_symbols.erase(
test.first );
293 ordered_symbols.insert( symbol );
297 extra_units.insert( symbol );
302 for(
EDA_ITEM* item : ordered_symbols )
322 xcomps->AddChild( xcomp =
node( wxT(
"comp" ) ) );
328 xcomp->AddChild( xlibsource =
node( wxT(
"libsource" ) ) );
359 std::vector<SCH_FIELD>& fields = symbol->
GetFields();
363 if( field.IsMandatory() || field.IsPrivate() )
366 xcomp->AddChild( xproperty =
node( wxT(
"property" ) ) );
367 xproperty->
AddAttribute( wxT(
"name" ), field.GetCanonicalName() );
370 xproperty->
AddAttribute( wxT(
"value" ), field.GetShownText( &sheet,
false ) );
372 xproperty->
AddAttribute( wxT(
"value" ), field.GetText() );
375 for(
const SCH_FIELD& sheetField : sheet.Last()->GetFields() )
377 xcomp->AddChild( xproperty =
node( wxT(
"property" ) ) );
378 xproperty->
AddAttribute( wxT(
"name" ), sheetField.GetCanonicalName() );
383 xproperty->
AddAttribute( wxT(
"value" ), sheetField.GetShownText( &sheet,
false ) );
385 xproperty->
AddAttribute( wxT(
"value" ), sheetField.GetText() );
390 xcomp->AddChild( xproperty =
node( wxT(
"property" ) ) );
391 xproperty->
AddAttribute( wxT(
"name" ), wxT(
"exclude_from_bom" ) );
396 xcomp->AddChild( xproperty =
node( wxT(
"property" ) ) );
397 xproperty->
AddAttribute( wxT(
"name" ), wxT(
"exclude_from_board" ) );
402 xcomp->AddChild( xproperty =
node( wxT(
"property" ) ) );
403 xproperty->
AddAttribute( wxT(
"name" ), wxT(
"exclude_from_pos_files" ) );
406 if( symbol->
ResolveDNP( &sheet ) || sheet.GetDNP() )
408 xcomp->AddChild( xproperty =
node( wxT(
"property" ) ) );
416 const bool baseDnp = symbol->
GetDNP( &sheet );
420 XNODE* xvariants =
nullptr;
422 for(
const auto& [variantName, variant] : instance.
m_Variants )
424 XNODE* xvariant =
node( wxT(
"variant" ) );
425 bool hasVariantData =
false;
429 if( variant.m_DNP != baseDnp )
431 XNODE* xvarprop =
node( wxT(
"property" ) );
433 xvarprop->
AddAttribute( wxT(
"value" ), variant.m_DNP ? wxT(
"1" ) : wxT(
"0" ) );
434 xvariant->AddChild( xvarprop );
435 hasVariantData =
true;
438 if( variant.m_ExcludedFromBOM != baseExcludedFromBOM )
440 XNODE* xvarprop =
node( wxT(
"property" ) );
441 xvarprop->
AddAttribute( wxT(
"name" ), wxT(
"exclude_from_bom" ) );
442 xvarprop->
AddAttribute( wxT(
"value" ), variant.m_ExcludedFromBOM ? wxT(
"1" ) : wxT(
"0" ) );
443 xvariant->AddChild( xvarprop );
444 hasVariantData =
true;
447 if( variant.m_ExcludedFromSim != baseExcludedFromSim )
449 XNODE* xvarprop =
node( wxT(
"property" ) );
450 xvarprop->
AddAttribute( wxT(
"name" ), wxT(
"exclude_from_sim" ) );
451 xvarprop->
AddAttribute( wxT(
"value" ), variant.m_ExcludedFromSim ? wxT(
"1" ) : wxT(
"0" ) );
452 xvariant->AddChild( xvarprop );
453 hasVariantData =
true;
456 if( variant.m_ExcludedFromPosFiles != baseExcludedFromPosFiles )
458 XNODE* xvarprop =
node( wxT(
"property" ) );
459 xvarprop->
AddAttribute( wxT(
"name" ), wxT(
"exclude_from_pos_files" ) );
460 xvarprop->
AddAttribute( wxT(
"value" ), variant.m_ExcludedFromPosFiles ? wxT(
"1" ) : wxT(
"0" ) );
461 xvariant->AddChild( xvarprop );
462 hasVariantData =
true;
465 if( !variant.m_Fields.empty() )
467 XNODE* xfields =
nullptr;
469 for(
const auto& [fieldName, fieldValue] : variant.m_Fields )
471 const wxString baseValue =
472 symbol->
GetFieldText( fieldName, &sheet, wxEmptyString );
474 if( fieldValue == baseValue )
478 xfields =
node( wxT(
"fields" ) );
480 wxString resolvedValue = fieldValue;
483 resolvedValue = symbol->
ResolveText( fieldValue, &sheet );
487 xfields->AddChild( xfield );
488 hasVariantData =
true;
492 xvariant->AddChild( xfields );
498 xvariants =
node( wxT(
"variants" ) );
500 xvariants->AddChild( xvariant );
509 xcomp->AddChild( xvariants );
512 if(
const std::unique_ptr<LIB_SYMBOL>& part = symbol->
GetLibSymbolRef() )
514 if( part->GetKeyWords().size() )
516 xcomp->AddChild( xproperty =
node( wxT(
"property" ) ) );
517 xproperty->
AddAttribute( wxT(
"name" ), wxT(
"ki_keywords" ) );
518 xproperty->
AddAttribute( wxT(
"value" ), part->GetKeyWords() );
521 if( !part->GetFPFilters().IsEmpty() )
525 for(
const wxString&
filter : part->GetFPFilters() )
528 xcomp->AddChild( xproperty =
node( wxT(
"property" ) ) );
529 xproperty->
AddAttribute( wxT(
"name" ), wxT(
"ki_fp_filters" ) );
530 xproperty->
AddAttribute( wxT(
"value" ), filters.Trim(
false ) );
533 if( part->GetDuplicatePinNumbersAreJumpers() )
534 xcomp->AddChild(
node( wxT(
"duplicate_pin_numbers_are_jumpers" ), wxT(
"1" ) ) );
536 const std::vector<std::set<wxString>>& jumperGroups = part->JumperPinGroups();
538 if( !jumperGroups.empty() )
541 xcomp->AddChild( xproperty =
node( wxT(
"jumper_pin_groups" ) ) );
543 for(
const std::set<wxString>&
group : jumperGroups )
545 xproperty->AddChild( groupNode =
node( wxT(
"group" ) ) );
547 for(
const wxString& pinName :
group )
548 groupNode->AddChild(
node( wxT(
"pin" ), pinName ) );
554 xcomp->AddChild( xsheetpath =
node( wxT(
"sheetpath" ) ) );
556 xsheetpath->
AddAttribute( wxT(
"names" ), sheet.PathHumanReadable() );
557 xsheetpath->
AddAttribute( wxT(
"tstamps" ), sheet.PathAsString() );
560 std::vector<wxString> compClassNames =
563 if( compClassNames.size() > 0 )
565 XNODE* xcompclasslist;
566 xcomp->AddChild( xcompclasslist =
node( wxT(
"component_classes" ) ) );
568 for(
const wxString& compClass : compClassNames )
575 xcomp->AddChild( xunits =
node( wxT(
"tstamps" ) ) );
577 auto range = extra_units.equal_range( symbol );
581 for(
auto it = range.first; it != range.second; ++it )
583 uuid = ( *it )->m_Uuid.AsString();
590 xunits->AddChild(
new XNODE( wxXML_TEXT_NODE, wxEmptyString, uuid ) );
595 xunits->AddChild(
new XNODE( wxXML_TEXT_NODE, wxEmptyString, uuid ) );
599 xcomp->AddChild( xunitInfo =
node( wxT(
"units" ) ) );
609 xunitInfo->AddChild( xunit =
node( wxT(
"unit" ) ) );
610 xunit->
AddAttribute( wxT(
"name" ), unitInfo.m_unitName );
613 xunit->AddChild( xpins =
node( wxT(
"pins" ) ) );
615 for(
const wxString& number : unitInfo.m_pinNumbers )
618 xpins->AddChild( xpin =
node( wxT(
"pin" ) ) );
654 xcomps->AddChild( xgroup =
node( wxT(
"group" ) ) );
661 xgroup->AddChild( xmembers =
node( wxT(
"members" ) ) );
668 xmembers->AddChild( xmember =
node( wxT(
"member" ) ) );
669 xmember->
AddAttribute( wxT(
"uuid" ), member->m_Uuid.AsString() );
683 XNODE* xvariants =
node( wxT(
"variants" ) );
685 std::set<wxString> variantNames =
m_schematic->GetVariantNames();
687 for(
const wxString& variantName : variantNames )
690 xvariants->AddChild( xvariant =
node( wxT(
"variant" ) ) );
693 wxString description =
m_schematic->GetVariantDescription( variantName );
695 if( !description.IsEmpty() )
696 xvariant->
AddAttribute( wxT(
"description" ), description );
706 std::vector<SCH_SHEET_PATH> symbolSheets;
707 symbolSheets.push_back( aSymbolSheet );
714 const wxString ref = aSymbol->
GetRef( &aSymbolSheet );
722 wxString ref2 = symbol2->
GetRef( &sheet );
725 if( ref2.CmpNoCase( ref ) != 0 )
728 if( otherUnit == primaryUnit )
731 symbolSheets.push_back( sheet );
733 std::unordered_set<wxString> otherClassNames =
735 compClassNames.insert( otherClassNames.begin(), otherClassNames.end() );
745 if( symbolSheetPath.IsContainedWithin( sheetPath ) )
747 compClassNames.insert( sheetCompClasses.begin(), sheetCompClasses.end() );
752 std::vector<wxString> sortedCompClassNames( compClassNames.begin(), compClassNames.end() );
753 std::sort( sortedCompClassNames.begin(), sortedCompClassNames.end(),
754 [](
const wxString& str1,
const wxString& str2 )
756 return str1.Cmp( str2 ) < 0;
759 return sortedCompClassNames;
766 XNODE* xdesign =
node( wxT(
"design" ) );
772 wxFileName sourceFileName;
775 xdesign->AddChild(
node( wxT(
"source" ),
m_schematic->GetFileName() ) );
782 const std::map<wxString, wxString>& properties =
m_schematic->Project().GetTextVars();
784 for(
const std::pair<const wxString, wxString>& prop : properties )
786 xdesign->AddChild( xtextvar =
node( wxT(
"textvar" ), prop.second ) );
793 unsigned sheetIndex = 1;
797 screen = sheet.LastScreen();
799 xdesign->AddChild( xsheet =
node( wxT(
"sheet" ) ) );
802 sheetTxt.Printf( wxT(
"%u" ), sheetIndex++ );
804 xsheet->
AddAttribute( wxT(
"name" ), sheet.PathHumanReadable() );
805 xsheet->
AddAttribute( wxT(
"tstamps" ), sheet.PathAsString() );
810 xsheet->AddChild( xtitleBlock =
node( wxT(
"title_block" ) ) );
818 sourceFileName = wxFileName( screen->
GetFileName() );
819 xtitleBlock->AddChild(
node( wxT(
"source" ), sourceFileName.GetFullName() ) );
821 xtitleBlock->AddChild( xcomment =
node( wxT(
"comment" ) ) );
825 xtitleBlock->AddChild( xcomment =
node( wxT(
"comment" ) ) );
829 xtitleBlock->AddChild( xcomment =
node( wxT(
"comment" ) ) );
833 xtitleBlock->AddChild( xcomment =
node( wxT(
"comment" ) ) );
837 xtitleBlock->AddChild( xcomment =
node( wxT(
"comment" ) ) );
841 xtitleBlock->AddChild( xcomment =
node( wxT(
"comment" ) ) );
845 xtitleBlock->AddChild( xcomment =
node( wxT(
"comment" ) ) );
849 xtitleBlock->AddChild( xcomment =
node( wxT(
"comment" ) ) );
853 xtitleBlock->AddChild( xcomment =
node( wxT(
"comment" ) ) );
864 XNODE* xlibs =
node( wxT(
"libraries" ) );
869 wxString libNickname = *it;
876 xlibs->AddChild( xlibrary =
node( wxT(
"library" ) ) );
877 xlibrary->
AddAttribute( wxT(
"logical" ), libNickname );
878 xlibrary->AddChild(
node( wxT(
"uri" ), *uri ) );
890 XNODE* xlibparts =
node( wxT(
"libparts" ) );
891 std::vector<SCH_FIELD*> fieldList;
897 wxString libNickname = lcomp->GetLibId().GetLibNickname();;
900 if( !libNickname.IsEmpty() )
904 xlibparts->AddChild( xlibpart =
node( wxT(
"libpart" ) ) );
906 xlibpart->
AddAttribute( wxT(
"part" ), lcomp->GetName() );
909 if( !lcomp->GetDescription().IsEmpty() )
910 xlibpart->AddChild(
node( wxT(
"description" ), lcomp->GetDescription() ) );
912 if( !lcomp->GetDatasheetField().GetText().IsEmpty() )
913 xlibpart->AddChild(
node( wxT(
"docs" ), lcomp->GetDatasheetField().GetText() ) );
916 if( lcomp->GetFPFilters().GetCount() )
919 xlibpart->AddChild( xfootprints =
node( wxT(
"footprints" ) ) );
921 for(
unsigned i = 0; i < lcomp->GetFPFilters().GetCount(); ++i )
923 if( !lcomp->GetFPFilters()[i].IsEmpty() )
924 xfootprints->AddChild(
node( wxT(
"fp" ), lcomp->GetFPFilters()[i] ) );
930 lcomp->GetFields( fieldList );
933 xlibpart->AddChild( xfields =
node(
"fields" ) );
935 for(
const SCH_FIELD* field : fieldList )
938 xfields->AddChild( xfield =
node( wxT(
"field" ), field->GetText() ) );
939 xfield->
AddAttribute( wxT(
"name" ), field->GetCanonicalName() );
945 std::vector<SCH_PIN*> pinList = lcomp->GetGraphicalPins( 0, 0 );
957 for(
int ii = 0; ii < (int)pinList.size()-1; ii++ )
959 if( pinList[ii]->GetNumber() == pinList[ii+1]->GetNumber() )
961 pinList.erase(pinList.begin() + ii + 1);
966 wxLogTrace(
"CVPCB_PINCOUNT",
967 wxString::Format(
"makeLibParts: lib='%s' part='%s' pinList(size)=%zu",
968 libNickname, lcomp->GetName(), pinList.size() ) );
974 xlibpart->AddChild( pins =
node( wxT(
"pins" ) ) );
976 for(
unsigned i=0; i<pinList.size(); ++i )
980 bool stackedValid =
false;
984 if( stackedValid && !expandedNums.empty() )
986 for(
const wxString& num : expandedNums )
989 pins->AddChild(
pin =
node( wxT(
"pin" ) ) );
990 pin->AddAttribute( wxT(
"num" ), num );
994 wxLogTrace(
"CVPCB_PINCOUNT",
995 wxString::Format(
"makeLibParts: -> pin num='%s' name='%s' (expanded)",
1002 pins->AddChild(
pin =
node( wxT(
"pin" ) ) );
1007 wxLogTrace(
"CVPCB_PINCOUNT",
1008 wxString::Format(
"makeLibParts: -> pin num='%s' name='%s'",
1024 wxString netCodeTxt;
1026 XNODE* xnet =
nullptr;
1048 NET_RECORD(
const wxString& aName ) :
1050 m_HasNoConnect(
false )
1055 bool m_HasNoConnect;
1056 std::vector<NET_NODE> m_Nodes;
1059 std::vector<NET_RECORD*> nets;
1061 for(
const auto& [ key, subgraphs ] :
m_schematic->ConnectionGraph()->GetNetMap() )
1063 wxString net_name = key.Name;
1064 NET_RECORD* net_record =
nullptr;
1069 if( subgraphs.empty() )
1072 nets.emplace_back(
new NET_RECORD( net_name ) );
1073 net_record = nets.back();
1077 bool nc = subgraph->GetNoConnect() && subgraph->GetNoConnect()->Type() ==
SCH_NO_CONNECT_T;
1080 if( net_record->m_Class.IsEmpty() && subgraph->GetDriver() )
1082 if( subgraph->GetDriver()->GetEffectiveNetClass() )
1084 net_record->m_Class = subgraph->GetDriver()->GetEffectiveNetClass()->GetName();
1090 net_record->m_HasNoConnect =
true;
1092 for(
SCH_ITEM* item : subgraph->GetItems() )
1110 net_record->m_Nodes.emplace_back(
pin, sheet );
1117 std::sort( nets.begin(), nets.end(),
1118 [](
const NET_RECORD* a,
const NET_RECORD*b )
1120 return StrNumCmp( a->m_Name, b->m_Name ) < 0;
1123 for(
int i = 0; i < (int) nets.size(); ++i )
1125 NET_RECORD* net_record = nets[i];
1130 std::sort( net_record->m_Nodes.begin(), net_record->m_Nodes.end(),
1131 [](
const NET_NODE& a,
const NET_NODE& b )
1133 wxString refA = a.m_Pin->GetParentSymbol()->GetRef( &a.m_Sheet );
1134 wxString refB = b.m_Pin->GetParentSymbol()->GetRef( &b.m_Sheet );
1137 return a.m_Pin->GetShownNumber() < b.m_Pin->GetShownNumber();
1146 [](
const NET_NODE& a,
const NET_NODE& b )
1148 wxString refA = a.m_Pin->GetParentSymbol()->GetRef( &a.m_Sheet );
1149 wxString refB = b.m_Pin->GetParentSymbol()->GetRef( &b.m_Sheet );
1151 return refA == refB && a.m_Pin->GetShownNumber() == b.m_Pin->GetShownNumber();
1156 bool allNetPinsStacked =
true;
1158 if( net_record->m_Nodes.size() > 1 )
1160 SCH_PIN* firstPin = net_record->m_Nodes.begin()->m_Pin;
1162 std::all_of( net_record->m_Nodes.begin() + 1, net_record->m_Nodes.end(),
1165 return firstPin->GetParent() == node.m_Pin->GetParent()
1166 && firstPin->GetPosition() == node.m_Pin->GetPosition()
1167 && firstPin->GetName() == node.m_Pin->GetName();
1171 for(
const NET_NODE& netNode : net_record->m_Nodes )
1173 wxString refText = netNode.m_Pin->GetParentSymbol()->GetRef( &netNode.m_Sheet );
1176 if( refText[0] == wxChar(
'#' ) )
1181 netCodeTxt.Printf( wxT(
"%d" ), i + 1 );
1183 xnets->AddChild( xnet =
node( wxT(
"net" ) ) );
1185 xnet->
AddAttribute( wxT(
"name" ), net_record->m_Name );
1186 xnet->
AddAttribute( wxT(
"class" ), net_record->m_Class );
1191 std::vector<wxString> nums = netNode.m_Pin->GetStackedPinNumbers();
1192 wxString baseName = netNode.m_Pin->GetShownName();
1193 wxString pinType = netNode.m_Pin->GetCanonicalElectricalTypeName();
1196 wxString::Format(
"XML: net='%s' ref='%s' base='%s' shownNum='%s' expand=%zu",
1197 net_record->m_Name, refText, baseName,
1198 netNode.m_Pin->GetShownNumber(), nums.size() ) );
1200 for(
const wxString& num : nums )
1202 xnet->AddChild( xnode =
node( wxT(
"node" ) ) );
1206 wxString fullName = baseName.IsEmpty() ? num : baseName + wxT(
"_" ) + num;
1208 if( !baseName.IsEmpty() || nums.size() > 1 )
1211 wxString typeAttr = pinType;
1213 if( net_record->m_HasNoConnect
1214 && ( net_record->m_Nodes.size() == 1 || allNetPinsStacked ) )
1216 typeAttr += wxT(
"+no_connect" );
1218 wxString::Format(
"XML: marking node ref='%s' pin='%s' as no_connect",
1227 for( NET_RECORD* record : nets )
1235 const wxString& aTextualContent )
1237 XNODE* n =
new XNODE( wxXML_ELEMENT_NODE, aName );
1239 if( aTextualContent.Len() > 0 )
1240 n->AddChild(
new XNODE( wxXML_TEXT_NODE, wxEmptyString, aTextualContent ) );
1257 auto getComponentClassFields = [&](
const std::vector<SCH_FIELD>& fields,
const SCH_SHEET_PATH* sheetPath )
1259 std::unordered_set<wxString> componentClasses;
1263 if( field.GetCanonicalName() == wxT(
"Component Class" ) )
1265 if( field.GetShownText( sheetPath,
false ) != wxEmptyString )
1266 componentClasses.insert( field.GetShownText( sheetPath,
false ) );
1270 return componentClasses;
1278 std::unordered_set<wxString> sheetComponentClasses;
1279 const std::unordered_set<SCH_RULE_AREA*>& sheetRuleAreas = sheetItem->
GetRuleAreaCache();
1285 std::unordered_set<wxString> ruleAreaComponentClasses =
1286 getComponentClassFields( label->GetFields(), &sheet );
1287 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
std::vector< wxString > GetStackedPinNumbers(bool *aValid=nullptr) const
wxString GetCanonicalElectricalTypeName() const
const wxString & GetShownName() const
const wxString & GetShownNumber() 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 &aVariantName=wxEmptyString) 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.