KiCad PCB EDA Suite
Loading...
Searching...
No Matches
BACK_ANNOTATE Class Reference

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 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.
 
void processNetNameChange (SCH_COMMIT *aCommit, const wxString &aRef, SCH_PIN *aPin, const SCH_CONNECTION *aConnection, const wxString &aOldName, const wxString &aNewName)
 

Private Attributes

REPORTERm_reporter
 
bool m_matchByReference
 
bool m_processFootprints
 
bool m_processValues
 
bool m_processReferences
 
bool m_processNetNames
 
bool m_processAttributes
 
bool m_processOtherFields
 
bool m_dryRun
 
PCB_FOOTPRINTS_MAP m_pcbFootprints
 
SCH_REFERENCE_LIST m_refs
 
SCH_MULTI_UNIT_REFERENCE_MAP m_multiUnitsRefs
 
std::deque< CHANGELIST_ITEMm_changelist
 
SCH_EDIT_FRAMEm_frame
 
int m_changesCount
 

Detailed Description

Back annotation algorithm class used to receive, check, and apply a NETLIST from Pcbnew.

The following checks are made:

  • Schematic symbol exists, but linked Pcbnew footprint missing.
  • Pcbnew footprint exists but no schematic symbol connected to.
  • Pcbnew footprint is standalone.
  • Schematic sheet is reused one or more times and user trying to change footprint or value only for few of them.
  • Schematic symbols share same path.
  • More than one Pcbnew footprint linked to same path.

Definition at line 55 of file backannotate.h.

Member Typedef Documentation

◆ CHANGELIST_ITEM

using BACK_ANNOTATE::CHANGELIST_ITEM = std::pair<SCH_REFERENCE, std::shared_ptr<PCB_FP_DATA> >

Definition at line 88 of file backannotate.h.

◆ PCB_FOOTPRINTS_MAP

using BACK_ANNOTATE::PCB_FOOTPRINTS_MAP = std::map<wxString, std::shared_ptr<PCB_FP_DATA> >

Definition at line 86 of file backannotate.h.

Constructor & Destructor Documentation

◆ BACK_ANNOTATE()

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  aDryRun 
)

Definition at line 44 of file backannotate.cpp.

◆ ~BACK_ANNOTATE()

BACK_ANNOTATE::~BACK_ANNOTATE ( )

Definition at line 64 of file backannotate.cpp.

Member Function Documentation

◆ applyChangelist()

void BACK_ANNOTATE::applyChangelist ( )
private

Apply changelist to the schematic.

Definition at line 361 of file backannotate.cpp.

References _, SCH_SYMBOL::AddField(), EscapeHTML(), SCH_SYMBOL::FindField(), FOOTPRINT_FIELD, GetCanonicalFieldName(), SCH_FIELD::GetCanonicalName(), SYMBOL::GetDNP(), SYMBOL::GetExcludedFromBOM(), SCH_SYMBOL::GetFieldCount(), SCH_SYMBOL::GetFields(), EDA_ITEM::GetFlags(), SCH_REFERENCE::GetFootprint(), SCH_SYMBOL::GetPin(), SCH_REFERENCE::GetRef(), SCH_REFERENCE::GetSheetPath(), SCH_FIELD::GetShownText(), SCH_REFERENCE::GetSymbol(), SCH_REFERENCE::GetValue(), 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_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, pin, processNetNameChange(), SCH_COMMIT::Push(), SCH_EDIT_FRAME::RecalculateConnections(), REFERENCE_FIELD, SCH_SYMBOL::RemoveField(), REPORTER::ReportHead(), RPT_SEVERITY_ACTION, RPT_SEVERITY_ERROR, SYMBOL::SetDNP(), SYMBOL::SetExcludedFromBOM(), SCH_SYMBOL::SetFootprintFieldText(), SCH_SYMBOL::SetRef(), SCH_FIELD::SetText(), SCH_SYMBOL::SetValueFieldText(), SKIP_STRUCT, SCH_EDIT_FRAME::UpdateNetHighlightStatus(), and VALUE_FIELD.

Referenced by BackAnnotateSymbols().

◆ BackAnnotateSymbols()

bool BACK_ANNOTATE::BackAnnotateSymbols ( const std::string &  aNetlist)

◆ checkForUnusedSymbols()

void BACK_ANNOTATE::checkForUnusedSymbols ( )
private

◆ FetchNetlistFromPCB()

bool BACK_ANNOTATE::FetchNetlistFromPCB ( std::string &  aNetlist)

◆ getChangeList()

◆ getPcbModulesFromString()

void BACK_ANNOTATE::getPcbModulesFromString ( const std::string &  aPayload)
private

Parse netlist sent over KiWay express mail interface and fill m_pcbModules.

Parameters
aPayloadis the netlist from Pcbnew.
Returns
number of errors during parsing. Create changelist.

Definition at line 131 of file backannotate.cpp.

References _, From_UTF8(), m_matchByReference, m_pcbFootprints, m_reporter, name, path, REPORTER::ReportHead(), RPT_SEVERITY_ERROR, RPT_SEVERITY_WARNING, and Scan().

Referenced by BackAnnotateSymbols().

◆ processNetNameChange()

◆ PushNewLinksToPCB()

void BACK_ANNOTATE::PushNewLinksToPCB ( )

Member Data Documentation

◆ m_changelist

std::deque<CHANGELIST_ITEM> BACK_ANNOTATE::m_changelist
private

Definition at line 156 of file backannotate.h.

Referenced by applyChangelist(), checkForUnusedSymbols(), and getChangeList().

◆ m_changesCount

int BACK_ANNOTATE::m_changesCount
private

Definition at line 159 of file backannotate.h.

Referenced by applyChangelist(), BackAnnotateSymbols(), and processNetNameChange().

◆ m_dryRun

bool BACK_ANNOTATE::m_dryRun
private

Definition at line 151 of file backannotate.h.

Referenced by applyChangelist(), and processNetNameChange().

◆ m_frame

◆ m_matchByReference

bool BACK_ANNOTATE::m_matchByReference
private

◆ m_multiUnitsRefs

SCH_MULTI_UNIT_REFERENCE_MAP BACK_ANNOTATE::m_multiUnitsRefs
private

Definition at line 155 of file backannotate.h.

Referenced by BackAnnotateSymbols(), and getChangeList().

◆ m_pcbFootprints

PCB_FOOTPRINTS_MAP BACK_ANNOTATE::m_pcbFootprints
private

Definition at line 153 of file backannotate.h.

Referenced by getChangeList(), and getPcbModulesFromString().

◆ m_processAttributes

bool BACK_ANNOTATE::m_processAttributes
private

Definition at line 149 of file backannotate.h.

Referenced by applyChangelist(), and BackAnnotateSymbols().

◆ m_processFootprints

bool BACK_ANNOTATE::m_processFootprints
private

Definition at line 145 of file backannotate.h.

Referenced by applyChangelist(), and BackAnnotateSymbols().

◆ m_processNetNames

bool BACK_ANNOTATE::m_processNetNames
private

Definition at line 148 of file backannotate.h.

Referenced by applyChangelist(), and BackAnnotateSymbols().

◆ m_processOtherFields

bool BACK_ANNOTATE::m_processOtherFields
private

Definition at line 150 of file backannotate.h.

Referenced by applyChangelist().

◆ m_processReferences

bool BACK_ANNOTATE::m_processReferences
private

Definition at line 147 of file backannotate.h.

Referenced by applyChangelist(), and BackAnnotateSymbols().

◆ m_processValues

bool BACK_ANNOTATE::m_processValues
private

Definition at line 146 of file backannotate.h.

Referenced by applyChangelist(), and BackAnnotateSymbols().

◆ m_refs

SCH_REFERENCE_LIST BACK_ANNOTATE::m_refs
private

Definition at line 154 of file backannotate.h.

Referenced by BackAnnotateSymbols(), checkForUnusedSymbols(), and getChangeList().

◆ m_reporter


The documentation for this class was generated from the following files: