KiCad PCB EDA Suite
BOARD_NETLIST_UPDATER Class Reference

Class BOARD_NETLIST_UPDATER updates 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)
 Function UpdateNetlist() More...
 
bool UpdateNetlist (const wxString &aNetlistFileName, const wxString &aCmpFileName)
 
void SetReporter (REPORTER *aReporter)
 

Sets the reporter object

More...
 
void SetDeleteSinglePadNets (bool aEnabled)
 

Enables "delete single pad nets" option

More...
 
void SetIsDryRun (bool aEnabled)
 

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

More...
 
void SetReplaceFootprints (bool aEnabled)
 

Enables replacing footprints with new ones

More...
 
void SetDeleteUnusedComponents (bool aEnabled)
 

Enables removing unused components

More...
 
void SetLookupByTimestamp (bool aEnabled)
 

Enables component lookup by timestamp instead of reference

More...
 
std::vector< MODULE * > GetAddedComponents () const
 

Private Member Functions

void cacheNetname (D_PAD *aPad, const wxString &aNetname)
 
wxString getNetname (D_PAD *aPad)
 
wxPoint estimateComponentInsertionPosition ()
 
MODULEaddNewComponent (COMPONENT *aComponent)
 
MODULEreplaceComponent (NETLIST &aNetlist, MODULE *aPcbComponent, COMPONENT *aNewComponent)
 
bool updateComponentParameters (MODULE *aPcbComponent, COMPONENT *aNewComponent)
 
bool updateComponentPadConnections (MODULE *aPcbComponent, COMPONENT *aNewComponent)
 
void cacheCopperZoneConnections ()
 
bool updateCopperZoneNets (NETLIST &aNetlist)
 
bool deleteUnusedComponents (NETLIST &aNetlist)
 
bool deleteSinglePadNets ()
 
bool testConnectivity (NETLIST &aNetlist)
 

Private Attributes

PCB_EDIT_FRAMEm_frame
 
BOARD_COMMIT m_commit
 
BOARDm_board
 
REPORTERm_reporter
 
std::map< ZONE_CONTAINER *, std::vector< D_PAD * > > m_zoneConnectionsCache
 
std::map< wxString, wxString > m_oldToNewNets
 
std::map< D_PAD *, wxString > m_padNets
 
std::vector< MODULE * > m_addedComponents
 
std::map< wxString, NETINFO_ITEM * > m_addedNets
 
bool m_deleteSinglePadNets
 
bool m_deleteUnusedComponents
 
bool m_isDryRun
 
bool m_replaceFootprints
 
bool m_lookupByTimestamp
 
int m_warningCount
 
int m_errorCount
 
int m_newFootprintsCount
 

Detailed Description

Class BOARD_NETLIST_UPDATER updates 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 properly set, any extra unlock footprints are removed from the BOARD.

Definition at line 71 of file board_netlist_updater.h.

Constructor & Destructor Documentation

◆ BOARD_NETLIST_UPDATER()

BOARD_NETLIST_UPDATER::BOARD_NETLIST_UPDATER ( PCB_EDIT_FRAME aFrame,
BOARD aBoard 
)

Definition at line 52 of file board_netlist_updater.cpp.

52  :
53  m_frame( aFrame ),
54  m_commit( aFrame ),
55  m_board( aBoard )
56 {
58 
59  m_deleteSinglePadNets = true;
61  m_isDryRun = false;
62  m_replaceFootprints = true;
63  m_lookupByTimestamp = false;
64 
65  m_warningCount = 0;
66  m_errorCount = 0;
68 }
static REPORTER & GetInstance()
Definition: reporter.cpp:104

References NULL_REPORTER::GetInstance(), m_deleteSinglePadNets, m_deleteUnusedComponents, m_errorCount, m_isDryRun, m_lookupByTimestamp, m_newFootprintsCount, m_replaceFootprints, m_reporter, and m_warningCount.

◆ ~BOARD_NETLIST_UPDATER()

BOARD_NETLIST_UPDATER::~BOARD_NETLIST_UPDATER ( )

Definition at line 71 of file board_netlist_updater.cpp.

72 {
73 }

Member Function Documentation

◆ addNewComponent()

MODULE * BOARD_NETLIST_UPDATER::addNewComponent ( COMPONENT aComponent)
private

Definition at line 121 of file board_netlist_updater.cpp.

122 {
123  wxString msg;
124 
125  if( aComponent->GetFPID().empty() )
126  {
127  msg.Printf( _( "Cannot add %s (no footprint assigned)." ),
128  aComponent->GetReference(),
129  aComponent->GetFPID().Format().wx_str() );
131  ++m_errorCount;
132  return nullptr;
133  }
134 
135  MODULE* footprint = m_frame->LoadFootprint( aComponent->GetFPID() );
136 
137  if( footprint == nullptr )
138  {
139  msg.Printf( _( "Cannot add %s (footprint \"%s\" not found)." ),
140  aComponent->GetReference(),
141  aComponent->GetFPID().Format().wx_str() );
143  ++m_errorCount;
144  return nullptr;
145  }
146 
147  msg.Printf( _( "Add %s (footprint \"%s\")." ),
148  aComponent->GetReference(),
149  aComponent->GetFPID().Format().wx_str() );
151 
153 
154  if( !m_isDryRun )
155  {
156  footprint->SetParent( m_board );
158  footprint->SetTimeStamp( GetNewTimeStamp() );
159 
160  m_addedComponents.push_back( footprint );
161  m_commit.Add( footprint );
162 
163  return footprint;
164  }
165  else
166  delete footprint;
167 
168  return NULL;
169 }
COMMIT & Add(EDA_ITEM *aItem)
Adds a new item to the model
Definition: commit.h:78
bool empty() const
Definition: lib_id.h:186
const LIB_ID & GetFPID() const
Definition: pcb_netlist.h:166
timestamp_t GetNewTimeStamp()
Definition: common.cpp:217
void SetParent(EDA_ITEM *aParent)
Definition: base_struct.h:212
const wxString & GetReference() const
Definition: pcb_netlist.h:151
void SetPosition(const wxPoint &aPos) override
#define _(s)
UTF8 Format() const
Definition: lib_id.cpp:237
MODULE * LoadFootprint(const LIB_ID &aFootprintId)
Function LoadFootprint attempts to load aFootprintId from the footprint library table.
wxString wx_str() const
Definition: utf8.cpp:51
virtual REPORTER & Report(const wxString &aText, SEVERITY aSeverity=RPT_UNDEFINED)=0
Function Report is a pure virtual function to override in the derived object.
std::vector< MODULE * > m_addedComponents
void SetTimeStamp(timestamp_t aNewTimeStamp)
Definition: base_struct.h:202

References _, COMMIT::Add(), LIB_ID::empty(), estimateComponentInsertionPosition(), LIB_ID::Format(), COMPONENT::GetFPID(), GetNewTimeStamp(), COMPONENT::GetReference(), PCB_BASE_FRAME::LoadFootprint(), m_addedComponents, m_board, m_commit, m_errorCount, m_frame, m_isDryRun, m_newFootprintsCount, m_reporter, REPORTER::Report(), REPORTER::RPT_ACTION, REPORTER::RPT_ERROR, EDA_ITEM::SetParent(), MODULE::SetPosition(), EDA_ITEM::SetTimeStamp(), and UTF8::wx_str().

Referenced by UpdateNetlist().

◆ cacheCopperZoneConnections()

void BOARD_NETLIST_UPDATER::cacheCopperZoneConnections ( )
private

Definition at line 389 of file board_netlist_updater.cpp.

390 {
391  for( int ii = 0; ii < m_board->GetAreaCount(); ii++ )
392  {
393  ZONE_CONTAINER* zone = m_board->GetArea( ii );
394 
395  if( !zone->IsOnCopperLayer() || zone->GetIsKeepout() )
396  continue;
397 
398  m_zoneConnectionsCache[ zone ] = m_board->GetConnectivity()->GetConnectedPads( zone );
399  }
400 }
Class ZONE_CONTAINER handles a list of polygons defining a copper zone.
Definition: class_zone.h:57
std::map< ZONE_CONTAINER *, std::vector< D_PAD * > > m_zoneConnectionsCache
int GetAreaCount() const
Function GetAreaCount.
Definition: class_board.h:955
std::shared_ptr< CONNECTIVITY_DATA > GetConnectivity() const
Function GetConnectivity() returns list of missing connections between components/tracks.
Definition: class_board.h:310
bool GetIsKeepout() const
Accessors to parameters used in Keepout zones:
Definition: class_zone.h:621
ZONE_CONTAINER * GetArea(int index) const
Function GetArea returns the Area (Zone Container) at a given index.
Definition: class_board.h:926
bool IsOnCopperLayer() const
Function IsOnCopperLayer.
Definition: class_zone.cpp:184

References BOARD::GetArea(), BOARD::GetAreaCount(), BOARD::GetConnectivity(), ZONE_CONTAINER::GetIsKeepout(), ZONE_CONTAINER::IsOnCopperLayer(), m_board, and m_zoneConnectionsCache.

Referenced by UpdateNetlist().

◆ cacheNetname()

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

Definition at line 79 of file board_netlist_updater.cpp.

80 {
81  m_padNets[ aPad ] = aNetname;
82 }
std::map< D_PAD *, wxString > m_padNets

References m_padNets.

Referenced by deleteSinglePadNets(), and updateComponentPadConnections().

◆ deleteSinglePadNets()

bool BOARD_NETLIST_UPDATER::deleteSinglePadNets ( )
private

Definition at line 564 of file board_netlist_updater.cpp.

565 {
566  int count = 0;
567  wxString netname;
568  wxString msg;
569  D_PAD* previouspad = NULL;
570 
571  // We need the pad list for next tests.
572 
574 
575  std::vector<D_PAD*> padlist = m_board->GetPads();
576 
577  // Sort pads by netlist name
578  std::sort( padlist.begin(), padlist.end(),
579  [ this ]( D_PAD* a, D_PAD* b ) -> bool { return getNetname( a ) < getNetname( b ); } );
580 
581  for( D_PAD* pad : padlist )
582  {
583  if( getNetname( pad ).IsEmpty() )
584  continue;
585 
586  if( netname != getNetname( pad ) ) // End of net
587  {
588  if( previouspad && count == 1 )
589  {
590  // First, see if we have a copper zone attached to this pad.
591  // If so, this is not really a single pad net
592 
593  for( ZONE_CONTAINER* zone : m_board->Zones() )
594  {
595  if( !zone->IsOnCopperLayer() )
596  continue;
597 
598  if( zone->GetIsKeepout() )
599  continue;
600 
601  if( zone->GetNetname() == getNetname( previouspad ) )
602  {
603  count++;
604  break;
605  }
606  }
607 
608  if( count == 1 ) // Really one pad, and nothing else
609  {
610  msg.Printf( _( "Remove single pad net %s." ),
611  UnescapeString( getNetname( previouspad ) ) );
613 
614  if( !m_isDryRun )
615  previouspad->SetNetCode( NETINFO_LIST::UNCONNECTED );
616  else
617  cacheNetname( previouspad, wxEmptyString );
618  }
619  }
620 
621  netname = getNetname( pad );
622  count = 1;
623  }
624  else
625  {
626  count++;
627  }
628 
629  previouspad = pad;
630  }
631 
632  // Examine last pad
633  if( count == 1 )
634  {
635  if( !m_isDryRun )
636  previouspad->SetNetCode( NETINFO_LIST::UNCONNECTED );
637  else
638  cacheNetname( previouspad, wxEmptyString );
639  }
640 
641  return true;
642 }
void BuildListOfNets()
Definition: class_board.h:729
Class ZONE_CONTAINER handles a list of polygons defining a copper zone.
Definition: class_zone.h:57
void cacheNetname(D_PAD *aPad, const wxString &aNetname)
wxString getNetname(D_PAD *aPad)
bool SetNetCode(int aNetCode, bool aNoAssert=false)
Function SetNetCode sets net using a net code.
#define _(s)
const std::vector< D_PAD * > GetPads()
Function GetPads returns a reference to a list of all the pads.
ZONE_CONTAINERS & Zones()
Definition: class_board.h:250
wxString UnescapeString(const wxString &aSource)
Definition: string.cpp:123
virtual REPORTER & Report(const wxString &aText, SEVERITY aSeverity=RPT_UNDEFINED)=0
Function Report is a pure virtual function to override in the derived object.
static const int UNCONNECTED
Constant that holds the "unconnected net" number (typically 0) all items "connected" to this net are ...
Definition: netinfo.h:463

References _, BOARD::BuildListOfNets(), cacheNetname(), getNetname(), BOARD::GetPads(), m_board, m_isDryRun, m_reporter, REPORTER::Report(), REPORTER::RPT_ACTION, BOARD_CONNECTED_ITEM::SetNetCode(), NETINFO_LIST::UNCONNECTED, UnescapeString(), and BOARD::Zones().

Referenced by UpdateNetlist().

◆ deleteUnusedComponents()

bool BOARD_NETLIST_UPDATER::deleteUnusedComponents ( NETLIST aNetlist)
private

Definition at line 530 of file board_netlist_updater.cpp.

531 {
532  wxString msg;
533  const COMPONENT* component;
534 
535  for( auto module : m_board->Modules() )
536  {
537 
538  if( m_lookupByTimestamp )
539  component = aNetlist.GetComponentByTimeStamp( module->GetPath() );
540  else
541  component = aNetlist.GetComponentByReference( module->GetReference() );
542 
543  if( component == NULL )
544  {
545  if( module->IsLocked() )
546  {
547  msg.Printf( _( "Cannot remove unused footprint %s (locked)." ), module->GetReference() );
549  continue;
550  }
551 
552  msg.Printf( _( "Remove unused footprint %s." ), module->GetReference() );
554 
555  if( !m_isDryRun )
556  m_commit.Remove( module );
557  }
558  }
559 
560  return true;
561 }
MODULES & Modules()
Definition: class_board.h:236
COMMIT & Remove(EDA_ITEM *aItem)
Removes a new item from the model
Definition: commit.h:90
#define _(s)
Class COMPONENT is used to store components and all of their related information found in a netlist.
Definition: pcb_netlist.h:83
virtual REPORTER & Report(const wxString &aText, SEVERITY aSeverity=RPT_UNDEFINED)=0
Function Report is a pure virtual function to override in the derived object.
COMPONENT * GetComponentByReference(const wxString &aReference)
Function GetComponentByReference returns a COMPONENT by aReference.
COMPONENT * GetComponentByTimeStamp(const wxString &aTimeStamp)
Function GetComponentByTimeStamp returns a COMPONENT by aTimeStamp.

References _, NETLIST::GetComponentByReference(), NETLIST::GetComponentByTimeStamp(), m_board, m_commit, m_isDryRun, m_lookupByTimestamp, m_reporter, BOARD::Modules(), COMMIT::Remove(), REPORTER::Report(), REPORTER::RPT_ACTION, and REPORTER::RPT_WARNING.

Referenced by UpdateNetlist().

◆ estimateComponentInsertionPosition()

wxPoint BOARD_NETLIST_UPDATER::estimateComponentInsertionPosition ( )
private

Definition at line 93 of file board_netlist_updater.cpp.

94 {
95  wxPoint bestPosition;
96 
97  if( !m_board->IsEmpty() )
98  {
99  // Position new components below any existing board features.
101 
102  if( bbox.GetWidth() || bbox.GetHeight() )
103  {
104  bestPosition.x = bbox.Centre().x;
105  bestPosition.y = bbox.GetBottom() + Millimeter2iu( 10 );
106  }
107  }
108  else
109  {
110  // Position new components in the center of the page when the board is empty.
111  wxSize pageSize = m_board->GetPageSettings().GetSizeIU();
112 
113  bestPosition.x = pageSize.GetWidth() / 2;
114  bestPosition.y = pageSize.GetHeight() / 2;
115  }
116 
117  return bestPosition;
118 }
const PAGE_INFO & GetPageSettings() const
Definition: class_board.h:555
const EDA_RECT GetBoardEdgesBoundingBox() const
Function GetBoardEdgesBoundingBox Returns the board bounding box calculated using exclusively the boa...
Definition: class_board.h:804
int GetWidth() const
Definition: eda_rect.h:117
int GetBottom() const
Definition: eda_rect.h:122
int GetHeight() const
Definition: eda_rect.h:118
Class EDA_RECT handles the component boundary box.
Definition: eda_rect.h:44
wxPoint Centre() const
Definition: eda_rect.h:60
bool IsEmpty() const
Definition: class_board.h:266

References EDA_RECT::Centre(), BOARD::GetBoardEdgesBoundingBox(), EDA_RECT::GetBottom(), EDA_RECT::GetHeight(), BOARD::GetPageSettings(), EDA_RECT::GetWidth(), BOARD::IsEmpty(), and m_board.

Referenced by addNewComponent().

◆ GetAddedComponents()

std::vector<MODULE*> BOARD_NETLIST_UPDATER::GetAddedComponents ( ) const
inline

Definition at line 126 of file board_netlist_updater.h.

127  {
128  return m_addedComponents;
129  }
std::vector< MODULE * > m_addedComponents

References m_addedComponents.

Referenced by PCB_EDIT_FRAME::OnNetlistChanged().

◆ getNetname()

wxString BOARD_NETLIST_UPDATER::getNetname ( D_PAD aPad)
private

Definition at line 84 of file board_netlist_updater.cpp.

85 {
86  if( m_isDryRun && m_padNets.count( aPad ) )
87  return m_padNets[ aPad ];
88  else
89  return aPad->GetNetname();
90 }
const wxString & GetNetname() const
Function GetNetname.
std::map< D_PAD *, wxString > m_padNets

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

Referenced by deleteSinglePadNets(), and updateCopperZoneNets().

◆ replaceComponent()

MODULE * BOARD_NETLIST_UPDATER::replaceComponent ( NETLIST aNetlist,
MODULE aPcbComponent,
COMPONENT aNewComponent 
)
private

Definition at line 172 of file board_netlist_updater.cpp.

174 {
175  wxString msg;
176 
177  if( aNewComponent->GetFPID().empty() )
178  {
179  msg.Printf( _( "Cannot update %s (no footprint assigned)." ),
180  aNewComponent->GetReference(),
181  aNewComponent->GetFPID().Format().wx_str() );
183  ++m_errorCount;
184  return nullptr;
185  }
186 
187  MODULE* newFootprint = m_frame->LoadFootprint( aNewComponent->GetFPID() );
188 
189  if( newFootprint == nullptr )
190  {
191  msg.Printf( _( "Cannot update %s (footprint \"%s\" not found)." ),
192  aNewComponent->GetReference(),
193  aNewComponent->GetFPID().Format().wx_str() );
195  ++m_errorCount;
196  return nullptr;
197  }
198 
199  msg.Printf( _( "Change %s footprint from \"%s\" to \"%s\"."),
200  aPcbComponent->GetReference(),
201  aPcbComponent->GetFPID().Format().wx_str(),
202  aNewComponent->GetFPID().Format().wx_str() );
204 
206 
207  if( !m_isDryRun )
208  {
209  m_frame->Exchange_Module( aPcbComponent, newFootprint, m_commit, true, true, true );
210  return newFootprint;
211  }
212  else
213  delete newFootprint;
214 
215  return nullptr;
216 }
const LIB_ID & GetFPID() const
Definition: class_module.h:197
bool empty() const
Definition: lib_id.h:186
const wxString GetReference() const
Function GetReference.
Definition: class_module.h:407
const LIB_ID & GetFPID() const
Definition: pcb_netlist.h:166
const wxString & GetReference() const
Definition: pcb_netlist.h:151
#define _(s)
UTF8 Format() const
Definition: lib_id.cpp:237
MODULE * LoadFootprint(const LIB_ID &aFootprintId)
Function LoadFootprint attempts to load aFootprintId from the footprint library table.
wxString wx_str() const
Definition: utf8.cpp:51
virtual REPORTER & Report(const wxString &aText, SEVERITY aSeverity=RPT_UNDEFINED)=0
Function Report is a pure virtual function to override in the derived object.
void Exchange_Module(MODULE *aSrc, MODULE *aDest, BOARD_COMMIT &aCommit, bool deleteExtraTexts=true, bool resetTextLayers=true, bool resetTextEffects=true)
Function Exchange_Module Replaces OldModule by NewModule, using OldModule settings: position,...

References _, LIB_ID::empty(), PCB_EDIT_FRAME::Exchange_Module(), LIB_ID::Format(), COMPONENT::GetFPID(), MODULE::GetFPID(), COMPONENT::GetReference(), MODULE::GetReference(), PCB_BASE_FRAME::LoadFootprint(), m_commit, m_errorCount, m_frame, m_isDryRun, m_newFootprintsCount, m_reporter, REPORTER::Report(), REPORTER::RPT_ACTION, REPORTER::RPT_ERROR, and UTF8::wx_str().

Referenced by UpdateNetlist().

◆ SetDeleteSinglePadNets()

void BOARD_NETLIST_UPDATER::SetDeleteSinglePadNets ( bool  aEnabled)
inline

Enables "delete single pad nets" option

Definition at line 97 of file board_netlist_updater.h.

98  {
99  m_deleteSinglePadNets = aEnabled;
100  }

References m_deleteSinglePadNets.

Referenced by PCB_EDIT_FRAME::DoUpdatePCBFromNetlist().

◆ SetDeleteUnusedComponents()

void BOARD_NETLIST_UPDATER::SetDeleteUnusedComponents ( bool  aEnabled)
inline

Enables removing unused components

Definition at line 115 of file board_netlist_updater.h.

116  {
117  m_deleteUnusedComponents = aEnabled;
118  }

References m_deleteUnusedComponents.

Referenced by PCB_EDIT_FRAME::DoUpdatePCBFromNetlist().

◆ SetIsDryRun()

void BOARD_NETLIST_UPDATER::SetIsDryRun ( bool  aEnabled)
inline

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

Definition at line 103 of file board_netlist_updater.h.

104  {
105  m_isDryRun = aEnabled;
106  }

References m_isDryRun.

◆ SetLookupByTimestamp()

void BOARD_NETLIST_UPDATER::SetLookupByTimestamp ( bool  aEnabled)
inline

Enables component lookup by timestamp instead of reference

Definition at line 121 of file board_netlist_updater.h.

122  {
123  m_lookupByTimestamp = aEnabled;
124  }

References m_lookupByTimestamp.

Referenced by PCB_EDIT_FRAME::DoUpdatePCBFromNetlist().

◆ SetReplaceFootprints()

void BOARD_NETLIST_UPDATER::SetReplaceFootprints ( bool  aEnabled)
inline

Enables replacing footprints with new ones

Definition at line 109 of file board_netlist_updater.h.

110  {
111  m_replaceFootprints = aEnabled;
112  }

References m_replaceFootprints.

Referenced by PCB_EDIT_FRAME::DoUpdatePCBFromNetlist().

◆ SetReporter()

void BOARD_NETLIST_UPDATER::SetReporter ( REPORTER aReporter)
inline

Sets the reporter object

Definition at line 91 of file board_netlist_updater.h.

92  {
93  m_reporter = aReporter;
94  }

References m_reporter.

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

◆ testConnectivity()

bool BOARD_NETLIST_UPDATER::testConnectivity ( NETLIST aNetlist)
private

Definition at line 645 of file board_netlist_updater.cpp.

646 {
647  // Verify that board contains all pads in netlist: if it doesn't then footprints are
648  // wrong or missing.
649  // Note that we use references to find the footprints as they're already updated by this
650  // point (whether by-reference or by-timestamp).
651 
652  wxString msg;
653  wxString padname;
654 
655  for( int i = 0; i < (int) aNetlist.GetCount(); i++ )
656  {
657  const COMPONENT* component = aNetlist.GetComponent( i );
658  MODULE* footprint = m_board->FindModuleByReference( component->GetReference() );
659 
660  if( footprint == NULL ) // It can be missing in partial designs
661  continue;
662 
663  // Explore all pins/pads in component
664  for( unsigned jj = 0; jj < component->GetNetCount(); jj++ )
665  {
666  const COMPONENT_NET& net = component->GetNet( jj );
667  padname = net.GetPinName();
668 
669  if( footprint->FindPadByName( padname ) )
670  continue; // OK, pad found
671 
672  // not found: bad footprint, report error
673  msg.Printf( _( "%s pad %s not found in %s." ),
674  component->GetReference(),
675  padname,
676  footprint->GetFPID().Format().wx_str() );
678  ++m_errorCount;
679  }
680  }
681 
682  return true;
683 }
unsigned GetCount() const
Function GetCount.
Definition: pcb_netlist.h:256
const LIB_ID & GetFPID() const
Definition: class_module.h:197
Class COMPONENT_NET is used to store the component pin name to net name associations stored in a netl...
Definition: pcb_netlist.h:48
D_PAD * FindPadByName(const wxString &aPadName) const
Function FindPadByName returns a D_PAD* with a matching name.
unsigned GetNetCount() const
Definition: pcb_netlist.h:137
const wxString & GetReference() const
Definition: pcb_netlist.h:151
const COMPONENT_NET & GetNet(unsigned aIndex) const
Definition: pcb_netlist.h:139
#define _(s)
UTF8 Format() const
Definition: lib_id.cpp:237
Class COMPONENT is used to store components and all of their related information found in a netlist.
Definition: pcb_netlist.h:83
COMPONENT * GetComponent(unsigned aIndex)
Function GetComponent returns the COMPONENT at aIndex.
Definition: pcb_netlist.h:265
size_t i
Definition: json11.cpp:597
wxString wx_str() const
Definition: utf8.cpp:51
MODULE * FindModuleByReference(const wxString &aReference) const
Function FindModuleByReference searches for a MODULE within this board with the given reference desig...
const wxString & GetPinName() const
Definition: pcb_netlist.h:61
virtual REPORTER & Report(const wxString &aText, SEVERITY aSeverity=RPT_UNDEFINED)=0
Function Report is a pure virtual function to override in the derived object.

References _, BOARD::FindModuleByReference(), MODULE::FindPadByName(), LIB_ID::Format(), NETLIST::GetComponent(), NETLIST::GetCount(), MODULE::GetFPID(), COMPONENT::GetNet(), COMPONENT::GetNetCount(), COMPONENT_NET::GetPinName(), COMPONENT::GetReference(), i, m_board, m_errorCount, m_reporter, REPORTER::Report(), REPORTER::RPT_ERROR, and UTF8::wx_str().

Referenced by UpdateNetlist().

◆ updateComponentPadConnections()

bool BOARD_NETLIST_UPDATER::updateComponentPadConnections ( MODULE aPcbComponent,
COMPONENT aNewComponent 
)
private

Definition at line 284 of file board_netlist_updater.cpp.

286 {
287  wxString msg;
288 
289  // Create a copy only if the module has not been added during this update
290  MODULE* copy = m_commit.GetStatus( aPcbComponent ) ? nullptr : (MODULE*) aPcbComponent->Clone();
291  bool changed = false;
292 
293  // At this point, the component footprint is updated. Now update the nets.
294  for( auto pad : aPcbComponent->Pads() )
295  {
296  COMPONENT_NET net = aNewComponent->GetNet( pad->GetName() );
297 
298  if( !net.IsValid() ) // New footprint pad has no net.
299  {
300  if( !pad->GetNetname().IsEmpty() )
301  {
302  msg.Printf( _( "Disconnect %s pin %s." ),
303  aPcbComponent->GetReference(),
304  pad->GetName() );
306  }
307 
308  if( !m_isDryRun )
309  {
310  changed = true;
311  pad->SetNetCode( NETINFO_LIST::UNCONNECTED );
312  }
313  else
314  cacheNetname( pad, wxEmptyString );
315  }
316  else // New footprint pad has a net.
317  {
318  const wxString& netName = net.GetNetName();
319  NETINFO_ITEM* netinfo = m_board->FindNet( netName );
320 
321  if( netinfo && !m_isDryRun )
322  netinfo->SetIsCurrent( true );
323 
324  if( pad->GetNetname() != netName )
325  {
326 
327  if( netinfo == nullptr )
328  {
329  // It might be a new net that has not been added to the board yet
330  if( m_addedNets.count( netName ) )
331  netinfo = m_addedNets[ netName ];
332  }
333 
334  if( netinfo == nullptr )
335  {
336  netinfo = new NETINFO_ITEM( m_board, netName );
337 
338  // It is a new net, we have to add it
339  if( !m_isDryRun )
340  {
341  changed = true;
342  m_commit.Add( netinfo );
343  }
344 
345  m_addedNets[netName] = netinfo;
346  msg.Printf( _( "Add net %s." ), UnescapeString( netName ) );
348  }
349 
350  if( !pad->GetNetname().IsEmpty() )
351  {
352  m_oldToNewNets[ pad->GetNetname() ] = netName;
353 
354  msg.Printf( _( "Reconnect %s pin %s from %s to %s."),
355  aPcbComponent->GetReference(),
356  pad->GetName(),
357  UnescapeString( pad->GetNetname() ),
358  UnescapeString( netName ) );
359  }
360  else
361  {
362  msg.Printf( _( "Connect %s pin %s to %s."),
363  aPcbComponent->GetReference(),
364  pad->GetName(),
365  UnescapeString( netName ) );
366  }
368 
369  if( !m_isDryRun )
370  {
371  changed = true;
372  pad->SetNet( netinfo );
373  }
374  else
375  cacheNetname( pad, netName );
376  }
377  }
378  }
379 
380  if( changed && copy )
381  m_commit.Modified( aPcbComponent, copy );
382  else
383  delete copy;
384 
385  return true;
386 }
NETINFO_ITEM * FindNet(int aNetcode) const
Function FindNet searches for a net with the given netcode.
void cacheNetname(D_PAD *aPad, const wxString &aNetname)
COMMIT & Add(EDA_ITEM *aItem)
Adds a new item to the model
Definition: commit.h:78
void SetIsCurrent(bool isCurrent)
Definition: netinfo.h:243
PADS & Pads()
Definition: class_module.h:163
int GetStatus(EDA_ITEM *aItem)
Returns status of an item.
Definition: commit.cpp:132
const wxString GetReference() const
Function GetReference.
Definition: class_module.h:407
std::map< wxString, NETINFO_ITEM * > m_addedNets
Class COMPONENT_NET is used to store the component pin name to net name associations stored in a netl...
Definition: pcb_netlist.h:48
const wxString & GetNetName() const
Definition: pcb_netlist.h:63
std::map< wxString, wxString > m_oldToNewNets
EDA_ITEM * Clone() const override
Function Clone creates a duplicate of this item with linked list members set to NULL.
const COMPONENT_NET & GetNet(unsigned aIndex) const
Definition: pcb_netlist.h:139
#define _(s)
bool IsValid() const
Definition: pcb_netlist.h:65
COMMIT & Modified(EDA_ITEM *aItem, EDA_ITEM *aCopy)
Creates an undo entry for an item that has been already modified.
Definition: commit.h:110
Class NETINFO_ITEM handles the data for a net.
Definition: netinfo.h:65
wxString UnescapeString(const wxString &aSource)
Definition: string.cpp:123
virtual REPORTER & Report(const wxString &aText, SEVERITY aSeverity=RPT_UNDEFINED)=0
Function Report is a pure virtual function to override in the derived object.
static const int UNCONNECTED
Constant that holds the "unconnected net" number (typically 0) all items "connected" to this net are ...
Definition: netinfo.h:463

References _, COMMIT::Add(), cacheNetname(), MODULE::Clone(), BOARD::FindNet(), COMPONENT::GetNet(), COMPONENT_NET::GetNetName(), MODULE::GetReference(), COMMIT::GetStatus(), COMPONENT_NET::IsValid(), m_addedNets, m_board, m_commit, m_isDryRun, m_oldToNewNets, m_reporter, COMMIT::Modified(), MODULE::Pads(), REPORTER::Report(), REPORTER::RPT_ACTION, NETINFO_ITEM::SetIsCurrent(), NETINFO_LIST::UNCONNECTED, and UnescapeString().

Referenced by UpdateNetlist().

◆ updateComponentParameters()

bool BOARD_NETLIST_UPDATER::updateComponentParameters ( MODULE aPcbComponent,
COMPONENT aNewComponent 
)
private

Definition at line 219 of file board_netlist_updater.cpp.

221 {
222  wxString msg;
223 
224  // Create a copy only if the module has not been added during this update
225  MODULE* copy = m_commit.GetStatus( aPcbComponent ) ? nullptr : (MODULE*) aPcbComponent->Clone();
226  bool changed = false;
227 
228  // Test for reference designator field change.
229  if( aPcbComponent->GetReference() != aNewComponent->GetReference() )
230  {
231  msg.Printf( _( "Change %s reference to %s." ),
232  aPcbComponent->GetReference(),
233  aNewComponent->GetReference() );
235 
236  if ( !m_isDryRun )
237  {
238  changed = true;
239  aPcbComponent->SetReference( aNewComponent->GetReference() );
240  }
241  }
242 
243  // Test for value field change.
244  if( aPcbComponent->GetValue() != aNewComponent->GetValue() )
245  {
246  msg.Printf( _( "Change %s value from %s to %s." ),
247  aPcbComponent->GetReference(),
248  aPcbComponent->GetValue(),
249  aNewComponent->GetValue() );
251 
252  if( !m_isDryRun )
253  {
254  changed = true;
255  aPcbComponent->SetValue( aNewComponent->GetValue() );
256  }
257  }
258 
259  // Test for time stamp change.
260  if( aPcbComponent->GetPath() != aNewComponent->GetTimeStamp() )
261  {
262  msg.Printf( _( "Change symbol path \"%s:%s\" to \"%s\"." ),
263  aPcbComponent->GetReference(),
264  aPcbComponent->GetPath(),
265  aNewComponent->GetTimeStamp() );
267 
268  if( !m_isDryRun )
269  {
270  changed = true;
271  aPcbComponent->SetPath( aNewComponent->GetTimeStamp() );
272  }
273  }
274 
275  if( changed && copy )
276  m_commit.Modified( aPcbComponent, copy );
277  else
278  delete copy;
279 
280  return true;
281 }
const wxString & GetPath() const
Definition: class_module.h:206
const wxString GetValue() const
Function GetValue.
Definition: class_module.h:432
int GetStatus(EDA_ITEM *aItem)
Returns status of an item.
Definition: commit.cpp:132
const wxString GetReference() const
Function GetReference.
Definition: class_module.h:407
const wxString & GetReference() const
Definition: pcb_netlist.h:151
void SetReference(const wxString &aReference)
Function SetReference.
Definition: class_module.h:417
EDA_ITEM * Clone() const override
Function Clone creates a duplicate of this item with linked list members set to NULL.
#define _(s)
COMMIT & Modified(EDA_ITEM *aItem, EDA_ITEM *aCopy)
Creates an undo entry for an item that has been already modified.
Definition: commit.h:110
void SetValue(const wxString &aValue)
Function SetValue.
Definition: class_module.h:441
virtual REPORTER & Report(const wxString &aText, SEVERITY aSeverity=RPT_UNDEFINED)=0
Function Report is a pure virtual function to override in the derived object.
const wxString & GetValue() const
Definition: pcb_netlist.h:153
void SetPath(const wxString &aPath)
Definition: class_module.h:207
const wxString & GetTimeStamp() const
Definition: pcb_netlist.h:170

References _, MODULE::Clone(), MODULE::GetPath(), COMPONENT::GetReference(), MODULE::GetReference(), COMMIT::GetStatus(), COMPONENT::GetTimeStamp(), COMPONENT::GetValue(), MODULE::GetValue(), m_commit, m_isDryRun, m_reporter, COMMIT::Modified(), REPORTER::Report(), REPORTER::RPT_ACTION, REPORTER::RPT_INFO, MODULE::SetPath(), MODULE::SetReference(), and MODULE::SetValue().

Referenced by UpdateNetlist().

◆ updateCopperZoneNets()

bool BOARD_NETLIST_UPDATER::updateCopperZoneNets ( NETLIST aNetlist)
private

Definition at line 403 of file board_netlist_updater.cpp.

404 {
405  wxString msg;
406  std::set<wxString> netlistNetnames;
407 
408  for( int ii = 0; ii < (int) aNetlist.GetCount(); ii++ )
409  {
410  const COMPONENT* component = aNetlist.GetComponent( ii );
411  for( unsigned jj = 0; jj < component->GetNetCount(); jj++ )
412  {
413  const COMPONENT_NET& net = component->GetNet( jj );
414  netlistNetnames.insert( net.GetNetName() );
415  }
416  }
417 
418  for( auto via : m_board->Tracks() )
419  {
420  if( via->Type() != PCB_VIA_T )
421  continue;
422 
423  if( netlistNetnames.count( via->GetNetname() ) == 0 )
424  {
425  wxString updatedNetname = wxEmptyString;
426 
427  // Take via name from name change map if it didn't match to a new pad
428  // (this is useful for stitching vias that don't connect to tracks)
429  if( m_oldToNewNets.count( via->GetNetname() ) )
430  {
431  updatedNetname = m_oldToNewNets[via->GetNetname()];
432  }
433 
434  if( !updatedNetname.IsEmpty() )
435  {
436  msg.Printf( _( "Reconnect via from %s to %s." ),
437  UnescapeString( via->GetNetname() ), UnescapeString( updatedNetname ) );
439 
440  if( !m_isDryRun )
441  {
442  NETINFO_ITEM* netinfo = m_board->FindNet( updatedNetname );
443 
444  if( !netinfo )
445  netinfo = m_addedNets[updatedNetname];
446 
447  if( netinfo )
448  {
449  m_commit.Modify( via );
450  via->SetNet( netinfo );
451  }
452  }
453  }
454  else
455  {
456  msg.Printf( _( "Via connected to unknown net (%s)." ),
457  UnescapeString( via->GetNetname() ) );
459  ++m_warningCount;
460  }
461  }
462  }
463 
464  // Test copper zones to detect "dead" nets (nets without any pad):
465  for( int i = 0; i < m_board->GetAreaCount(); i++ )
466  {
467  ZONE_CONTAINER* zone = m_board->GetArea( i );
468 
469  if( !zone->IsOnCopperLayer() || zone->GetIsKeepout() )
470  continue;
471 
472  if( netlistNetnames.count( zone->GetNetname() ) == 0 )
473  {
474  // Look for a pad in the zone's connected-pad-cache which has been updated to
475  // a new net and use that. While this won't always be the right net, the dead
476  // net is guaranteed to be wrong.
477  wxString updatedNetname = wxEmptyString;
478 
479  for( D_PAD* pad : m_zoneConnectionsCache[ zone ] )
480  {
481  if( getNetname( pad ) != zone->GetNetname() )
482  {
483  updatedNetname = getNetname( pad );
484  break;
485  }
486  }
487 
488  // Take zone name from name change map if it didn't match to a new pad
489  // (this is useful for zones on internal layers)
490  if( updatedNetname.IsEmpty() && m_oldToNewNets.count( zone->GetNetname() ) )
491  {
492  updatedNetname = m_oldToNewNets[ zone->GetNetname() ];
493  }
494 
495  if( !updatedNetname.IsEmpty() )
496  {
497  msg.Printf( _( "Reconnect copper zone from %s to %s." ),
498  UnescapeString( zone->GetNetname() ),
499  UnescapeString( updatedNetname ) );
501 
502  if( !m_isDryRun )
503  {
504  NETINFO_ITEM* netinfo = m_board->FindNet( updatedNetname );
505 
506  if( !netinfo )
507  netinfo = m_addedNets[ updatedNetname ];
508 
509  if( netinfo )
510  {
511  m_commit.Modify( zone );
512  zone->SetNet( netinfo );
513  }
514  }
515  }
516  else
517  {
518  msg.Printf( _( "Copper zone (%s) has no pads connected." ),
519  UnescapeString( zone->GetNetname() ) );
521  ++m_warningCount;
522  }
523  }
524  }
525 
526  return true;
527 }
NETINFO_ITEM * FindNet(int aNetcode) const
Function FindNet searches for a net with the given netcode.
Class ZONE_CONTAINER handles a list of polygons defining a copper zone.
Definition: class_zone.h:57
COMMIT & Modify(EDA_ITEM *aItem)
Modifies a given item in the model.
Definition: commit.h:103
std::map< ZONE_CONTAINER *, std::vector< D_PAD * > > m_zoneConnectionsCache
unsigned GetCount() const
Function GetCount.
Definition: pcb_netlist.h:256
std::map< wxString, NETINFO_ITEM * > m_addedNets
Class COMPONENT_NET is used to store the component pin name to net name associations stored in a netl...
Definition: pcb_netlist.h:48
const wxString & GetNetName() const
Definition: pcb_netlist.h:63
int GetAreaCount() const
Function GetAreaCount.
Definition: class_board.h:955
wxString getNetname(D_PAD *aPad)
unsigned GetNetCount() const
Definition: pcb_netlist.h:137
std::map< wxString, wxString > m_oldToNewNets
const wxString & GetNetname() const
Function GetNetname.
const COMPONENT_NET & GetNet(unsigned aIndex) const
Definition: pcb_netlist.h:139
#define _(s)
bool GetIsKeepout() const
Accessors to parameters used in Keepout zones:
Definition: class_zone.h:621
Class COMPONENT is used to store components and all of their related information found in a netlist.
Definition: pcb_netlist.h:83
COMPONENT * GetComponent(unsigned aIndex)
Function GetComponent returns the COMPONENT at aIndex.
Definition: pcb_netlist.h:265
Class NETINFO_ITEM handles the data for a net.
Definition: netinfo.h:65
wxString UnescapeString(const wxString &aSource)
Definition: string.cpp:123
size_t i
Definition: json11.cpp:597
virtual REPORTER & Report(const wxString &aText, SEVERITY aSeverity=RPT_UNDEFINED)=0
Function Report is a pure virtual function to override in the derived object.
class VIA, a via (like a track segment on a copper layer)
Definition: typeinfo.h:96
ZONE_CONTAINER * GetArea(int index) const
Function GetArea returns the Area (Zone Container) at a given index.
Definition: class_board.h:926
bool IsOnCopperLayer() const
Function IsOnCopperLayer.
Definition: class_zone.cpp:184
TRACKS & Tracks()
Definition: class_board.h:227

References _, BOARD::FindNet(), BOARD::GetArea(), BOARD::GetAreaCount(), NETLIST::GetComponent(), NETLIST::GetCount(), ZONE_CONTAINER::GetIsKeepout(), COMPONENT::GetNet(), COMPONENT::GetNetCount(), COMPONENT_NET::GetNetName(), BOARD_CONNECTED_ITEM::GetNetname(), getNetname(), i, ZONE_CONTAINER::IsOnCopperLayer(), m_addedNets, m_board, m_commit, m_isDryRun, m_oldToNewNets, m_reporter, m_warningCount, m_zoneConnectionsCache, COMMIT::Modify(), PCB_VIA_T, REPORTER::Report(), REPORTER::RPT_ACTION, REPORTER::RPT_WARNING, BOARD::Tracks(), and UnescapeString().

Referenced by UpdateNetlist().

◆ UpdateNetlist() [1/2]

bool BOARD_NETLIST_UPDATER::UpdateNetlist ( NETLIST aNetlist)

Function UpdateNetlist()

Updates 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 686 of file board_netlist_updater.cpp.

687 {
688  wxString msg;
689  m_errorCount = 0;
690  m_warningCount = 0;
692  MODULE* lastPreexistingFootprint = m_board->Modules().empty() ? NULL : m_board->Modules().back();
693 
695 
696  if( !m_isDryRun )
697  {
698  m_board->SetStatus( 0 );
699 
700  // Mark all nets (except <no net>) as stale; we'll update those to current that
701  // we find in the netlist
702  for( NETINFO_ITEM* net : m_board->GetNetInfo() )
703  net->SetIsCurrent( net->GetNet() == 0 );
704  }
705 
706  for( unsigned i = 0; i < aNetlist.GetCount(); i++ )
707  {
708  COMPONENT* component = aNetlist.GetComponent( i );
709  int matchCount = 0;
710  MODULE* tmp;
711 
712  msg.Printf( _( "Processing component \"%s:%s:%s\"." ),
713  component->GetReference(),
714  component->GetTimeStamp(),
715  component->GetFPID().Format().wx_str() );
717 
718  for( auto footprint : m_board->Modules() )
719  {
720  bool match = false;
721 
722  if( footprint )
723  {
724  if( m_lookupByTimestamp )
725  match = footprint->GetPath() == component->GetTimeStamp();
726  else
727  match = footprint->GetReference().CmpNoCase( component->GetReference() ) == 0;
728  }
729 
730  if( match )
731  {
732  tmp = footprint;
733 
734  if( m_replaceFootprints && component->GetFPID() != footprint->GetFPID() )
735  tmp = replaceComponent( aNetlist, footprint, component );
736 
737  if( tmp )
738  {
739  updateComponentParameters( tmp, component );
740  updateComponentPadConnections( tmp, component );
741  }
742 
743  matchCount++;
744  }
745 
746  if( footprint == lastPreexistingFootprint )
747  {
748  // No sense going through the newly-created footprints: end of loop
749  break;
750  }
751  }
752 
753  if( matchCount == 0 )
754  {
755  tmp = addNewComponent( component );
756 
757  if( tmp )
758  {
759  updateComponentParameters( tmp, component );
760  updateComponentPadConnections( tmp, component );
761  }
762  }
763  else if( matchCount > 1 )
764  {
765  msg.Printf( _( "Multiple footprints found for \"%s\"." ),
766  component->GetReference() );
768  }
769  }
770 
771  updateCopperZoneNets( aNetlist );
772 
774  deleteUnusedComponents( aNetlist );
775 
776  if( !m_isDryRun )
777  {
778  m_commit.Push( _( "Update netlist" ) );
779  m_board->GetConnectivity()->Build( m_board );
780  testConnectivity( aNetlist );
781 
782  // Now the connectivity data is rebuilt, we can delete single pads nets
785  }
787  // We can delete single net pads in dry run mode only if no new footprints
788  // are added, because these new footprints are not actually added to the board
789  // and the current pad list is wrong in this case.
791 
792  if( m_isDryRun )
793  {
794  for( auto it : m_addedNets )
795  delete it.second;
796 
797  m_addedNets.clear();
798  }
799 
800  // Update the ratsnest
803 
804  msg.Printf( _( "Total warnings: %d, errors: %d." ), m_warningCount, m_errorCount );
806 
807  if( m_errorCount )
808  {
809  m_reporter->ReportTail( _( "Errors occurred during the netlist update. Unless you fix them "
810  "your board will not be consistent with the schematics." ),
812  return false;
813  }
814 
815  m_reporter->ReportTail( _( "Netlist update successful!" ), REPORTER::RPT_ACTION );
816  return true;
817 }
MODULE * replaceComponent(NETLIST &aNetlist, MODULE *aPcbComponent, COMPONENT *aNewComponent)
unsigned GetCount() const
Function GetCount.
Definition: pcb_netlist.h:256
bool updateComponentPadConnections(MODULE *aPcbComponent, COMPONENT *aNewComponent)
bool updateCopperZoneNets(NETLIST &aNetlist)
bool testConnectivity(NETLIST &aNetlist)
std::map< wxString, NETINFO_ITEM * > m_addedNets
const LIB_ID & GetFPID() const
Definition: pcb_netlist.h:166
MODULES & Modules()
Definition: class_board.h:236
virtual REPORTER & ReportTail(const wxString &aText, SEVERITY aSeverity=RPT_UNDEFINED)
Function ReportTail Places the report at the end of the list, for objects that support report orderin...
Definition: reporter.h:111
const wxString & GetReference() const
Definition: pcb_netlist.h:151
std::shared_ptr< CONNECTIVITY_DATA > GetConnectivity() const
Function GetConnectivity() returns list of missing connections between components/tracks.
Definition: class_board.h:310
NETINFO_LIST & GetNetInfo()
Definition: class_board.h:750
#define _(s)
UTF8 Format() const
Definition: lib_id.cpp:237
Class COMPONENT is used to store components and all of their related information found in a netlist.
Definition: pcb_netlist.h:83
COMPONENT * GetComponent(unsigned aIndex)
Function GetComponent returns the COMPONENT at aIndex.
Definition: pcb_netlist.h:265
Class NETINFO_ITEM handles the data for a net.
Definition: netinfo.h:65
bool updateComponentParameters(MODULE *aPcbComponent, COMPONENT *aNewComponent)
size_t i
Definition: json11.cpp:597
wxString wx_str() const
Definition: utf8.cpp:51
virtual void Push(const wxString &aMessage=wxT("A commit"), bool aCreateUndoEntry=true, bool aSetDirtyBit=true) override
Executes the changes.
void SetStatus(STATUS_FLAGS aStatus)
Definition: base_struct.h:250
virtual REPORTER & Report(const wxString &aText, SEVERITY aSeverity=RPT_UNDEFINED)=0
Function Report is a pure virtual function to override in the derived object.
bool deleteUnusedComponents(NETLIST &aNetlist)
const wxString & GetTimeStamp() const
Definition: pcb_netlist.h:170
MODULE * addNewComponent(COMPONENT *aComponent)

References _, addNewComponent(), cacheCopperZoneConnections(), deleteSinglePadNets(), deleteUnusedComponents(), LIB_ID::Format(), NETLIST::GetComponent(), BOARD::GetConnectivity(), NETLIST::GetCount(), COMPONENT::GetFPID(), BOARD::GetNetInfo(), COMPONENT::GetReference(), COMPONENT::GetTimeStamp(), i, m_addedNets, m_board, m_commit, m_deleteSinglePadNets, m_deleteUnusedComponents, m_errorCount, m_isDryRun, m_lookupByTimestamp, m_newFootprintsCount, m_replaceFootprints, m_reporter, m_warningCount, BOARD::Modules(), BOARD_COMMIT::Push(), replaceComponent(), REPORTER::Report(), REPORTER::ReportTail(), REPORTER::RPT_ACTION, REPORTER::RPT_ERROR, REPORTER::RPT_INFO, EDA_ITEM::SetStatus(), testConnectivity(), updateComponentPadConnections(), updateComponentParameters(), updateCopperZoneNets(), and UTF8::wx_str().

Referenced by PCB_EDIT_FRAME::DoUpdatePCBFromNetlist().

◆ UpdateNetlist() [2/2]

bool BOARD_NETLIST_UPDATER::UpdateNetlist ( const wxString &  aNetlistFileName,
const wxString &  aCmpFileName 
)

Definition at line 820 of file board_netlist_updater.cpp.

822 {
823  return false;
824 }

Member Data Documentation

◆ m_addedComponents

std::vector<MODULE*> BOARD_NETLIST_UPDATER::m_addedComponents
private

Definition at line 154 of file board_netlist_updater.h.

Referenced by addNewComponent(), and GetAddedComponents().

◆ m_addedNets

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

◆ m_board

◆ m_commit

◆ m_deleteSinglePadNets

bool BOARD_NETLIST_UPDATER::m_deleteSinglePadNets
private

◆ m_deleteUnusedComponents

bool BOARD_NETLIST_UPDATER::m_deleteUnusedComponents
private

◆ m_errorCount

int BOARD_NETLIST_UPDATER::m_errorCount
private

◆ m_frame

PCB_EDIT_FRAME* BOARD_NETLIST_UPDATER::m_frame
private

Definition at line 146 of file board_netlist_updater.h.

Referenced by addNewComponent(), and replaceComponent().

◆ 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 152 of file board_netlist_updater.h.

Referenced by updateComponentPadConnections(), and updateCopperZoneNets().

◆ m_padNets

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

Definition at line 153 of file board_netlist_updater.h.

Referenced by cacheNetname(), and getNetname().

◆ 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_CONTAINER*, std::vector<D_PAD*> > BOARD_NETLIST_UPDATER::m_zoneConnectionsCache
private

Definition at line 151 of file board_netlist_updater.h.

Referenced by cacheCopperZoneConnections(), and updateCopperZoneNets().


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