KiCad PCB EDA Suite
|
Generate a generic XML based netlist file. More...
#include <netlist_exporter_xml.h>
Public Member Functions | |
NETLIST_EXPORTER_XML (SCHEMATIC *aSchematic) | |
bool | WriteNetlist (const wxString &aOutFileName, unsigned aNetlistOptions, REPORTER &aReporter) override |
Write generic netlist to aOutFileName. | |
Static Public Member Functions | |
static wxString | MakeCommandLine (const wxString &aFormatString, const wxString &aNetlistFile, const wxString &aFinalFile, const wxString &aProjectDirectory) |
Build up a string that describes a command line for executing a child process. | |
Protected Member Functions | |
XNODE * | node (const wxString &aName, const wxString &aTextualContent=wxEmptyString) |
A convenience function that creates a new XNODE with an optional textual child. | |
XNODE * | makeRoot (unsigned aCtl=GNL_ALL) |
Build the entire document tree for the generic export. | |
XNODE * | makeSymbols (unsigned aCtl) |
XNODE * | makeDesignHeader () |
Fill out a project "design" header into an XML node. | |
XNODE * | makeLibParts () |
Fill out an XML node with the unique library parts and returns it. | |
XNODE * | makeListOfNets (unsigned aCtl) |
Fill out an XML node with a list of nets and returns it. | |
XNODE * | makeLibraries () |
Fill out an XML node with a list of used libraries 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. | |
std::vector< PIN_INFO > | CreatePinList (SCH_SYMBOL *aSymbol, const SCH_SHEET_PATH &aSheetPath, bool aKeepUnconnectedPins) |
Find a symbol from the DrawList and builds its pin list. | |
SCH_SYMBOL * | findNextSymbol (EDA_ITEM *aItem, const SCH_SHEET_PATH &aSheetPath) |
Check if the given symbol should be processed for netlisting. | |
void | eraseDuplicatePins (std::vector< PIN_INFO > &pins) |
Erase duplicate pins. | |
void | findAllUnitsOfSymbol (SCH_SYMBOL *aSchSymbol, const SCH_SHEET_PATH &aSheetPath, std::vector< PIN_INFO > &aPins, bool aKeepUnconnectedPins) |
Find all units for symbols with multiple symbols per package. | |
Protected Attributes | |
bool | m_resolveTextVars |
UNIQUE_STRINGS | m_referencesAlreadyFound |
Used for "multiple symbols per package" symbols to avoid processing a lib symbol more than once. | |
std::set< LIB_SYMBOL *, LIB_SYMBOL_LESS_THAN > | m_libParts |
unique library symbols used. LIB_SYMBOL items are sorted by names | |
SCHEMATIC_IFACE * | m_schematic |
The schematic we're generating a netlist for. | |
Private Attributes | |
std::set< wxString > | m_libraries |
Generate a generic XML based netlist file.
This allows using XSLT or other methods to transform the XML to other netlist formats outside of the C++ codebase.
Definition at line 62 of file netlist_exporter_xml.h.
|
inline |
Definition at line 65 of file netlist_exporter_xml.h.
|
protected |
Holder for multi-unit symbol fields.
Definition at line 95 of file netlist_exporter_xml.cpp.
References datasheet, DATASHEET_FIELD, DESCRIPTION_FIELD, FOOTPRINT_FIELD, GetCanonicalFieldName(), SCH_SYMBOL::GetField(), SCH_SYMBOL::GetFieldCount(), SCH_SYMBOL::GetFields(), SCH_SYMBOL::GetFootprintFieldText(), SCH_FIELD::GetName(), SCH_SYMBOL::GetRef(), SCH_FIELD::GetShownText(), EDA_TEXT::GetText(), SCH_SYMBOL::GetUnitCount(), SCH_SYMBOL::GetUnitSelection(), SCH_SYMBOL::GetValue(), m_resolveTextVars, MANDATORY_FIELDS, node(), SCH_SYMBOL_T, and UnescapeString().
Referenced by makeSymbols().
|
protectedinherited |
Find a symbol from the DrawList and builds its pin list.
This list is sorted by pin number. The symbol is the next actual symbol after aSymbol. Power symbols and virtual symbols that have their reference designators starting with '#' are skipped. if aKeepUnconnectedPins = false, unconnected pins will be removed from list but usually we need all pins in netlists.
Definition at line 128 of file netlist_exporter_base.cpp.
References SCHEMATIC_IFACE::ConnectionGraph(), NETLIST_EXPORTER_BASE::eraseDuplicatePins(), NETLIST_EXPORTER_BASE::findAllUnitsOfSymbol(), CONNECTION_GRAPH::FindSubgraphByName(), CONNECTION_SUBGRAPH::GetItems(), SCH_SYMBOL::GetLibSymbolRef(), CONNECTION_SUBGRAPH::GetNoConnect(), SCH_SYMBOL::GetPins(), SCH_SYMBOL::GetRef(), SCH_SYMBOL::IsPower(), NETLIST_EXPORTER_BASE::m_libParts, NETLIST_EXPORTER_BASE::m_schematic, and pin.
Referenced by NETLIST_EXPORTER_SPICE::ReadSchematicAndLibraries(), and NETLIST_EXPORTER_ORCADPCB2::WriteNetlist().
|
protectedinherited |
Erase duplicate pins.
(This is a list of pins found in the whole schematic, for a single symbol.) These duplicate pins were put in list because some pins (power pins...) are found more than once when in "multiple symbols per package" symbols. For instance, a 74ls00 has 4 symbols, and therefore the VCC pin and GND pin appears 4 times in the list. Note: this list MUST be sorted by pin number (.m_PinNum member value) Also set the m_Flag member of "removed" NETLIST_OBJECT pin item to 1
Definition at line 201 of file netlist_exporter_base.cpp.
Referenced by NETLIST_EXPORTER_BASE::CreatePinList().
|
protectedinherited |
Find all units for symbols with multiple symbols per package.
Search the entire design for all units of aSymbol based on matching reference designator, and for each unit, add all its pins to the sorted pin list. if aKeepUnconnectedPins = false, unconnected pins will be removed from list but usually we need all pins in netlists.
Definition at line 234 of file netlist_exporter_base.cpp.
References SCHEMATIC_IFACE::ConnectionGraph(), CONNECTION_GRAPH::FindSubgraphByName(), CONNECTION_SUBGRAPH::GetItems(), CONNECTION_SUBGRAPH::GetNoConnect(), SCH_SYMBOL::GetPins(), SCH_SYMBOL::GetRef(), SCHEMATIC_IFACE::Hierarchy(), NETLIST_EXPORTER_BASE::m_schematic, pin, and SCH_SYMBOL_T.
Referenced by NETLIST_EXPORTER_BASE::CreatePinList().
|
protectedinherited |
Check if the given symbol should be processed for netlisting.
Prevent processing multi-unit symbols more than once, etc.
aItem | is a symbol to check |
aSheetPath | is the sheet to check the symbol for |
Definition at line 82 of file netlist_exporter_base.cpp.
References SCH_SCREEN::GetLibSymbols(), SCH_SYMBOL::GetRef(), SCH_SYMBOL::GetSchSymbolLibraryName(), LIB_SYMBOL::GetUnitCount(), SCH_SHEET_PATH::LastScreen(), UNIQUE_STRINGS::Lookup(), NETLIST_EXPORTER_BASE::m_libParts, NETLIST_EXPORTER_BASE::m_referencesAlreadyFound, SCH_SYMBOL_T, and EDA_ITEM::Type().
Referenced by NETLIST_EXPORTER_ALLEGRO::extractComponentsInfo(), makeSymbols(), NETLIST_EXPORTER_SPICE::ReadSchematicAndLibraries(), NETLIST_EXPORTER_CADSTAR::WriteNetlist(), NETLIST_EXPORTER_ORCADPCB2::WriteNetlist(), and NETLIST_EXPORTER_PADS::WriteNetlist().
|
protected |
Finds all component class names attached to any sub-unit of a given symbol.
Definition at line 463 of file netlist_exporter_xml.cpp.
References SCH_SYMBOL::GetComponentClassNames(), SCH_SYMBOL::GetRef(), SCH_SYMBOL::GetUnitCount(), SCH_SYMBOL::GetUnitSelection(), and SCH_SYMBOL_T.
Referenced by makeSymbols().
|
staticinherited |
Build up a string that describes a command line for executing a child process.
The input and output file names along with any options to the executable are all possibly in the returned string.
aFormatString | holds:
|
aNetlistFile | is the name of the input file for the external program, that is a intermediate netlist file in xml format. |
aFinalFile | is the name of the output file that the user expects. |
aProjectDirectory | is used for P replacement, it should omit the trailing '/'. |
Supported formatting sequences and their meaning:
Definition at line 46 of file netlist_exporter_base.cpp.
Referenced by SCH_EDIT_FRAME::WriteNetListFile().
|
protected |
Fill out a project "design" header into an XML node.
Definition at line 506 of file netlist_exporter_xml.cpp.
References ExpandTextVars(), GetBuildVersion(), TITLE_BLOCK::GetComment(), TITLE_BLOCK::GetCompany(), TITLE_BLOCK::GetDate(), SCH_SCREEN::GetFileName(), SCHEMATIC_IFACE::GetFileName(), GetISO8601CurrentDateTime(), TITLE_BLOCK::GetRevision(), PROJECT::GetTextVars(), TITLE_BLOCK::GetTitle(), SCH_SCREEN::GetTitleBlock(), SCHEMATIC_IFACE::Hierarchy(), NETLIST_EXPORTER_BASE::m_schematic, node(), and SCHEMATIC_IFACE::Prj().
Referenced by makeRoot().
|
protected |
Fill out an XML node with the unique library parts and returns it.
Definition at line 629 of file netlist_exporter_xml.cpp.
References NETLIST_EXPORTER_BASE::m_libParts, m_libraries, node(), pin, and sortPinsByNumber().
Referenced by makeRoot().
|
protected |
Fill out an XML node with a list of used libraries and returns it.
Must have called makeGenericLibParts() before this function.
Definition at line 605 of file netlist_exporter_xml.cpp.
References LIB_TABLE::GetFullURI(), LIB_TABLE::HasLibrary(), m_libraries, NETLIST_EXPORTER_BASE::m_schematic, node(), SCHEMATIC_IFACE::Prj(), and PROJECT_SCH::SchSymbolLibTable().
Referenced by makeRoot().
|
protected |
Fill out an XML node with a list of nets and returns it.
Definition at line 726 of file netlist_exporter_xml.cpp.
References SCHEMATIC_IFACE::ConnectionGraph(), SCH_SHEET_PATH::GetExcludedFromBoard(), SYMBOL::GetExcludedFromBoard(), SCH_SHEET_PATH::GetExcludedFromBOM(), SYMBOL::GetExcludedFromBOM(), CONNECTION_GRAPH::GetNetMap(), SCH_SHEET_PATH::GetSheet(), GNL_OPT_BOM, GNL_OPT_KICAD, NETLIST_EXPORTER_BASE::m_schematic, node(), pin, alg::remove_duplicates(), SCH_NO_CONNECT_T, and SCH_PIN_T.
Referenced by makeRoot().
Build the entire document tree for the generic export.
This is factored out here so we can write the tree in either S-expression file format or in XML if we put the tree built here into a wxXmlDocument.
aCtl | a bitset or-ed together from GNL_ENUM values |
Definition at line 65 of file netlist_exporter_xml.cpp.
References GNL_HEADER, GNL_LIBRARIES, GNL_NETS, GNL_PARTS, GNL_SYMBOLS, makeDesignHeader(), makeLibParts(), makeLibraries(), makeListOfNets(), makeSymbols(), and node().
Referenced by NETLIST_EXPORTER_KICAD::Format(), and WriteNetlist().
|
protected |
Definition at line 242 of file netlist_exporter_xml.cpp.
References addSymbolFields(), KIID::AsString(), UNIQUE_STRINGS::Clear(), SCHEMATIC_IFACE::CurrentSheet(), filter, NETLIST_EXPORTER_BASE::findNextSymbol(), getComponentClassNamesForAllSymbolUnits(), SCH_SYMBOL::GetDescription(), SYMBOL::GetDNP(), SYMBOL::GetExcludedFromBoard(), SYMBOL::GetExcludedFromBOM(), SCH_SYMBOL::GetFields(), SCH_SYMBOL::GetLibId(), SCH_SYMBOL::GetLibSymbolRef(), SCH_SYMBOL::GetRef(), SCH_SYMBOL::GetSchSymbolLibraryName(), LIB_ID::GetUniStringLibItemName(), LIB_ID::GetUniStringLibNickname(), GNL_OPT_BOM, GNL_OPT_KICAD, SCHEMATIC_IFACE::Hierarchy(), NETLIST_EXPORTER_BASE::m_libParts, NETLIST_EXPORTER_BASE::m_referencesAlreadyFound, m_resolveTextVars, NETLIST_EXPORTER_BASE::m_schematic, EDA_ITEM::m_Uuid, MANDATORY_FIELDS, node(), SCH_SYMBOL_T, SCHEMATIC_IFACE::SetCurrentSheet(), StrNumCmp(), UnescapeString(), and SCH_SYMBOL::UseLibIdLookup().
Referenced by makeRoot().
|
protected |
A convenience function that creates a new XNODE with an optional textual child.
It also provides some insulation from a possible change in XML library.
aName | is the name to associate with a new node of type wxXML_ELEMENT_NODE. |
aTextualContent | is optional, and if given is the text to include in a child of the returned node, and has type wxXML_TEXT_NODE. |
Definition at line 910 of file netlist_exporter_xml.cpp.
Referenced by addSymbolFields(), makeDesignHeader(), makeLibParts(), makeLibraries(), makeListOfNets(), makeRoot(), and makeSymbols().
|
overridevirtual |
Write generic netlist to aOutFileName.
aOutFileName | is the file name to write. |
aNetlistOptions | are the options used to control the netlist output. |
Reimplemented from NETLIST_EXPORTER_BASE.
Definition at line 46 of file netlist_exporter_xml.cpp.
References GNL_ALL, and makeRoot().
|
protectedinherited |
unique library symbols used. LIB_SYMBOL items are sorted by names
Definition at line 192 of file netlist_exporter_base.h.
Referenced by NETLIST_EXPORTER_BASE::CreatePinList(), NETLIST_EXPORTER_ALLEGRO::extractComponentsInfo(), NETLIST_EXPORTER_BASE::findNextSymbol(), makeLibParts(), makeSymbols(), and NETLIST_EXPORTER_SPICE::ReadSchematicAndLibraries().
|
private |
Definition at line 147 of file netlist_exporter_xml.h.
Referenced by makeLibParts(), and makeLibraries().
|
protectedinherited |
Used for "multiple symbols per package" symbols to avoid processing a lib symbol more than once.
Definition at line 189 of file netlist_exporter_base.h.
Referenced by NETLIST_EXPORTER_ALLEGRO::extractComponentsInfo(), NETLIST_EXPORTER_BASE::findNextSymbol(), makeSymbols(), NETLIST_EXPORTER_SPICE::ReadSchematicAndLibraries(), NETLIST_EXPORTER_CADSTAR::WriteNetlist(), NETLIST_EXPORTER_ORCADPCB2::WriteNetlist(), and NETLIST_EXPORTER_PADS::WriteNetlist().
|
protected |
Definition at line 144 of file netlist_exporter_xml.h.
Referenced by addSymbolFields(), and makeSymbols().
|
protectedinherited |
The schematic we're generating a netlist for.
Definition at line 195 of file netlist_exporter_base.h.
Referenced by NETLIST_EXPORTER_SPICE::BuildSheetList(), NETLIST_EXPORTER_BASE::CreatePinList(), NETLIST_EXPORTER_ALLEGRO::extractComponentsInfo(), NETLIST_EXPORTER_BASE::findAllUnitsOfSymbol(), makeDesignHeader(), makeLibraries(), makeListOfNets(), makeSymbols(), NETLIST_EXPORTER_SPICE::readModel(), NETLIST_EXPORTER_SPICE_MODEL::WriteHead(), NETLIST_EXPORTER_SPICE::writeInclude(), NETLIST_EXPORTER_CADSTAR::writeListOfNets(), NETLIST_EXPORTER_PADS::writeListOfNets(), NETLIST_EXPORTER_ALLEGRO::WriteNetlist(), NETLIST_EXPORTER_CADSTAR::WriteNetlist(), NETLIST_EXPORTER_ORCADPCB2::WriteNetlist(), and NETLIST_EXPORTER_PADS::WriteNetlist().