48 const wxString& aNetlistFile,
49 const wxString& aFinalFile,
50 const wxString& aProjectPath )
58 wxString ret = aFormatString;
59 wxFileName in = aNetlistFile;
60 wxFileName out = aFinalFile;
61 wxString str_out = out.GetFullPath();
63 ret.Replace(
"%P", aProjectPath,
true );
64 ret.Replace(
"%B", out.GetName(),
true );
65 ret.Replace(
"%I", in.GetFullPath(),
true );
73 if( !str_out.StartsWith(
"\\\\" ) )
74 str_out.Replace(
"\\",
"/" );
77 ret.Replace(
"%O", str_out,
true );
86 wxCHECK( aItem,
nullptr );
98 ref = symbol->
GetRef( &aSheetPath );
100 if( ref[0] == wxChar(
'#' ) )
105 wxCHECK( screen,
nullptr );
131 bool aKeepUnconnectedPins )
133 std::vector<PIN_INFO> pins;
138 wxString ref( aSymbol->
GetRef( &aSheetPath ) );
142 if( ( ref[0] == wxChar(
'#' ) ) || aSymbol->
IsPower() )
169 const wxString& netName = conn->Name();
171 if( !aKeepUnconnectedPins )
185 std::sort( pins.begin(), pins.end(),
188 return StrNumCmp( lhs.num, rhs.num, true ) < 0;
211 wxString fpText = symbol->GetFootprintFieldText(
true, &aSheetPath,
false, variantName );
214 if( !fpText.IsEmpty() && fpId.
Parse( fpText,
true ) < 0 )
223 if( state == SCH_PIN::PAD_RESOLUTION::UNMAPPED )
245 if(
m_kiway && !aFootprintId.IsEmpty() )
249 typedef void ( *PAD_NUMBERS_FN_PTR )(
const wxString&,
PROJECT*, std::set<wxString>& );
252 fetch( aFootprintId, &
m_schematic->Project(), pads );
267 wxString pinName = baseName.IsEmpty() ? padNum : baseName + wxT(
"_" ) + padNum;
268 aPins.emplace_back( padNum, aNetName, pinName, aPin->
GetNumber() );
277 auto isAutoGeneratedNet = [](
const wxString& aNetName ) ->
bool
279 return aNetName.StartsWith( wxT(
"unconnected-(" ) )
280 || aNetName.StartsWith( wxT(
"Net-(" ) );
283 for(
unsigned ii = 0; ii < aPins.size(); ii++ )
285 if( aPins[ii].num.empty() )
294 unsigned idxBest = ii;
296 for(
unsigned jj = ii + 1; jj < aPins.size(); jj++ )
298 if( aPins[jj].num.empty() )
301 if( aPins[idxBest].num != aPins[jj].num )
308 if( aPins[idxBest].netName != aPins[jj].netName && !aPins[idxBest].srcPin.IsEmpty()
309 && !aPins[jj].srcPin.IsEmpty() && aPins[idxBest].srcPin != aPins[jj].srcPin )
316 bool bestIsAuto = isAutoGeneratedNet( aPins[idxBest].netName );
317 bool jjIsAuto = isAutoGeneratedNet( aPins[jj].netName );
319 if( bestIsAuto && !jjIsAuto )
322 aPins[idxBest].num.clear();
327 aPins[jj].num.clear();
336 std::vector<PIN_INFO>& aPins,
337 bool aKeepUnconnectedPins )
339 wxString ref = aSchSymbol->
GetRef( &aSheetPath );
350 ref2 = comp2->
GetRef( &sheet );
352 if( ref2.CmpNoCase( ref ) != 0 )
359 const wxString& netName = conn->Name();
361 if( !aKeepUnconnectedPins )
Calculate the connectivity of a schematic and generates netlists.
CONNECTION_SUBGRAPH * FindSubgraphByName(const wxString &aNetName, const SCH_SHEET_PATH &aPath)
Return the subgraph for a given net name on a given sheet.
A subgraph is a set of items that are electrically connected on a single sheet.
const std::set< SCH_ITEM * > & GetItems() const
Provide a read-only reference to the items in the subgraph.
const SCH_ITEM * GetNoConnect() const
A base class for most all the KiCad significant classes used in schematics and boards.
KICAD_T Type() const
Returns the type of object.
A logical library item identifier and consists of various portions much like a URI.
int Parse(const UTF8 &aId, bool aFix=false)
Parse LIB_ID with the information from aId.
wxString GetUniStringLibId() const
Define a library symbol object.
const LIB_ID & GetLibId() const override
int GetUnitCount() const override
SCHEMATIC * m_schematic
The schematic we're generating a netlist for.
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.
const std::set< wxString > & footprintPads(const wxString &aFootprintId) const
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.
SCH_SYMBOL * findNextSymbol(EDA_ITEM *aItem, const SCH_SHEET_PATH &aSheetPath)
Check if the given symbol should be processed for netlisting.
std::map< wxString, std::set< wxString > > m_footprintPadCache
std::set< LIB_SYMBOL *, LIB_SYMBOL_LESS_THAN > m_libParts
unique library symbols used. LIB_SYMBOL items are sorted by names
void eraseDuplicatePins(std::vector< PIN_INFO > &pins)
Erase duplicate pins.
std::vector< wxString > resolvePadNumbers(const SCH_PIN *aPin, const SCH_SHEET_PATH &aSheetPath) const
Resolve aPin to its effective pad number(s) for every netlist path (issue #2282).
UNIQUE_STRINGS m_referencesAlreadyFound
Used for "multiple symbols per package" symbols to avoid processing a lib symbol more than once.
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.
void appendResolvedPins(std::vector< PIN_INFO > &aPins, const SCH_PIN *aPin, const SCH_SHEET_PATH &aSheetPath, const wxString &aNetName)
Resolve aPin to its pad number(s) and append a PIN_INFO for each (issue #2282).
Container for project specific data.
Each graphical item can have a SCH_CONNECTION describing its logical connection (to a bus or net).
Base class for any item which can be embedded within the SCHEMATIC container class,...
const SYMBOL * GetParentSymbol() const
PAD_RESOLUTION
Outcome of pin-to-pad resolution (issue #2282).
const wxString & GetShownName() const
wxString GetEffectivePadNumber(const SCH_SHEET_PATH &aSheet, const wxString &aVariantName, const LIB_ID &aFootprintLibId, const std::set< wxString > *aFootprintPadNumbers, PAD_RESOLUTION *aState=nullptr) const
Resolve the footprint pad number this symbol pin lands on (issue #2282).
const wxString & GetNumber() const
const std::map< wxString, LIB_SYMBOL * > & GetLibSymbols() const
Fetch a list of unique LIB_SYMBOL object pointers required to properly render each SCH_SYMBOL in this...
Handle access to a stack of flattened SCH_SHEET objects by way of a path for creating a flattened sch...
SCH_SCREEN * LastScreen()
wxString GetSchSymbolLibraryName() const
std::vector< const SCH_PIN * > GetPins(const SCH_SHEET_PATH *aSheet) const
Retrieve a list of the SCH_PINs for the given sheet path.
std::unique_ptr< LIB_SYMBOL > & GetLibSymbolRef()
const wxString GetRef(const SCH_SHEET_PATH *aSheet, bool aIncludeUnit=false) const override
bool IsPower() const override
@ KIFACE_FOOTPRINT_PAD_NUMBERS
Function pointer type: void (*)( const wxString& aFootprint, PROJECT* aProject, std::set<wxString>& a...
std::vector< wxString > ExpandStackedPinNotation(const wxString &aPinName, bool *aValid)
Expand stacked pin notation like [1,2,3], [1-4], [A1-A4], or [AA1-AA3,AB4,CD12-CD14] into individual ...
Implement a participant in the KIWAY alchemy.
bool operator()(LIB_SYMBOL *const &libsymbol1, LIB_SYMBOL *const &libsymbol2) const
wxLogTrace helper definitions.