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 )

◆ ~BACK_ANNOTATE()

BACK_ANNOTATE::~BACK_ANNOTATE ( )

Definition at line 64 of file backannotate.cpp.

Member Function Documentation

◆ applyChangelist()

void BACK_ANNOTATE::applyChangelist ( )
private

◆ BackAnnotateSymbols()

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

Run back annotation algorithm.

If any errors, back annotation doesn't run.

Parameters
aNetlistis the netlist to use for back annotation.
Returns
true if back annotation completed success.

Definition at line 69 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().

◆ checkForUnusedSymbols()

void BACK_ANNOTATE::checkForUnusedSymbols ( )
private

Check if some symbols are not represented in PCB footprints and vice versa.

m_refs must be sorted by path.

Definition at line 318 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().

◆ FetchNetlistFromPCB()

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

Get netlist from the Pcbnew.

Parameters
aNetlistis the netlist for the board editor.
Returns
true if success.

Definition at line 96 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().

◆ 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, RPT_SEVERITY_ERROR, RPT_SEVERITY_WARNING, and Scan().

Referenced by BackAnnotateSymbols().

◆ processNetNameChange()

◆ PushNewLinksToPCB()

void BACK_ANNOTATE::PushNewLinksToPCB ( )

Definition at line 123 of file backannotate.cpp.

References FRAME_PCB_EDITOR, m_frame, and MAIL_PCB_UPDATE_LINKS.

Referenced by DIALOG_UPDATE_FROM_PCB::OnUpdateClick().

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

◆ m_dryRun

bool BACK_ANNOTATE::m_dryRun
private

Definition at line 151 of file backannotate.h.

Referenced by applyChangelist(), BACK_ANNOTATE(), 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(), BACK_ANNOTATE(), and BackAnnotateSymbols().

◆ m_processFootprints

bool BACK_ANNOTATE::m_processFootprints
private

Definition at line 145 of file backannotate.h.

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

◆ m_processNetNames

bool BACK_ANNOTATE::m_processNetNames
private

Definition at line 148 of file backannotate.h.

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

◆ m_processOtherFields

bool BACK_ANNOTATE::m_processOtherFields
private

Definition at line 150 of file backannotate.h.

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

◆ m_processReferences

bool BACK_ANNOTATE::m_processReferences
private

Definition at line 147 of file backannotate.h.

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

◆ m_processValues

bool BACK_ANNOTATE::m_processValues
private

Definition at line 146 of file backannotate.h.

Referenced by applyChangelist(), BACK_ANNOTATE(), 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: