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

Update the BOARD with a new netlist. More...

#include <board_netlist_updater.h>

Public Member Functions

 BOARD_NETLIST_UPDATER (PCB_EDIT_FRAME *aFrame, BOARD *aBoard)
 
 ~BOARD_NETLIST_UPDATER ()
 
bool UpdateNetlist (NETLIST &aNetlist)
 Update the board's components according to the new netlist.
 
void SetReporter (REPORTER *aReporter)
 Enable dry run mode (just report, no changes to PCB).
 
void SetIsDryRun (bool aEnabled)
 
void SetReplaceFootprints (bool aEnabled)
 
void SetOverrideLocks (bool aOverride)
 
void SetDeleteUnusedFootprints (bool aEnabled)
 
void SetLookupByTimestamp (bool aEnabled)
 
std::vector< FOOTPRINT * > GetAddedFootprints () const
 

Private Member Functions

void cacheNetname (PAD *aPad, const wxString &aNetname)
 
wxString getNetname (PAD *aPad)
 
void cachePinFunction (PAD *aPad, const wxString &aPinFunction)
 
wxString getPinFunction (PAD *aPad)
 
VECTOR2I estimateFootprintInsertionPosition ()
 
FOOTPRINTaddNewFootprint (COMPONENT *aComponent)
 
FOOTPRINTreplaceFootprint (NETLIST &aNetlist, FOOTPRINT *aFootprint, COMPONENT *aNewComponent)
 
bool updateFootprintParameters (FOOTPRINT *aPcbFootprint, COMPONENT *aNetlistComponent)
 
bool updateComponentPadConnections (FOOTPRINT *aFootprint, COMPONENT *aNewComponent)
 
void updateComponentClass (FOOTPRINT *aFootprint, COMPONENT *aNewComponent)
 
void cacheCopperZoneConnections ()
 
bool updateCopperZoneNets (NETLIST &aNetlist)
 
bool testConnectivity (NETLIST &aNetlist, std::map< COMPONENT *, FOOTPRINT * > &aFootprintMap)
 

Private Attributes

PCB_EDIT_FRAMEm_frame
 
BOARD_COMMIT m_commit
 
BOARDm_board
 
REPORTERm_reporter
 
std::map< ZONE *, std::vector< PAD * > > m_zoneConnectionsCache
 
std::map< wxString, wxString > m_oldToNewNets
 
std::map< PAD *, wxString > m_padNets
 
std::map< PAD *, wxString > m_padPinFunctions
 
std::vector< FOOTPRINT * > m_addedFootprints
 
std::map< wxString, NETINFO_ITEM * > m_addedNets
 
bool m_deleteUnusedFootprints
 
bool m_isDryRun
 
bool m_replaceFootprints
 
bool m_lookupByTimestamp
 
bool m_overrideLocks
 
int m_warningCount
 
int m_errorCount
 
int m_newFootprintsCount
 

Detailed Description

Update the BOARD with a new netlist.

The changes are made to the board are as follows they are not disabled in the status settings in the NETLIST:

  • If a new component is found in the NETLIST and not in the BOARD, it is added to the BOARD.
  • If a the component in the NETLIST is already on the BOARD, then one or more of the following actions can occur:
    • If the footprint name in the NETLIST does not match the footprint name on the BOARD, the footprint on the BOARD is replaced with the footprint specified in the NETLIST and the proper parameters are copied from the existing footprint.
    • If the reference designator in the NETLIST does not match the reference designator on the BOARD, the reference designator is updated from the NETLIST.
    • If the value field in the NETLIST does not match the value field on the BOARD, the value field is updated from the NETLIST.
    • If the time stamp in the NETLIST does not match the time stamp on the BOARD, the time stamp is updated from the NETLIST.
  • After each footprint is added or update as described above, each footprint pad net name is compared and updated to the value defined in the NETLIST.
  • After all of the footprints have been added, updated, and net names and pin function properly set, any extra unlocked footprints are removed from the BOARD.

Definition at line 65 of file board_netlist_updater.h.

Constructor & Destructor Documentation

◆ BOARD_NETLIST_UPDATER()

◆ ~BOARD_NETLIST_UPDATER()

BOARD_NETLIST_UPDATER::~BOARD_NETLIST_UPDATER ( )

Definition at line 69 of file board_netlist_updater.cpp.

Member Function Documentation

◆ addNewFootprint()

◆ cacheCopperZoneConnections()

void BOARD_NETLIST_UPDATER::cacheCopperZoneConnections ( )
private

◆ cacheNetname()

void BOARD_NETLIST_UPDATER::cacheNetname ( PAD aPad,
const wxString &  aNetname 
)
private

Definition at line 77 of file board_netlist_updater.cpp.

References m_padNets.

Referenced by updateComponentPadConnections().

◆ cachePinFunction()

void BOARD_NETLIST_UPDATER::cachePinFunction ( PAD aPad,
const wxString &  aPinFunction 
)
private

Definition at line 92 of file board_netlist_updater.cpp.

References m_padPinFunctions.

Referenced by updateComponentPadConnections().

◆ estimateFootprintInsertionPosition()

◆ GetAddedFootprints()

std::vector< FOOTPRINT * > BOARD_NETLIST_UPDATER::GetAddedFootprints ( ) const
inline

Definition at line 94 of file board_netlist_updater.h.

References m_addedFootprints.

Referenced by PCB_EDIT_FRAME::OnNetlistChanged().

◆ getNetname()

wxString BOARD_NETLIST_UPDATER::getNetname ( PAD aPad)
private

Definition at line 83 of file board_netlist_updater.cpp.

References BOARD_CONNECTED_ITEM::GetNetname(), m_isDryRun, and m_padNets.

Referenced by updateCopperZoneNets().

◆ getPinFunction()

wxString BOARD_NETLIST_UPDATER::getPinFunction ( PAD aPad)
private

Definition at line 98 of file board_netlist_updater.cpp.

References PAD::GetPinFunction(), m_isDryRun, and m_padPinFunctions.

◆ replaceFootprint()

◆ SetDeleteUnusedFootprints()

void BOARD_NETLIST_UPDATER::SetDeleteUnusedFootprints ( bool  aEnabled)
inline

◆ SetIsDryRun()

void BOARD_NETLIST_UPDATER::SetIsDryRun ( bool  aEnabled)
inline

◆ SetLookupByTimestamp()

void BOARD_NETLIST_UPDATER::SetLookupByTimestamp ( bool  aEnabled)
inline

◆ SetOverrideLocks()

void BOARD_NETLIST_UPDATER::SetOverrideLocks ( bool  aOverride)
inline

◆ SetReplaceFootprints()

void BOARD_NETLIST_UPDATER::SetReplaceFootprints ( bool  aEnabled)
inline

◆ SetReporter()

void BOARD_NETLIST_UPDATER::SetReporter ( REPORTER aReporter)
inline

Enable dry run mode (just report, no changes to PCB).

Definition at line 81 of file board_netlist_updater.h.

References m_reporter.

Referenced by DIALOG_IMPORT_NETLIST::loadNetlist(), and DIALOG_UPDATE_PCB::PerformUpdate().

◆ testConnectivity()

◆ updateComponentClass()

◆ updateComponentPadConnections()

◆ updateCopperZoneNets()

◆ updateFootprintParameters()

bool BOARD_NETLIST_UPDATER::updateFootprintParameters ( FOOTPRINT aPcbFootprint,
COMPONENT aNetlistComponent 
)
private

Definition at line 364 of file board_netlist_updater.cpp.

References _, FOOTPRINT::AddField(), KIID_PATH::AsString(), B_Fab, FOOTPRINT::Clone(), copy, EscapeHTML(), F_Cu, F_Fab, FOOTPRINT::Footprint(), FOOTPRINT_FIELD, FP_DNP, FP_EXCLUDE_FROM_BOM, FP_JUST_ADDED, FOOTPRINT::GetAttributes(), GetCanonicalFieldName(), PCB_BASE_FRAME::GetCanvas(), PCB_BASE_FRAME::GetDesignSettings(), FOOTPRINT::GetFieldByName(), FOOTPRINT::GetFieldCount(), COMPONENT::GetFields(), FOOTPRINT::GetFields(), FOOTPRINT::GetFilters(), COMPONENT::GetHumanReadablePath(), COMPONENT::GetKIIDs(), FOOTPRINT::GetLayer(), FOOTPRINT::GetOrientation(), FOOTPRINT::GetPath(), COMPONENT::GetPath(), FOOTPRINT::GetPosition(), COMPONENT::GetProperties(), FOOTPRINT::GetReference(), COMPONENT::GetReference(), FOOTPRINT::GetSheetfile(), FOOTPRINT::GetSheetname(), COMMIT::GetStatus(), FOOTPRINT::GetValue(), COMPONENT::GetValue(), PCB_DRAW_PANEL_GAL::GetView(), FOOTPRINT::HasFieldByName(), m_commit, m_frame, m_isDryRun, m_replaceFootprints, m_reporter, COMMIT::Modified(), name, REFERENCE_FIELD, KIGFX::PCB_VIEW::Remove(), FOOTPRINT::RemoveField(), REPORTER::Report(), PCB_TEXT::Rotate(), RPT_SEVERITY_ACTION, FOOTPRINT::SetAttributes(), FOOTPRINT::SetFilters(), BOARD_ITEM::SetLayer(), PCB_FIELD::SetName(), FOOTPRINT::SetPath(), PCB_TEXT::SetPosition(), FOOTPRINT::SetReference(), FOOTPRINT::SetSheetfile(), FOOTPRINT::SetSheetname(), EDA_TEXT::SetText(), FOOTPRINT::SetValue(), EDA_TEXT::SetVisible(), PCB_TEXT::StyleFromSettings(), and VALUE_FIELD.

Referenced by UpdateNetlist().

◆ UpdateNetlist()

bool BOARD_NETLIST_UPDATER::UpdateNetlist ( NETLIST aNetlist)

Update the board's components according to the new netlist.

See BOARD_NETLIST_UPDATER class description for the details of the process.

Parameters
aNetlistthe new netlist
Returns
true if process was completed successfully

Definition at line 1228 of file board_netlist_updater.cpp.

References _, addNewFootprint(), BOARD::BuildConnectivity(), cacheCopperZoneConnections(), CHT_UNGROUP, EscapeHTML(), COMPONENT_CLASS_MANAGER::FinishNetlistUpdate(), BOARD::Footprints(), LIB_ID::Format(), FP_BOARD_ONLY, NETLIST::GetComponent(), NETLIST::GetComponentByPath(), NETLIST::GetComponentByReference(), BOARD::GetComponentClassManager(), BOARD::GetConnectivity(), NETLIST::GetCount(), COMPONENT::GetFPID(), COMPONENT::GetKIIDs(), BOARD::GetNetInfo(), COMPONENT::GetPath(), COMPONENT::GetProperties(), COMPONENT::GetReference(), COMPONENT_CLASS_MANAGER::InitNetlistUpdate(), m_addedNets, m_board, m_commit, m_deleteUnusedFootprints, m_errorCount, m_frame, m_isDryRun, m_lookupByTimestamp, m_newFootprintsCount, m_overrideLocks, m_replaceFootprints, m_reporter, m_warningCount, PCB_EDIT_FRAME::OnModify(), pad, BOARD_COMMIT::Push(), COMMIT::Remove(), BOARD::RemoveUnusedNets(), replaceFootprint(), REPORTER::Report(), REPORTER::ReportTail(), RPT_SEVERITY_ACTION, RPT_SEVERITY_ERROR, RPT_SEVERITY_INFO, RPT_SEVERITY_WARNING, BOARD_COMMIT::Stage(), BOARD::SynchronizeNetsAndNetClasses(), testConnectivity(), updateComponentClass(), updateComponentPadConnections(), updateCopperZoneNets(), updateFootprintParameters(), UTF8::wx_str(), and ZONE_FILL_OP.

Referenced by PCB_EDIT_FRAME::KiwayMailIn(), DIALOG_IMPORT_NETLIST::loadNetlist(), and DIALOG_UPDATE_PCB::PerformUpdate().

Member Data Documentation

◆ m_addedFootprints

std::vector<FOOTPRINT*> BOARD_NETLIST_UPDATER::m_addedFootprints
private

Definition at line 131 of file board_netlist_updater.h.

Referenced by addNewFootprint(), and GetAddedFootprints().

◆ m_addedNets

std::map<wxString, NETINFO_ITEM*> BOARD_NETLIST_UPDATER::m_addedNets
private

◆ m_board

◆ m_commit

◆ m_deleteUnusedFootprints

bool BOARD_NETLIST_UPDATER::m_deleteUnusedFootprints
private

◆ m_errorCount

int BOARD_NETLIST_UPDATER::m_errorCount
private

◆ m_frame

PCB_EDIT_FRAME* BOARD_NETLIST_UPDATER::m_frame
private

◆ m_isDryRun

◆ m_lookupByTimestamp

bool BOARD_NETLIST_UPDATER::m_lookupByTimestamp
private

◆ m_newFootprintsCount

int BOARD_NETLIST_UPDATER::m_newFootprintsCount
private

◆ m_oldToNewNets

std::map<wxString, wxString> BOARD_NETLIST_UPDATER::m_oldToNewNets
private

Definition at line 128 of file board_netlist_updater.h.

Referenced by updateComponentPadConnections(), and updateCopperZoneNets().

◆ m_overrideLocks

bool BOARD_NETLIST_UPDATER::m_overrideLocks
private

◆ m_padNets

std::map<PAD*, wxString> BOARD_NETLIST_UPDATER::m_padNets
private

Definition at line 129 of file board_netlist_updater.h.

Referenced by cacheNetname(), and getNetname().

◆ m_padPinFunctions

std::map<PAD*, wxString> BOARD_NETLIST_UPDATER::m_padPinFunctions
private

Definition at line 130 of file board_netlist_updater.h.

Referenced by cachePinFunction(), and getPinFunction().

◆ m_replaceFootprints

bool BOARD_NETLIST_UPDATER::m_replaceFootprints
private

◆ m_reporter

◆ m_warningCount

int BOARD_NETLIST_UPDATER::m_warningCount
private

◆ m_zoneConnectionsCache

std::map<ZONE*, std::vector<PAD*> > BOARD_NETLIST_UPDATER::m_zoneConnectionsCache
private

Definition at line 127 of file board_netlist_updater.h.

Referenced by cacheCopperZoneConnections(), and updateCopperZoneNets().


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