28#include <system_error>
48 if( ( f = wxFopen( aOutFileName, wxT(
"wt" ) ) ) ==
nullptr )
50 wxString msg = wxString::Format(
_(
"Failed to create file '%s'." ), aOutFileName );
55 std::vector< SCH_REFERENCE > cmpList;
59 fmt::print( f,
"( {{ {} created {} }}\n",
72 std::vector<EDA_ITEM*> sheetItems;
75 sheetItems.push_back( item );
80 return item1->
m_Uuid < item2->m_Uuid;
83 std::sort( sheetItems.begin(), sheetItems.end(), pred );
102 footprint.Replace( wxT(
" " ), wxT(
"_" ) );
104 if( footprint.IsEmpty() )
105 footprint = wxT(
"$noname" );
107 fmt::print( f,
" ( {} {}",
111 field = symbol->
GetRef( &sheet );
112 fmt::print( f,
" {}",
TO_UTF8( field ) );
115 field.Replace( wxT(
" " ), wxT(
"_" ) );
116 fmt::print( f,
" {}",
TO_UTF8( field ) );
118 fmt::print( f,
"\n" );
123 if(
pin.num.IsEmpty() )
126 netName =
pin.netName;
127 netName.Replace( wxT(
" " ), wxT(
"_" ) );
133 fmt::print( f,
" )\n" );
137 fmt::print( f,
")\n*\n" );
142 catch(
const std::system_error& e )
148 catch(
const fmt::format_error& e )
150 aReporter.
Report( wxString::Format(
_(
"Formatting error writing netlist: %s" ), e.what() ),
A base class for most all the KiCad significant classes used in schematics and boards.
wxString AsString() const
wxArrayString GetFPFilters() const
UNIQUE_STRINGS m_referencesAlreadyFound
Used for "multiple symbols per package" symbols to avoid processing a lib symbol more than once.
SCH_SHEET_LIST m_exportSheets
EXPORT_EXCLUSION boardExclusion() const
wxString m_exportVariant
The schematic we're generating a netlist for.
SCH_SYMBOL * findNextSymbol(EDA_ITEM *aItem, const SCH_SHEET_PATH &aSheetPath, const EXPORT_EXCLUSION &aExcluded=nullptr)
Check if the given symbol should be processed for netlisting.
std::vector< PIN_INFO > CreatePinList(SCH_SYMBOL *aSymbol, const SCH_SHEET_PATH &aSheetPath)
Find a symbol from the DrawList and builds its pin list.
bool writeNetlist(const wxString &aOutFileName, unsigned aNetlistOptions, REPORTER &aReporter) override
A pure virtual class used to derive REPORTER objects from.
virtual REPORTER & Report(const wxString &aText, SEVERITY aSeverity=RPT_SEVERITY_UNDEFINED)
Report a string with a given severity.
A helper to define a symbol's reference designator in a schematic.
Handle access to a stack of flattened SCH_SHEET objects by way of a path for creating a flattened sch...
const wxString GetFootprintFieldText(const SCH_SHEET_PATH *aPath, RESOLUTION_CONTEXT aContext, const wxString &aVariantName=wxEmptyString) const
const wxString GetValue(const SCH_SHEET_PATH *aPath, RESOLUTION_CONTEXT aContext, const wxString &aVariantName=wxEmptyString) const override
std::unique_ptr< LIB_SYMBOL > & GetLibSymbolRef()
const wxString GetRef(const SCH_SHEET_PATH *aSheet, bool aIncludeUnit=false) const override
This file is part of the common library.
#define NETLIST_HEAD_STRING
std::function< bool(const SCH_SYMBOL *, const SCH_SHEET_PATH &)> EXPORT_EXCLUSION
An abstract class used for the netlist exporters that Eeschema supports.
Collection of utility functions for component reference designators (refdes)
wxString GetISO8601CurrentDateTime()
#define TO_UTF8(wxstring)
Convert a wxString to a UTF8 encoded C string for all wxWidgets build modes.