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

BOARD_COMMIT m_commit
 
BOARDm_board
 
REPORTERm_reporter
 
std::map< ZONE_CONTAINER *, std::vector< D_PAD * > > m_zoneConnectionsCache
 
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
 

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 ( PCB_EDIT_FRAME aFrame,
BOARD aBoard 
)

Definition at line 52 of file board_netlist_updater.cpp.

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

BOARD_NETLIST_UPDATER::~BOARD_NETLIST_UPDATER ( )

Definition at line 69 of file board_netlist_updater.cpp.

70 {
71 }

Member Function Documentation

MODULE * BOARD_NETLIST_UPDATER::addNewComponent ( COMPONENT aComponent)
private

Definition at line 119 of file board_netlist_updater.cpp.

References COMMIT::Add(), estimateComponentInsertionPosition(), LIB_ID::Format(), GetChars(), COMPONENT::GetFPID(), COMPONENT::GetModule(), GetNewTimeStamp(), COMPONENT::GetReference(), COMPONENT::GetTimeStamp(), m_addedComponents, m_board, m_commit, m_errorCount, m_isDryRun, m_reporter, REPORTER::Report(), REPORTER::RPT_ACTION, REPORTER::RPT_ERROR, REPORTER::RPT_INFO, EDA_ITEM::SetParent(), MODULE::SetPosition(), and EDA_ITEM::SetTimeStamp().

Referenced by GetAddedComponents(), and UpdateNetlist().

120 {
121  wxString msg;
122 
123  if( aComponent->GetModule() != NULL )
124  {
125  msg.Printf( _( "Add symbol %s, footprint: %s." ),
126  GetChars( aComponent->GetReference() ),
127  GetChars( aComponent->GetFPID().Format() ) );
129 
130  msg.Printf( _( "Adding new symbol \"%s:%s\" footprint \"%s\"." ),
131  GetChars( aComponent->GetReference() ),
132  GetChars( aComponent->GetTimeStamp() ),
133  GetChars( aComponent->GetFPID().Format() ) );
135 
136 
137  if( !m_isDryRun )
138  {
139  // Owned by NETLIST, can only copy it.
140  MODULE* footprint = new MODULE( *aComponent->GetModule() );
141  footprint->SetParent( m_board );
143  footprint->SetTimeStamp( GetNewTimeStamp() );
144 
145  m_addedComponents.push_back( footprint );
146  m_commit.Add( footprint );
147 
148  return footprint;
149  }
150  }
151  else
152  {
153  msg.Printf( _( "Cannot add symbol %s due to missing footprint %s." ),
154  GetChars( aComponent->GetReference() ),
155  GetChars( aComponent->GetFPID().Format() ) );
157 
158  msg.Printf( _( "Cannot add new symbol \"%s:%s\" due to missing footprint \"%s\"." ),
159  GetChars( aComponent->GetReference() ),
160  GetChars( aComponent->GetTimeStamp() ),
161  GetChars( aComponent->GetFPID().Format() ) );
163  ++m_errorCount;
164  }
165 
166  return NULL;
167 }
const LIB_ID & GetFPID() const
Definition: pcb_netlist.h:166
COMMIT & Add(EDA_ITEM *aItem)
Adds a new item to the model
Definition: commit.h:78
MODULE * GetModule(bool aRelease=false)
Definition: pcb_netlist.h:186
const wxString & GetReference() const
Definition: pcb_netlist.h:151
timestamp_t GetNewTimeStamp()
Definition: common.cpp:159
void SetParent(EDA_ITEM *aParent)
Definition: base_struct.h:213
const wxString & GetTimeStamp() const
Definition: pcb_netlist.h:170
void SetPosition(const wxPoint &aPos) override
static const wxChar * GetChars(const wxString &s)
Function GetChars returns a wxChar* to the actual wxChar* data within a wxString, and is helpful for ...
Definition: macros.h:92
virtual REPORTER & Report(const wxString &aText, SEVERITY aSeverity=RPT_UNDEFINED)=0
Function Report is a pure virtual function to override in the derived object.
UTF8 Format() const
Definition: lib_id.cpp:237
std::vector< MODULE * > m_addedComponents
void SetTimeStamp(timestamp_t aNewTimeStamp)
Definition: base_struct.h:203
void BOARD_NETLIST_UPDATER::cacheCopperZoneConnections ( )
private

Definition at line 426 of file board_netlist_updater.cpp.

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

Referenced by GetAddedComponents(), and UpdateNetlist().

427 {
428  for( int ii = 0; ii < m_board->GetAreaCount(); ii++ )
429  {
430  ZONE_CONTAINER* zone = m_board->GetArea( ii );
431 
432  if( !zone->IsOnCopperLayer() || zone->GetIsKeepout() )
433  continue;
434 
435  m_zoneConnectionsCache[ zone ] = m_board->GetConnectivity()->GetConnectedPads( zone );
436  }
437 }
Class ZONE_CONTAINER handles a list of polygons defining a copper zone.
Definition: class_zone.h:60
std::map< ZONE_CONTAINER *, std::vector< D_PAD * > > m_zoneConnectionsCache
bool GetIsKeepout() const
Accessors to parameters used in Keepout zones:
Definition: class_zone.h:602
int GetAreaCount() const
Function GetAreaCount.
Definition: class_board.h:1017
bool IsOnCopperLayer() const
Function IsOnCopperLayer.
Definition: class_zone.cpp:181
ZONE_CONTAINER * GetArea(int index) const
Function GetArea returns the Area (Zone Container) at a given index.
Definition: class_board.h:988
std::shared_ptr< CONNECTIVITY_DATA > GetConnectivity() const
Function GetConnectivity() returns list of missing connections between components/tracks.
Definition: class_board.h:295
void BOARD_NETLIST_UPDATER::cacheNetname ( D_PAD aPad,
const wxString &  aNetname 
)
private

Definition at line 77 of file board_netlist_updater.cpp.

References m_padNets.

Referenced by deleteSinglePadNets(), GetAddedComponents(), and updateComponentPadConnections().

78 {
79  m_padNets[ aPad ] = aNetname;
80 }
std::map< D_PAD *, wxString > m_padNets
bool BOARD_NETLIST_UPDATER::deleteSinglePadNets ( )
private

Definition at line 560 of file board_netlist_updater.cpp.

References BOARD::BuildListOfNets(), cacheNetname(), BOARD::GetArea(), BOARD::GetAreaCount(), GetChars(), ZONE_CONTAINER::GetIsKeepout(), D_PAD::GetName(), BOARD_CONNECTED_ITEM::GetNetname(), getNetname(), BOARD::GetPads(), D_PAD::GetParent(), MODULE::GetReference(), ZONE_CONTAINER::IsOnCopperLayer(), m_board, m_isDryRun, m_reporter, REPORTER::Report(), REPORTER::RPT_ACTION, REPORTER::RPT_INFO, BOARD_CONNECTED_ITEM::SetNetCode(), and NETINFO_LIST::UNCONNECTED.

Referenced by GetAddedComponents(), and UpdateNetlist().

561 {
562  int count = 0;
563  wxString netname;
564  wxString msg;
565  D_PAD* pad = NULL;
566  D_PAD* previouspad = NULL;
567 
568  // We need the pad list for next tests.
569 
571 
572  std::vector<D_PAD*> padlist = m_board->GetPads();
573 
574  // Sort pads by netlist name
575  std::sort( padlist.begin(), padlist.end(),
576  [ this ]( D_PAD* a, D_PAD* b ) -> bool { return getNetname( a ) < getNetname( b ); } );
577 
578  for( unsigned kk = 0; kk < padlist.size(); kk++ )
579  {
580  pad = padlist[kk];
581 
582  if( getNetname( pad ).IsEmpty() )
583  continue;
584 
585  if( netname != getNetname( pad ) ) // End of net
586  {
587  if( previouspad && count == 1 )
588  {
589  // First, see if we have a copper zone attached to this pad.
590  // If so, this is not really a single pad net
591 
592  for( int ii = 0; ii < m_board->GetAreaCount(); ii++ )
593  {
594  ZONE_CONTAINER* zone = m_board->GetArea( ii );
595 
596  if( !zone->IsOnCopperLayer() )
597  continue;
598 
599  if( zone->GetIsKeepout() )
600  continue;
601 
602  if( zone->GetNetname() == getNetname( previouspad ) )
603  {
604  count++;
605  break;
606  }
607  }
608 
609  if( count == 1 ) // Really one pad, and nothing else
610  {
611  msg.Printf( _( "Remove single pad net %s." ),
612  GetChars( getNetname( previouspad ) ) );
614 
615  msg.Printf( _( "Remove single pad net \"%s\" on \"%s\" pad \"%s\"." ),
616  GetChars( getNetname( previouspad ) ),
617  GetChars( previouspad->GetParent()->GetReference() ),
618  GetChars( previouspad->GetName() ) );
620 
621  if( !m_isDryRun )
622  previouspad->SetNetCode( NETINFO_LIST::UNCONNECTED );
623  else
624  cacheNetname( previouspad, wxEmptyString );
625  }
626  }
627 
628  netname = getNetname( pad );
629  count = 1;
630  }
631  else
632  {
633  count++;
634  }
635 
636  previouspad = pad;
637  }
638 
639  // Examine last pad
640  if( pad && count == 1 )
641  {
642  if( !m_isDryRun )
644  else
645  cacheNetname( pad, wxEmptyString );
646  }
647 
648  return true;
649 }
void BuildListOfNets()
Definition: class_board.h:728
Class ZONE_CONTAINER handles a list of polygons defining a copper zone.
Definition: class_zone.h:60
void cacheNetname(D_PAD *aPad, const wxString &aNetname)
MODULE * GetParent() const
Definition: class_pad.h:162
bool GetIsKeepout() const
Accessors to parameters used in Keepout zones:
Definition: class_zone.h:602
wxString getNetname(D_PAD *aPad)
bool SetNetCode(int aNetCode, bool aNoAssert=false)
Function SetNetCode sets net using a net code.
const wxString & GetName() const
Definition: class_pad.h:190
int GetAreaCount() const
Function GetAreaCount.
Definition: class_board.h:1017
const std::vector< D_PAD * > GetPads()
Function GetPads returns a reference to a list of all the pads.
bool IsOnCopperLayer() const
Function IsOnCopperLayer.
Definition: class_zone.cpp:181
static const wxChar * GetChars(const wxString &s)
Function GetChars returns a wxChar* to the actual wxChar* data within a wxString, and is helpful for ...
Definition: macros.h:92
const wxString & GetNetname() const
Function GetNetname.
ZONE_CONTAINER * GetArea(int index) const
Function GetArea returns the Area (Zone Container) at a given index.
Definition: class_board.h:988
const wxString & GetReference() const
Function GetReference.
Definition: class_module.h:460
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:461
bool BOARD_NETLIST_UPDATER::deleteUnusedComponents ( NETLIST aNetlist)
private

Definition at line 517 of file board_netlist_updater.cpp.

References GetChars(), NETLIST::GetComponentByReference(), NETLIST::GetComponentByTimeStamp(), m_board, m_commit, m_isDryRun, m_lookupByTimestamp, BOARD::m_Modules, m_reporter, MODULE::Next(), COMMIT::Remove(), REPORTER::Report(), REPORTER::RPT_ACTION, REPORTER::RPT_INFO, and REPORTER::RPT_WARNING.

Referenced by GetAddedComponents(), and UpdateNetlist().

518 {
519  wxString msg;
520  MODULE* nextModule;
521  const COMPONENT* component;
522 
523  for( MODULE* module = m_board->m_Modules; module != NULL; module = nextModule )
524  {
525  nextModule = module->Next();
526 
527  if( m_lookupByTimestamp )
528  component = aNetlist.GetComponentByTimeStamp( module->GetPath() );
529  else
530  component = aNetlist.GetComponentByReference( module->GetReference() );
531 
532  if( component == NULL )
533  {
534  if( module->IsLocked() )
535  {
536  msg.Printf( _( "Footprint %s is locked, skipping removal." ),
537  GetChars( module->GetReference() ) );
539  continue;
540  }
541 
542  msg.Printf( _( "Remove unused footprint %s." ),
543  GetChars( module->GetReference() ) );
545 
546  msg.Printf( _( "Removing unused footprint \"%s:%s\"." ),
547  GetChars( module->GetReference() ),
548  GetChars( module->GetPath() ) );
550 
551  if( !m_isDryRun )
552  m_commit.Remove( module );
553  }
554  }
555 
556  return true;
557 }
MODULE * Next() const
Definition: class_module.h:123
COMMIT & Remove(EDA_ITEM *aItem)
Removes a new item from the model
Definition: commit.h:90
Class COMPONENT is used to store components and all of their related information found in a netlist...
Definition: pcb_netlist.h:83
static const wxChar * GetChars(const wxString &s)
Function GetChars returns a wxChar* to the actual wxChar* data within a wxString, and is helpful for ...
Definition: macros.h:92
DLIST< MODULE > m_Modules
Definition: class_board.h:247
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.
wxPoint BOARD_NETLIST_UPDATER::estimateComponentInsertionPosition ( )
private

Definition at line 91 of file board_netlist_updater.cpp.

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

Referenced by addNewComponent(), and GetAddedComponents().

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

Definition at line 82 of file board_netlist_updater.cpp.

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

Referenced by deleteSinglePadNets(), GetAddedComponents(), and updateCopperZoneNets().

83 {
84  if( m_isDryRun && m_padNets.count( aPad ) )
85  return m_padNets[ aPad ];
86  else
87  return aPad->GetNetname();
88 }
std::map< D_PAD *, wxString > m_padNets
const wxString & GetNetname() const
Function GetNetname.
MODULE * BOARD_NETLIST_UPDATER::replaceComponent ( NETLIST aNetlist,
MODULE aPcbComponent,
COMPONENT aNewComponent 
)
private

Definition at line 170 of file board_netlist_updater.cpp.

References COMMIT::Add(), MODULE::CopyNetlistSettings(), LIB_ID::empty(), LIB_ID::Format(), GetChars(), COMPONENT::GetFPID(), MODULE::GetFPID(), COMPONENT::GetModule(), MODULE::GetPath(), MODULE::GetReference(), NETLIST::IsFindByTimeStamp(), m_board, m_commit, m_errorCount, m_isDryRun, m_replaceFootprints, m_reporter, COMMIT::Remove(), REPORTER::Report(), REPORTER::RPT_ACTION, REPORTER::RPT_ERROR, REPORTER::RPT_INFO, EDA_ITEM::SetParent(), MODULE::SetPath(), and MODULE::SetReference().

Referenced by GetAddedComponents(), and UpdateNetlist().

171 {
172  wxString msg;
173 
174  if( !m_replaceFootprints )
175  return NULL;
176 
177  // Test if the footprint has not changed
178  if( aNewComponent->GetFPID().empty() || aPcbComponent->GetFPID() == aNewComponent->GetFPID() )
179  return NULL;
180 
181  if( aNewComponent->GetModule() != NULL )
182  {
183  msg.Printf( _( "Change symbol %s footprint from %s to %s."),
184  GetChars( aPcbComponent->GetReference() ),
185  GetChars( aPcbComponent->GetFPID().Format() ),
186  GetChars( aNewComponent->GetFPID().Format() ) );
188 
189  msg.Printf( _( "Replacing symbol \"%s:%s\" footprint \"%s\" with \"%s\"." ),
190  GetChars( aPcbComponent->GetReference() ),
191  GetChars( aPcbComponent->GetPath() ),
192  GetChars( aPcbComponent->GetFPID().Format() ),
193  GetChars( aNewComponent->GetFPID().Format() ) );
195 
196  if( !m_isDryRun )
197  {
198  wxASSERT( aPcbComponent != NULL );
199 
200  MODULE* newFootprint = new MODULE( *aNewComponent->GetModule() );
201  newFootprint->SetParent( m_board );
202 
203  if( aNetlist.IsFindByTimeStamp() )
204  newFootprint->SetReference( aPcbComponent->GetReference() );
205  else
206  newFootprint->SetPath( aPcbComponent->GetPath() );
207 
208  aPcbComponent->CopyNetlistSettings( newFootprint, false );
209  m_commit.Remove( aPcbComponent );
210  m_commit.Add( newFootprint );
211 
212  return newFootprint;
213  }
214  }
215  else
216  {
217  msg.Printf( _( "Cannot change symbol %s footprint due to missing footprint %s." ),
218  GetChars( aPcbComponent->GetReference() ),
219  GetChars( aNewComponent->GetFPID().Format() ) );
221 
222  msg.Printf( _( "Cannot replace symbol \"%s:%s\" due to missing footprint \"%s\"." ),
223  GetChars( aPcbComponent->GetReference() ),
224  GetChars( aPcbComponent->GetPath() ),
225  GetChars( aNewComponent->GetFPID().Format() ) );
227 
228  ++m_errorCount;
229  }
230 
231  return NULL;
232 }
bool empty() const
Definition: lib_id.h:186
const LIB_ID & GetFPID() const
Definition: pcb_netlist.h:166
COMMIT & Add(EDA_ITEM *aItem)
Adds a new item to the model
Definition: commit.h:78
MODULE * GetModule(bool aRelease=false)
Definition: pcb_netlist.h:186
const LIB_ID & GetFPID() const
Definition: class_module.h:193
void SetParent(EDA_ITEM *aParent)
Definition: base_struct.h:213
bool IsFindByTimeStamp() const
Definition: pcb_netlist.h:313
void SetReference(const wxString &aReference)
Function SetReference.
Definition: class_module.h:470
COMMIT & Remove(EDA_ITEM *aItem)
Removes a new item from the model
Definition: commit.h:90
static const wxChar * GetChars(const wxString &s)
Function GetChars returns a wxChar* to the actual wxChar* data within a wxString, and is helpful for ...
Definition: macros.h:92
const wxString & GetReference() const
Function GetReference.
Definition: class_module.h:460
virtual REPORTER & Report(const wxString &aText, SEVERITY aSeverity=RPT_UNDEFINED)=0
Function Report is a pure virtual function to override in the derived object.
UTF8 Format() const
Definition: lib_id.cpp:237
void CopyNetlistSettings(MODULE *aModule, bool aCopyLocalSettings)
Function CopyNetlistSettings copies the netlist settings to aModule.
const wxString & GetPath() const
Definition: class_module.h:202
void SetPath(const wxString &aPath)
Definition: class_module.h:203
void BOARD_NETLIST_UPDATER::SetDeleteSinglePadNets ( bool  aEnabled)
inline

Enables "delete single pad nets" option

Definition at line 97 of file board_netlist_updater.h.

References m_deleteSinglePadNets.

Referenced by PCB_EDIT_FRAME::KiwayMailIn().

98  {
99  m_deleteSinglePadNets = aEnabled;
100  }
void BOARD_NETLIST_UPDATER::SetDeleteUnusedComponents ( bool  aEnabled)
inline

Enables removing unused components

Definition at line 115 of file board_netlist_updater.h.

References m_deleteUnusedComponents.

Referenced by PCB_EDIT_FRAME::KiwayMailIn().

116  {
117  m_deleteUnusedComponents = aEnabled;
118  }
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.

References m_isDryRun.

104  {
105  m_isDryRun = aEnabled;
106  }
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.

References m_lookupByTimestamp.

Referenced by PCB_EDIT_FRAME::KiwayMailIn().

122  {
123  m_lookupByTimestamp = aEnabled;
124  }
void BOARD_NETLIST_UPDATER::SetReplaceFootprints ( bool  aEnabled)
inline

Enables replacing footprints with new ones

Definition at line 109 of file board_netlist_updater.h.

References m_replaceFootprints.

Referenced by PCB_EDIT_FRAME::KiwayMailIn().

110  {
111  m_replaceFootprints = aEnabled;
112  }
void BOARD_NETLIST_UPDATER::SetReporter ( REPORTER aReporter)
inline

Sets the reporter object

Definition at line 91 of file board_netlist_updater.h.

References m_reporter.

Referenced by DIALOG_UPDATE_PCB::PerformUpdate().

92  {
93  m_reporter = aReporter;
94  }
bool BOARD_NETLIST_UPDATER::testConnectivity ( NETLIST aNetlist)
private

Definition at line 652 of file board_netlist_updater.cpp.

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

Referenced by GetAddedComponents(), and UpdateNetlist().

653 {
654  // Verify that board contains all pads in netlist: if it doesn't then footprints are
655  // wrong or missing.
656  // Note that we use references to find the footprints as they're already updated by this
657  // point (whether by-reference or by-timestamp).
658 
659  wxString msg;
660  wxString padname;
661 
662  for( int i = 0; i < (int) aNetlist.GetCount(); i++ )
663  {
664  const COMPONENT* component = aNetlist.GetComponent( i );
665  MODULE* footprint = m_board->FindModuleByReference( component->GetReference() );
666 
667  if( footprint == NULL ) // It can be missing in partial designs
668  continue;
669 
670  // Explore all pins/pads in component
671  for( unsigned jj = 0; jj < component->GetNetCount(); jj++ )
672  {
673  const COMPONENT_NET& net = component->GetNet( jj );
674  padname = net.GetPinName();
675 
676  if( footprint->FindPadByName( padname ) )
677  continue; // OK, pad found
678 
679  // not found: bad footprint, report error
680  msg.Printf( _( "Component %s pad %s not found in footprint %s." ),
681  GetChars( component->GetReference() ),
682  GetChars( padname ),
683  GetChars( footprint->GetFPID().Format() ) );
685  ++m_errorCount;
686  }
687  }
688 
689  return true;
690 }
const wxString & GetPinName() const
Definition: pcb_netlist.h:61
D_PAD * FindPadByName(const wxString &aPadName) const
Function FindPadByName returns a D_PAD* with a matching name.
MODULE * FindModuleByReference(const wxString &aReference) const
Function FindModuleByReference searches for a MODULE within this board with the given reference desig...
const wxString & GetReference() const
Definition: pcb_netlist.h:151
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 LIB_ID & GetFPID() const
Definition: class_module.h:193
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
static const wxChar * GetChars(const wxString &s)
Function GetChars returns a wxChar* to the actual wxChar* data within a wxString, and is helpful for ...
Definition: macros.h:92
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.
UTF8 Format() const
Definition: lib_id.cpp:237
const COMPONENT_NET & GetNet(unsigned aIndex) const
Definition: pcb_netlist.h:139
unsigned GetCount() const
Function GetCount.
Definition: pcb_netlist.h:256
unsigned GetNetCount() const
Definition: pcb_netlist.h:137
bool BOARD_NETLIST_UPDATER::updateComponentPadConnections ( MODULE aPcbComponent,
COMPONENT aNewComponent 
)
private

Definition at line 315 of file board_netlist_updater.cpp.

References COMMIT::Add(), cacheNetname(), MODULE::Clone(), BOARD::FindNet(), GetChars(), COMPONENT::GetNet(), COMPONENT_NET::GetNetName(), MODULE::GetPath(), MODULE::GetReference(), COMMIT::GetStatus(), COMPONENT_NET::IsValid(), m_addedNets, m_board, m_commit, m_isDryRun, m_reporter, COMMIT::Modified(), D_PAD::Next(), MODULE::PadsList(), REPORTER::Report(), REPORTER::RPT_ACTION, REPORTER::RPT_INFO, and NETINFO_LIST::UNCONNECTED.

Referenced by GetAddedComponents(), and UpdateNetlist().

316 {
317  wxString msg;
318 
319  // Create a copy only if the module has not been added during this update
320  MODULE* copy = m_commit.GetStatus( aPcbComponent ) ? nullptr : (MODULE*) aPcbComponent->Clone();
321  bool changed = false;
322 
323  // At this point, the component footprint is updated. Now update the nets.
324  for( D_PAD* pad = aPcbComponent->PadsList(); pad; pad = pad->Next() )
325  {
326  COMPONENT_NET net = aNewComponent->GetNet( pad->GetName() );
327 
328  if( !net.IsValid() ) // New footprint pad has no net.
329  {
330  if( !pad->GetNetname().IsEmpty() )
331  {
332  msg.Printf( _( "Disconnect symbol %s pin %s." ),
333  GetChars( aPcbComponent->GetReference() ),
334  GetChars( pad->GetName() ) );
336 
337  msg.Printf( _( "Clearing symbol \"%s:%s\" pin \"%s\" net name." ),
338  GetChars( aPcbComponent->GetReference() ),
339  GetChars( aPcbComponent->GetPath() ),
340  GetChars( pad->GetName() ) );
342  }
343 
344  if( !m_isDryRun )
345  {
346  changed = true;
347  pad->SetNetCode( NETINFO_LIST::UNCONNECTED );
348  }
349  else
350  cacheNetname( pad, wxEmptyString );
351  }
352  else // New footprint pad has a net.
353  {
354  if( net.GetNetName() != pad->GetNetname() )
355  {
356  const wxString& netName = net.GetNetName();
357  NETINFO_ITEM* netinfo = m_board->FindNet( netName );
358 
359  if( netinfo == nullptr )
360  {
361  // It might be a new net that has not been added to the board yet
362  if( m_addedNets.count( netName ) )
363  netinfo = m_addedNets[ netName ];
364  }
365 
366  if( netinfo == nullptr )
367  {
368  // It is a new net, we have to add it
369  if( !m_isDryRun )
370  {
371  changed = true;
372  netinfo = new NETINFO_ITEM( m_board, netName );
373  m_commit.Add( netinfo );
374  m_addedNets[netName] = netinfo;
375  }
376 
377  msg.Printf( _( "Add net %s.\n" ), GetChars( netName ) );
379  }
380 
381  if( !pad->GetNetname().IsEmpty() )
382  {
383  msg.Printf( _( "Reconnect symbol %s pin %s from net %s to net %s."),
384  GetChars( aPcbComponent->GetReference() ),
385  GetChars( pad->GetName() ),
386  GetChars( pad->GetNetname() ),
387  GetChars( netName ) );
388  }
389  else
390  {
391  msg.Printf( _( "Connect symbol %s pin %s to net %s."),
392  GetChars( aPcbComponent->GetReference() ),
393  GetChars( pad->GetName() ),
394  GetChars( netName ) );
395  }
397 
398  msg.Printf( _( "Changing symbol \"%s:%s\" pin \"%s\" net from \"%s\" to \"%s\"." ),
399  GetChars( aPcbComponent->GetReference() ),
400  GetChars( aPcbComponent->GetPath() ),
401  GetChars( pad->GetName() ),
402  GetChars( pad->GetNetname() ),
403  GetChars( netName ) );
405 
406  if( !m_isDryRun )
407  {
408  changed = true;
409  pad->SetNet( netinfo );
410  }
411  else
412  cacheNetname( pad, netName );
413  }
414  }
415  }
416 
417  if( changed && copy )
418  m_commit.Modified( aPcbComponent, copy );
419  else
420  delete copy;
421 
422  return true;
423 }
void cacheNetname(D_PAD *aPad, const wxString &aNetname)
COMMIT & Add(EDA_ITEM *aItem)
Adds a new item to the model
Definition: commit.h:78
int GetStatus(EDA_ITEM *aItem)
Returns status of an item.
Definition: commit.cpp:120
bool IsValid() const
Definition: pcb_netlist.h:65
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
D_PAD * Next() const
Definition: class_pad.h:160
EDA_ITEM * Clone() const override
Function Clone creates a duplicate of this item with linked list members set to NULL.
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:69
static const wxChar * GetChars(const wxString &s)
Function GetChars returns a wxChar* to the actual wxChar* data within a wxString, and is helpful for ...
Definition: macros.h:92
const wxString & GetReference() const
Function GetReference.
Definition: class_module.h:460
NETINFO_ITEM * FindNet(int aNetcode) const
Function FindNet searches for a net with the given netcode.
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 COMPONENT_NET & GetNet(unsigned aIndex) const
Definition: pcb_netlist.h:139
DLIST< D_PAD > & PadsList()
Definition: class_module.h:163
const wxString & GetPath() const
Definition: class_module.h:202
static const int UNCONNECTED
Constant that holds the "unconnected net" number (typically 0) all items "connected" to this net are ...
Definition: netinfo.h:461
bool BOARD_NETLIST_UPDATER::updateComponentParameters ( MODULE aPcbComponent,
COMPONENT aNewComponent 
)
private

Definition at line 235 of file board_netlist_updater.cpp.

References MODULE::Clone(), GetChars(), 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 GetAddedComponents(), and UpdateNetlist().

236 {
237  wxString msg;
238 
239  if( !aPcbComponent )
240  return false;
241 
242  // Create a copy only if the module has not been added during this update
243  MODULE* copy = m_commit.GetStatus( aPcbComponent ) ? nullptr : (MODULE*) aPcbComponent->Clone();
244  bool changed = false;
245 
246  // Test for reference designator field change.
247  if( aPcbComponent->GetReference() != aNewComponent->GetReference() )
248  {
249  msg.Printf( _( "Change symbol %s reference to %s." ),
250  GetChars( aPcbComponent->GetReference() ),
251  GetChars( aNewComponent->GetReference() ) );
253 
254  msg.Printf( _( "Changing symbol \"%s:%s\" reference to \"%s\"." ),
255  GetChars( aPcbComponent->GetReference() ),
256  GetChars( aPcbComponent->GetPath() ),
257  GetChars( aNewComponent->GetReference() ) );
259 
260  if ( !m_isDryRun )
261  {
262  changed = true;
263  aPcbComponent->SetReference( aNewComponent->GetReference() );
264  }
265  }
266 
267  // Test for value field change.
268  if( aPcbComponent->GetValue() != aNewComponent->GetValue() )
269  {
270  msg.Printf( _( "Change symbol %s value from %s to %s." ),
271  GetChars( aPcbComponent->GetReference() ),
272  GetChars( aPcbComponent->GetValue() ),
273  GetChars( aNewComponent->GetValue() ) );
275 
276  msg.Printf( _( "Changing symbol \"%s:%s\" value from \"%s\" to \"%s\"." ),
277  GetChars( aPcbComponent->GetReference() ),
278  GetChars( aPcbComponent->GetPath() ),
279  GetChars( aPcbComponent->GetValue() ),
280  GetChars( aNewComponent->GetValue() ) );
282 
283  if( !m_isDryRun )
284  {
285  changed = true;
286  aPcbComponent->SetValue( aNewComponent->GetValue() );
287  }
288  }
289 
290  // Test for time stamp change.
291  if( aPcbComponent->GetPath() != aNewComponent->GetTimeStamp() )
292  {
293  msg.Printf( _( "Changing symbol path \"%s:%s\" to \"%s\"." ),
294  GetChars( aPcbComponent->GetReference() ),
295  GetChars( aPcbComponent->GetPath() ),
296  GetChars( aNewComponent->GetTimeStamp() ) );
298 
299  if( !m_isDryRun )
300  {
301  changed = true;
302  aPcbComponent->SetPath( aNewComponent->GetTimeStamp() );
303  }
304  }
305 
306  if( changed && copy )
307  m_commit.Modified( aPcbComponent, copy );
308  else
309  delete copy;
310 
311  return true;
312 }
const wxString & GetValue() const
Function GetValue.
Definition: class_module.h:494
int GetStatus(EDA_ITEM *aItem)
Returns status of an item.
Definition: commit.cpp:120
const wxString & GetReference() const
Definition: pcb_netlist.h:151
const wxString & GetValue() const
Definition: pcb_netlist.h:153
void SetReference(const wxString &aReference)
Function SetReference.
Definition: class_module.h:470
EDA_ITEM * Clone() const override
Function Clone creates a duplicate of this item with linked list members set to NULL.
const wxString & GetTimeStamp() const
Definition: pcb_netlist.h:170
COMMIT & Modified(EDA_ITEM *aItem, EDA_ITEM *aCopy)
Creates an undo entry for an item that has been already modified.
Definition: commit.h:110
static const wxChar * GetChars(const wxString &s)
Function GetChars returns a wxChar* to the actual wxChar* data within a wxString, and is helpful for ...
Definition: macros.h:92
const wxString & GetReference() const
Function GetReference.
Definition: class_module.h:460
void SetValue(const wxString &aValue)
Function SetValue.
Definition: class_module.h:503
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 & GetPath() const
Definition: class_module.h:202
void SetPath(const wxString &aPath)
Definition: class_module.h:203
bool BOARD_NETLIST_UPDATER::updateCopperZoneNets ( NETLIST aNetlist)
private

Definition at line 440 of file board_netlist_updater.cpp.

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_reporter, m_warningCount, m_zoneConnectionsCache, COMMIT::Modify(), REPORTER::Report(), REPORTER::RPT_ACTION, REPORTER::RPT_INFO, and REPORTER::RPT_WARNING.

Referenced by GetAddedComponents(), and UpdateNetlist().

441 {
442  wxString msg;
443  std::set<wxString> netlistNetnames;
444 
445  for( int ii = 0; ii < (int) aNetlist.GetCount(); ii++ )
446  {
447  const COMPONENT* component = aNetlist.GetComponent( ii );
448  for( unsigned jj = 0; jj < component->GetNetCount(); jj++ )
449  {
450  const COMPONENT_NET& net = component->GetNet( jj );
451  netlistNetnames.insert( net.GetNetName() );
452  }
453  }
454 
455  // Test copper zones to detect "dead" nets (nets without any pad):
456  for( int i = 0; i < m_board->GetAreaCount(); i++ )
457  {
458  ZONE_CONTAINER* zone = m_board->GetArea( i );
459 
460  if( !zone->IsOnCopperLayer() || zone->GetIsKeepout() )
461  continue;
462 
463  if( netlistNetnames.count( zone->GetNetname() ) == 0 )
464  {
465  // Look for a pad in the zone's connected-pad-cache which has been updated to
466  // a new net and use that. While this won't always be the right net, the dead
467  // net is guaranteed to be wrong.
468  wxString updatedNetname = wxEmptyString;
469 
470  for( D_PAD* pad : m_zoneConnectionsCache[ zone ] )
471  {
472  if( getNetname( pad ) != zone->GetNetname() )
473  {
474  updatedNetname = getNetname( pad );
475  break;
476  }
477  }
478 
479  if( !updatedNetname.IsEmpty() )
480  {
481  msg.Printf( _( "Reconnect copper zone from net %s to net %s." ),
482  zone->GetNetname(), updatedNetname );
484 
485  msg.Printf( _( "Changing copper zone net name from \"%s\" to \"%s\"." ),
486  zone->GetNetname(), updatedNetname );
488 
489  if( !m_isDryRun )
490  {
491  NETINFO_ITEM* netinfo = m_board->FindNet( updatedNetname );
492 
493  if( !netinfo )
494  netinfo = m_addedNets[ updatedNetname ];
495 
496  if( netinfo )
497  {
498  m_commit.Modify( zone );
499  zone->SetNet( netinfo );
500  }
501  }
502  }
503  else
504  {
505  msg.Printf( _( "Copper zone (net %s) has no pads connected." ),
506  zone->GetNetname() );
508  ++m_warningCount;
509  }
510  }
511  }
512 
513  return true;
514 }
Class ZONE_CONTAINER handles a list of polygons defining a copper zone.
Definition: class_zone.h:60
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
bool GetIsKeepout() const
Accessors to parameters used in Keepout zones:
Definition: class_zone.h:602
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
wxString getNetname(D_PAD *aPad)
const wxString & GetNetName() const
Definition: pcb_netlist.h:63
int GetAreaCount() const
Function GetAreaCount.
Definition: class_board.h:1017
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:69
bool IsOnCopperLayer() const
Function IsOnCopperLayer.
Definition: class_zone.cpp:181
const wxString & GetNetname() const
Function GetNetname.
ZONE_CONTAINER * GetArea(int index) const
Function GetArea returns the Area (Zone Container) at a given index.
Definition: class_board.h:988
size_t i
Definition: json11.cpp:597
NETINFO_ITEM * FindNet(int aNetcode) const
Function FindNet searches for a net with the given netcode.
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 COMPONENT_NET & GetNet(unsigned aIndex) const
Definition: pcb_netlist.h:139
unsigned GetCount() const
Function GetCount.
Definition: pcb_netlist.h:256
unsigned GetNetCount() const
Definition: pcb_netlist.h:137
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 693 of file board_netlist_updater.cpp.

References addNewComponent(), cacheCopperZoneConnections(), deleteSinglePadNets(), deleteUnusedComponents(), BOARD::FindModule(), LIB_ID::Format(), GetChars(), NETLIST::GetComponent(), BOARD::GetConnectivity(), NETLIST::GetCount(), COMPONENT::GetFPID(), COMPONENT::GetReference(), COMPONENT::GetTimeStamp(), i, NETLIST::IsFindByTimeStamp(), m_board, m_commit, m_deleteSinglePadNets, m_deleteUnusedComponents, m_errorCount, m_isDryRun, m_reporter, m_warningCount, BOARD_COMMIT::Push(), replaceComponent(), REPORTER::Report(), REPORTER::ReportTail(), REPORTER::RPT_ACTION, REPORTER::RPT_ERROR, REPORTER::RPT_INFO, EDA_ITEM::SetStatus(), testConnectivity(), updateComponentPadConnections(), updateComponentParameters(), and updateCopperZoneNets().

Referenced by PCB_EDIT_FRAME::KiwayMailIn().

694 {
695  wxString msg;
696  m_errorCount = 0;
697  m_warningCount = 0;
698 
700 
701  if( !m_isDryRun )
702  {
703  m_board->SetStatus( 0 );
704  }
705 
706  for( int i = 0; i < (int) aNetlist.GetCount(); i++ )
707  {
708  COMPONENT* component = aNetlist.GetComponent( i );
709  MODULE* footprint = NULL;
710 
711  msg.Printf( _( "Processing component \"%s:%s:%s\"." ),
712  GetChars( component->GetReference() ),
713  GetChars( component->GetTimeStamp() ),
714  GetChars( component->GetFPID().Format() ) );
716 
717  if( aNetlist.IsFindByTimeStamp() )
718  footprint = m_board->FindModule( component->GetTimeStamp(), true );
719  else
720  footprint = m_board->FindModule( component->GetReference() );
721 
722  if( footprint ) // An existing footprint.
723  {
724  MODULE* newFootprint = replaceComponent( aNetlist, footprint, component );
725 
726  if( newFootprint )
727  footprint = newFootprint;
728  }
729  else
730  {
731  footprint = addNewComponent( component );
732  }
733 
734  if( footprint )
735  {
736  updateComponentParameters( footprint, component );
737  updateComponentPadConnections( footprint, component );
738  }
739  }
740 
741  updateCopperZoneNets( aNetlist );
742 
744  deleteUnusedComponents( aNetlist );
745 
748 
749  if( !m_isDryRun )
750  {
751  m_commit.Push( _( "Update netlist" ) );
752  m_board->GetConnectivity()->Build( m_board );
753  testConnectivity( aNetlist );
754  }
755 
756  // Update the ratsnest
759 
760  msg.Printf( _( "Total warnings: %d, errors: %d." ), m_warningCount, m_errorCount );
762 
763  if( m_errorCount )
764  {
765  m_reporter->ReportTail( _( "Errors occurred during the netlist update. Unless you "
766  "fix them, your board will not be consistent with the schematics." ),
768 
769  return false;
770  }
771  else
772  {
773  m_reporter->ReportTail( _( "Netlist update successful!" ), REPORTER::RPT_ACTION );
774  }
775 
776  return true;
777 }
MODULE * replaceComponent(NETLIST &aNetlist, MODULE *aPcbComponent, COMPONENT *aNewComponent)
const LIB_ID & GetFPID() const
Definition: pcb_netlist.h:166
bool updateComponentPadConnections(MODULE *aPcbComponent, COMPONENT *aNewComponent)
bool updateCopperZoneNets(NETLIST &aNetlist)
MODULE * FindModule(const wxString &aRefOrTimeStamp, bool aSearchByTimeStamp=false) const
Function FindModule searches for a module matching aRefOrTimeStamp depending on the state of aSearchB...
bool testConnectivity(NETLIST &aNetlist)
const wxString & GetReference() const
Definition: pcb_netlist.h:151
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:109
bool IsFindByTimeStamp() const
Definition: pcb_netlist.h:313
const wxString & GetTimeStamp() const
Definition: pcb_netlist.h:170
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
static const wxChar * GetChars(const wxString &s)
Function GetChars returns a wxChar* to the actual wxChar* data within a wxString, and is helpful for ...
Definition: macros.h:92
bool updateComponentParameters(MODULE *aPcbComponent, COMPONENT *aNewComponent)
size_t i
Definition: json11.cpp:597
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:251
virtual REPORTER & Report(const wxString &aText, SEVERITY aSeverity=RPT_UNDEFINED)=0
Function Report is a pure virtual function to override in the derived object.
UTF8 Format() const
Definition: lib_id.cpp:237
unsigned GetCount() const
Function GetCount.
Definition: pcb_netlist.h:256
bool deleteUnusedComponents(NETLIST &aNetlist)
std::shared_ptr< CONNECTIVITY_DATA > GetConnectivity() const
Function GetConnectivity() returns list of missing connections between components/tracks.
Definition: class_board.h:295
MODULE * addNewComponent(COMPONENT *aComponent)
bool BOARD_NETLIST_UPDATER::UpdateNetlist ( const wxString &  aNetlistFileName,
const wxString &  aCmpFileName 
)

Definition at line 780 of file board_netlist_updater.cpp.

782 {
783  return false;
784 }

Member Data Documentation

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

Definition at line 152 of file board_netlist_updater.h.

Referenced by addNewComponent(), and GetAddedComponents().

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

Definition at line 153 of file board_netlist_updater.h.

Referenced by updateComponentPadConnections(), and updateCopperZoneNets().

bool BOARD_NETLIST_UPDATER::m_deleteSinglePadNets
private
bool BOARD_NETLIST_UPDATER::m_deleteUnusedComponents
private
int BOARD_NETLIST_UPDATER::m_errorCount
private
bool BOARD_NETLIST_UPDATER::m_lookupByTimestamp
private
std::map< D_PAD*, wxString > BOARD_NETLIST_UPDATER::m_padNets
private

Definition at line 151 of file board_netlist_updater.h.

Referenced by cacheNetname(), and getNetname().

bool BOARD_NETLIST_UPDATER::m_replaceFootprints
private
int BOARD_NETLIST_UPDATER::m_warningCount
private
std::map< ZONE_CONTAINER*, std::vector<D_PAD*> > BOARD_NETLIST_UPDATER::m_zoneConnectionsCache
private

Definition at line 150 of file board_netlist_updater.h.

Referenced by cacheCopperZoneConnections(), and updateCopperZoneNets().


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