KiCad PCB EDA Suite
|
Back annotation algorithm class used to receive, check, and apply a NETLIST from Pcbnew. More...
#include <backannotate.h>
Classes | |
struct | PCB_FP_DATA |
Container for Pcbnew footprint data.Map to hold NETLIST footprints data. More... | |
Public Types | |
using | PCB_FOOTPRINTS_MAP = std::map<wxString, std::shared_ptr<PCB_FP_DATA>> |
using | CHANGELIST_ITEM = std::pair<SCH_REFERENCE, std::shared_ptr<PCB_FP_DATA>> |
Public Member Functions | |
BACK_ANNOTATE (SCH_EDIT_FRAME *aFrame, REPORTER &aReporter, bool aRelinkFootprints, bool aProcessFootprints, bool aProcessValues, bool aProcessReferences, bool aProcessNetNames, bool aProcessAttributes, bool aProcessOtherFields, bool aPreferUnitSwaps, bool aPreferPinSwaps, bool aDryRun) | |
~BACK_ANNOTATE () | |
bool | FetchNetlistFromPCB (std::string &aNetlist) |
Get netlist from the Pcbnew. | |
void | PushNewLinksToPCB () |
bool | BackAnnotateSymbols (const std::string &aNetlist) |
Run back annotation algorithm. | |
Private Member Functions | |
void | getPcbModulesFromString (const std::string &aPayload) |
Parse netlist sent over KiWay express mail interface and fill m_pcbModules. | |
void | getChangeList () |
void | checkForUnusedSymbols () |
Check if some symbols are not represented in PCB footprints and vice versa. | |
void | applyChangelist () |
Apply changelist to the schematic. | |
std::set< wxString > | applyPinSwaps (SCH_SYMBOL *aSymbol, const SCH_REFERENCE &aReference, const PCB_FP_DATA &aFpData, SCH_COMMIT *aCommit) |
Handle footprint pad net swaps with symbol pin swaps where possible. | |
void | processNetNameChange (SCH_COMMIT *aCommit, const wxString &aRef, SCH_PIN *aPin, const SCH_CONNECTION *aConnection, const wxString &aOldName, const wxString &aNewName) |
Private Attributes | |
REPORTER & | m_reporter |
bool | m_matchByReference |
bool | m_processFootprints |
bool | m_processValues |
bool | m_processReferences |
bool | m_processNetNames |
bool | m_processAttributes |
bool | m_processOtherFields |
bool | m_preferUnitSwaps |
bool | m_preferPinSwaps |
bool | m_dryRun |
PCB_FOOTPRINTS_MAP | m_pcbFootprints |
SCH_REFERENCE_LIST | m_refs |
SCH_MULTI_UNIT_REFERENCE_MAP | m_multiUnitsRefs |
std::deque< CHANGELIST_ITEM > | m_changelist |
SCH_EDIT_FRAME * | m_frame |
int | m_changesCount |
Back annotation algorithm class used to receive, check, and apply a NETLIST from Pcbnew.
The following checks are made:
Definition at line 56 of file backannotate.h.
using BACK_ANNOTATE::CHANGELIST_ITEM = std::pair<SCH_REFERENCE, std::shared_ptr<PCB_FP_DATA>> |
Definition at line 89 of file backannotate.h.
using BACK_ANNOTATE::PCB_FOOTPRINTS_MAP = std::map<wxString, std::shared_ptr<PCB_FP_DATA>> |
Definition at line 87 of file backannotate.h.
BACK_ANNOTATE::BACK_ANNOTATE | ( | SCH_EDIT_FRAME * | aFrame, |
REPORTER & | aReporter, | ||
bool | aRelinkFootprints, | ||
bool | aProcessFootprints, | ||
bool | aProcessValues, | ||
bool | aProcessReferences, | ||
bool | aProcessNetNames, | ||
bool | aProcessAttributes, | ||
bool | aProcessOtherFields, | ||
bool | aPreferUnitSwaps, | ||
bool | aPreferPinSwaps, | ||
bool | aDryRun ) |
Definition at line 54 of file backannotate.cpp.
References m_changesCount, m_dryRun, m_frame, m_matchByReference, m_preferPinSwaps, m_preferUnitSwaps, m_processAttributes, m_processFootprints, m_processNetNames, m_processOtherFields, m_processReferences, m_processValues, and m_reporter.
BACK_ANNOTATE::~BACK_ANNOTATE | ( | ) |
Definition at line 76 of file backannotate.cpp.
|
private |
Apply changelist to the schematic.
Definition at line 373 of file backannotate.cpp.
References _, SCH_SYMBOL::AddField(), applyPinSwaps(), EDA_ITEM::ClearFlags(), EscapeHTML(), FOOTPRINT, GetCanonicalFieldName(), SCH_FIELD::GetCanonicalName(), SCH_SYMBOL::GetDNP(), SCH_SYMBOL::GetExcludedFromBOM(), SCH_SYMBOL::GetField(), SCH_SYMBOL::GetFields(), EDA_ITEM::GetFlags(), SCH_REFERENCE::GetFootprint(), NULL_REPORTER::GetInstance(), SCH_SYMBOL::GetLibSymbolRef(), SCH_SYMBOL::GetPin(), SCH_SYMBOL::GetPins(), SCH_SYMBOL::GetPosition(), SCH_REFERENCE::GetRef(), SCH_SYMBOL::GetRef(), SCH_REFERENCE::GetSheetPath(), SCH_FIELD::GetShownText(), SCH_REFERENCE::GetSymbol(), SCH_ITEM::GetUnit(), SCH_REFERENCE::GetUnit(), LIB_SYMBOL::GetUnitPinInfo(), SCH_SYMBOL::GetUnitSelection(), SCH_REFERENCE::GetValue(), EDA_TEXT::HasTextVars(), kv, L, SCH_SHEET_PATH::LastScreen(), m_changelist, m_changesCount, BACK_ANNOTATE::PCB_FP_DATA::m_DNP, m_dryRun, BACK_ANNOTATE::PCB_FP_DATA::m_excludeFromBOM, BACK_ANNOTATE::PCB_FP_DATA::m_fieldsMap, BACK_ANNOTATE::PCB_FP_DATA::m_footprint, m_frame, BACK_ANNOTATE::PCB_FP_DATA::m_pinMap, m_preferPinSwaps, m_preferUnitSwaps, m_processAttributes, m_processFootprints, m_processNetNames, m_processOtherFields, m_processReferences, m_processValues, BACK_ANNOTATE::PCB_FP_DATA::m_ref, m_reporter, BACK_ANNOTATE::PCB_FP_DATA::m_value, COMMIT::Modify(), SCH_CONNECTION::Name(), NO_CLEANUP, NO_RECURSE, pin, processNetNameChange(), SCH_COMMIT::Push(), REFERENCE, SCH_SYMBOL::RemoveField(), REPORTER::ReportHead(), RPT_SEVERITY_ACTION, RPT_SEVERITY_ERROR, RPT_SEVERITY_INFO, SCH_SYMBOL::SetDNP(), SCH_SYMBOL::SetExcludedFromBOM(), EDA_ITEM::SetFlags(), SCH_SYMBOL::SetFootprintFieldText(), SCH_SYMBOL::SetRef(), SCH_FIELD::SetText(), EDA_TEXT::SetTextPos(), SCH_SYMBOL::SetValueFieldText(), EDA_TEXT::SetVisible(), SKIP_STRUCT, USER, and VALUE.
Referenced by BackAnnotateSymbols().
|
private |
Handle footprint pad net swaps with symbol pin swaps where possible.
Definition at line 1115 of file backannotate.cpp.
References _, AccumulateDescriptions(), SELECTION::Add(), EscapeHTML(), SCH_SYMBOL::GetPin(), SCH_REFERENCE::GetRef(), GetSheetNamesFromPaths(), SCH_REFERENCE::GetSheetPath(), SCH_SHEET_PATH::LastScreen(), m_changesCount, m_dryRun, m_frame, BACK_ANNOTATE::PCB_FP_DATA::m_pinMap, m_reporter, COMMIT::Modify(), SCH_CONNECTION::Name(), name, pin, RECURSE, RPT_SEVERITY_ACTION, RPT_SEVERITY_INFO, SwapPinGeometry(), SymbolHasSheetInstances(), and SCH_SYMBOL::UpdatePins().
Referenced by applyChangelist().
bool BACK_ANNOTATE::BackAnnotateSymbols | ( | const std::string & | aNetlist | ) |
Run back annotation algorithm.
If any errors, back annotation doesn't run.
aNetlist | is the netlist to use for back annotation. |
Definition at line 81 of file backannotate.cpp.
References _, applyChangelist(), checkForUnusedSymbols(), getChangeList(), SCH_SHEET_LIST::GetMultiUnitSymbols(), getPcbModulesFromString(), SCH_SHEET_LIST::GetSymbols(), m_changesCount, m_frame, m_matchByReference, m_multiUnitsRefs, m_processAttributes, m_processFootprints, m_processNetNames, m_processOtherFields, m_processReferences, m_processValues, m_refs, m_reporter, and RPT_SEVERITY_ERROR.
Referenced by DIALOG_UPDATE_FROM_PCB::OnUpdateClick(), and DIALOG_UPDATE_FROM_PCB::updateData().
|
private |
Check if some symbols are not represented in PCB footprints and vice versa.
m_refs must be sorted by path.
Definition at line 330 of file backannotate.cpp.
References _, SYMBOL::GetExcludedFromBoard(), SCH_REFERENCE::GetSymbol(), m_changelist, m_frame, m_matchByReference, m_refs, m_reporter, RPT_SEVERITY_ERROR, and RPT_SEVERITY_WARNING.
Referenced by BackAnnotateSymbols().
bool BACK_ANNOTATE::FetchNetlistFromPCB | ( | std::string & | aNetlist | ) |
Get netlist from the Pcbnew.
aNetlist | is the netlist for the board editor. |
Definition at line 108 of file backannotate.cpp.
References _, DisplayErrorMessage(), FRAME_PCB_EDITOR, Kiface(), m_frame, MAIL_PCB_GET_NETLIST, and KIWAY_PLAYER::OpenProjectFiles().
Referenced by DIALOG_UPDATE_FROM_PCB::OnUpdateClick(), and DIALOG_UPDATE_FROM_PCB::updateData().
|
private |
Definition at line 273 of file backannotate.cpp.
References _, SCH_REFERENCE_LIST::FindRef(), SCH_REFERENCE_LIST::FindRefByFullPath(), SCH_REFERENCE_LIST::GetCount(), m_changelist, m_matchByReference, m_multiUnitsRefs, m_pcbFootprints, m_refs, m_reporter, RPT_SEVERITY_ERROR, and SKIP_STRUCT.
Referenced by BackAnnotateSymbols().
|
private |
Parse netlist sent over KiWay express mail interface and fill m_pcbModules.
aPayload | is the netlist from Pcbnew. |
Definition at line 143 of file backannotate.cpp.
References _, From_UTF8(), m_matchByReference, m_pcbFootprints, m_reporter, name, path, RPT_SEVERITY_ERROR, RPT_SEVERITY_WARNING, and Scan().
Referenced by BackAnnotateSymbols().
|
private |
Definition at line 1371 of file backannotate.cpp.
References _, COMMIT::Add(), addConnections(), EscapeHTML(), CONNECTION_SUBGRAPH::GetDriverPriority(), EDA_ITEM::GetPosition(), SCH_PIN::GetShownNumber(), IS_NEW, SCH_PIN::IsPower(), SCH_SHEET_PATH::LastScreen(), m_changesCount, SCHEMATIC_SETTINGS::m_DefaultTextSize, m_dryRun, m_frame, m_reporter, COMMIT::Modify(), CONNECTION_SUBGRAPH::NONE, orientLabel(), RPT_SEVERITY_ACTION, RPT_SEVERITY_ERROR, SCH_GLOBAL_LABEL_T, SCH_HIER_LABEL_T, SCH_LABEL_T, SCH_PIN_T, SCH_SHEET_PIN_T, EDA_ITEM::SetFlags(), EDA_ITEM::SetParent(), SCH_LABEL_BASE::SetSpinStyle(), EDA_TEXT::SetTextSize(), SCH_CONNECTION::Sheet(), and EDA_ITEM::Type().
Referenced by applyChangelist().
void BACK_ANNOTATE::PushNewLinksToPCB | ( | ) |
Definition at line 135 of file backannotate.cpp.
References FRAME_PCB_EDITOR, m_frame, and MAIL_PCB_UPDATE_LINKS.
Referenced by DIALOG_UPDATE_FROM_PCB::OnUpdateClick().
|
private |
Definition at line 166 of file backannotate.h.
Referenced by applyChangelist(), checkForUnusedSymbols(), and getChangeList().
|
private |
Definition at line 169 of file backannotate.h.
Referenced by applyChangelist(), applyPinSwaps(), BACK_ANNOTATE(), BackAnnotateSymbols(), and processNetNameChange().
|
private |
Definition at line 161 of file backannotate.h.
Referenced by applyChangelist(), applyPinSwaps(), BACK_ANNOTATE(), and processNetNameChange().
|
private |
Definition at line 167 of file backannotate.h.
Referenced by applyChangelist(), applyPinSwaps(), BACK_ANNOTATE(), BackAnnotateSymbols(), checkForUnusedSymbols(), FetchNetlistFromPCB(), processNetNameChange(), and PushNewLinksToPCB().
|
private |
Definition at line 152 of file backannotate.h.
Referenced by BACK_ANNOTATE(), BackAnnotateSymbols(), checkForUnusedSymbols(), getChangeList(), and getPcbModulesFromString().
|
private |
Definition at line 165 of file backannotate.h.
Referenced by BackAnnotateSymbols(), and getChangeList().
|
private |
Definition at line 163 of file backannotate.h.
Referenced by getChangeList(), and getPcbModulesFromString().
|
private |
Definition at line 160 of file backannotate.h.
Referenced by applyChangelist(), and BACK_ANNOTATE().
|
private |
Definition at line 159 of file backannotate.h.
Referenced by applyChangelist(), and BACK_ANNOTATE().
|
private |
Definition at line 157 of file backannotate.h.
Referenced by applyChangelist(), BACK_ANNOTATE(), and BackAnnotateSymbols().
|
private |
Definition at line 153 of file backannotate.h.
Referenced by applyChangelist(), BACK_ANNOTATE(), and BackAnnotateSymbols().
|
private |
Definition at line 156 of file backannotate.h.
Referenced by applyChangelist(), BACK_ANNOTATE(), and BackAnnotateSymbols().
|
private |
Definition at line 158 of file backannotate.h.
Referenced by applyChangelist(), BACK_ANNOTATE(), and BackAnnotateSymbols().
|
private |
Definition at line 155 of file backannotate.h.
Referenced by applyChangelist(), BACK_ANNOTATE(), and BackAnnotateSymbols().
|
private |
Definition at line 154 of file backannotate.h.
Referenced by applyChangelist(), BACK_ANNOTATE(), and BackAnnotateSymbols().
|
private |
Definition at line 164 of file backannotate.h.
Referenced by BackAnnotateSymbols(), checkForUnusedSymbols(), and getChangeList().
|
private |
Definition at line 150 of file backannotate.h.
Referenced by applyChangelist(), applyPinSwaps(), BACK_ANNOTATE(), BackAnnotateSymbols(), checkForUnusedSymbols(), getChangeList(), getPcbModulesFromString(), and processNetNameChange().