KiCad PCB EDA Suite
board_netlist_updater.cpp
Go to the documentation of this file.
1 
6 /*
7  * This program source code file is part of KiCad, a free EDA CAD application.
8  *
9  * Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
10  * Copyright (C) 2015 CERN
11  * Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
12  * Copyright (C) 2011 Wayne Stambaugh <stambaughw@verizon.net>
13  *
14  * Copyright (C) 1992-2019 KiCad Developers, see AUTHORS.txt for contributors.
15  *
16  * This program is free software; you can redistribute it and/or
17  * modify it under the terms of the GNU General Public License
18  * as published by the Free Software Foundation; either version 2
19  * of the License, or (at your option) any later version.
20  *
21  * This program is distributed in the hope that it will be useful,
22  * but WITHOUT ANY WARRANTY; without even the implied warranty of
23  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24  * GNU General Public License for more details.
25  *
26  * You should have received a copy of the GNU General Public License
27  * along with this program; if not, you may find one here:
28  * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
29  * or you may search the http://www.gnu.org website for the version 2 license,
30  * or you may write to the Free Software Foundation, Inc.,
31  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
32  */
33 
34 
35 #include <common.h> // for PAGE_INFO
36 
37 #include <class_board.h>
38 #include <netinfo.h>
39 #include <class_module.h>
40 #include <class_pad.h>
41 #include <class_zone.h>
42 
43 #include <pcb_netlist.h>
45 #include <reporter.h>
46 
47 #include <board_netlist_updater.h>
48 
49 #include <pcb_edit_frame.h>
50 
51 
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 }
69 
70 
72 {
73 }
74 
75 
76 // These functions allow inspection of pad nets during dry runs by keeping a cache of
77 // current pad netnames indexed by pad.
78 
79 void BOARD_NETLIST_UPDATER::cacheNetname( D_PAD* aPad, const wxString& aNetname )
80 {
81  m_padNets[ aPad ] = aNetname;
82 }
83 
85 {
86  if( m_isDryRun && m_padNets.count( aPad ) )
87  return m_padNets[ aPad ];
88  else
89  return aPad->GetNetname();
90 }
91 
92 
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 }
119 
120 
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 }
170 
171 
173  COMPONENT* aNewComponent )
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 }
217 
218 
220  COMPONENT* aNewComponent )
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 }
282 
283 
285  COMPONENT* aNewComponent )
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( D_PAD* pad = aPcbComponent->PadsList(); pad; pad = pad->Next() )
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 }
387 
388 
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 }
401 
402 
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  // Test copper zones to detect "dead" nets (nets without any pad):
419  for( int i = 0; i < m_board->GetAreaCount(); i++ )
420  {
421  ZONE_CONTAINER* zone = m_board->GetArea( i );
422 
423  if( !zone->IsOnCopperLayer() || zone->GetIsKeepout() )
424  continue;
425 
426  if( netlistNetnames.count( zone->GetNetname() ) == 0 )
427  {
428  // Look for a pad in the zone's connected-pad-cache which has been updated to
429  // a new net and use that. While this won't always be the right net, the dead
430  // net is guaranteed to be wrong.
431  wxString updatedNetname = wxEmptyString;
432 
433  for( D_PAD* pad : m_zoneConnectionsCache[ zone ] )
434  {
435  if( getNetname( pad ) != zone->GetNetname() )
436  {
437  updatedNetname = getNetname( pad );
438  break;
439  }
440  }
441 
442  // Take zone name from name change map if it didn't match to a new pad
443  // (this is useful for zones on internal layers)
444  if( updatedNetname.IsEmpty() && m_oldToNewNets.count( zone->GetNetname() ) )
445  {
446  updatedNetname = m_oldToNewNets[ zone->GetNetname() ];
447  }
448 
449  if( !updatedNetname.IsEmpty() )
450  {
451  msg.Printf( _( "Reconnect copper zone from %s to %s." ),
452  UnescapeString( zone->GetNetname() ),
453  UnescapeString( updatedNetname ) );
455 
456  if( !m_isDryRun )
457  {
458  NETINFO_ITEM* netinfo = m_board->FindNet( updatedNetname );
459 
460  if( !netinfo )
461  netinfo = m_addedNets[ updatedNetname ];
462 
463  if( netinfo )
464  {
465  m_commit.Modify( zone );
466  zone->SetNet( netinfo );
467  }
468  }
469  }
470  else
471  {
472  msg.Printf( _( "Copper zone (%s) has no pads connected." ),
473  UnescapeString( zone->GetNetname() ) );
475  ++m_warningCount;
476  }
477  }
478  }
479 
480  return true;
481 }
482 
483 
485 {
486  wxString msg;
487  MODULE* nextModule;
488  const COMPONENT* component;
489 
490  for( MODULE* module = m_board->m_Modules; module != NULL; module = nextModule )
491  {
492  nextModule = module->Next();
493 
494  if( m_lookupByTimestamp )
495  component = aNetlist.GetComponentByTimeStamp( module->GetPath() );
496  else
497  component = aNetlist.GetComponentByReference( module->GetReference() );
498 
499  if( component == NULL )
500  {
501  if( module->IsLocked() )
502  {
503  msg.Printf( _( "Cannot remove unused footprint %s (locked)." ), module->GetReference() );
505  continue;
506  }
507 
508  msg.Printf( _( "Remove unused footprint %s." ), module->GetReference() );
510 
511  if( !m_isDryRun )
512  m_commit.Remove( module );
513  }
514  }
515 
516  return true;
517 }
518 
519 
521 {
522  int count = 0;
523  wxString netname;
524  wxString msg;
525  D_PAD* previouspad = NULL;
526 
527  // We need the pad list for next tests.
528 
530 
531  std::vector<D_PAD*> padlist = m_board->GetPads();
532 
533  // Sort pads by netlist name
534  std::sort( padlist.begin(), padlist.end(),
535  [ this ]( D_PAD* a, D_PAD* b ) -> bool { return getNetname( a ) < getNetname( b ); } );
536 
537  for( D_PAD* pad : padlist )
538  {
539  if( getNetname( pad ).IsEmpty() )
540  continue;
541 
542  if( netname != getNetname( pad ) ) // End of net
543  {
544  if( previouspad && count == 1 )
545  {
546  // First, see if we have a copper zone attached to this pad.
547  // If so, this is not really a single pad net
548 
549  for( ZONE_CONTAINER* zone : m_board->Zones() )
550  {
551  if( !zone->IsOnCopperLayer() )
552  continue;
553 
554  if( zone->GetIsKeepout() )
555  continue;
556 
557  if( zone->GetNetname() == getNetname( previouspad ) )
558  {
559  count++;
560  break;
561  }
562  }
563 
564  if( count == 1 ) // Really one pad, and nothing else
565  {
566  msg.Printf( _( "Remove single pad net %s." ),
567  UnescapeString( getNetname( previouspad ) ) );
569 
570  if( !m_isDryRun )
571  previouspad->SetNetCode( NETINFO_LIST::UNCONNECTED );
572  else
573  cacheNetname( previouspad, wxEmptyString );
574  }
575  }
576 
577  netname = getNetname( pad );
578  count = 1;
579  }
580  else
581  {
582  count++;
583  }
584 
585  previouspad = pad;
586  }
587 
588  // Examine last pad
589  if( count == 1 )
590  {
591  if( !m_isDryRun )
592  previouspad->SetNetCode( NETINFO_LIST::UNCONNECTED );
593  else
594  cacheNetname( previouspad, wxEmptyString );
595  }
596 
597  return true;
598 }
599 
600 
602 {
603  // Verify that board contains all pads in netlist: if it doesn't then footprints are
604  // wrong or missing.
605  // Note that we use references to find the footprints as they're already updated by this
606  // point (whether by-reference or by-timestamp).
607 
608  wxString msg;
609  wxString padname;
610 
611  for( int i = 0; i < (int) aNetlist.GetCount(); i++ )
612  {
613  const COMPONENT* component = aNetlist.GetComponent( i );
614  MODULE* footprint = m_board->FindModuleByReference( component->GetReference() );
615 
616  if( footprint == NULL ) // It can be missing in partial designs
617  continue;
618 
619  // Explore all pins/pads in component
620  for( unsigned jj = 0; jj < component->GetNetCount(); jj++ )
621  {
622  const COMPONENT_NET& net = component->GetNet( jj );
623  padname = net.GetPinName();
624 
625  if( footprint->FindPadByName( padname ) )
626  continue; // OK, pad found
627 
628  // not found: bad footprint, report error
629  msg.Printf( _( "%s pad %s not found in %s." ),
630  component->GetReference(),
631  padname,
632  footprint->GetFPID().Format().wx_str() );
634  ++m_errorCount;
635  }
636  }
637 
638  return true;
639 }
640 
641 
643 {
644  wxString msg;
645  m_errorCount = 0;
646  m_warningCount = 0;
648  MODULE* lastPreexistingFootprint = m_board->m_Modules.GetLast();
649 
651 
652  if( !m_isDryRun )
653  {
654  m_board->SetStatus( 0 );
655 
656  // Mark all nets (except <no net>) as stale; we'll update those to current that
657  // we find in the netlist
658  for( NETINFO_ITEM* net : m_board->GetNetInfo() )
659  net->SetIsCurrent( net->GetNet() == 0 );
660  }
661 
662  for( unsigned i = 0; i < aNetlist.GetCount(); i++ )
663  {
664  COMPONENT* component = aNetlist.GetComponent( i );
665  int matchCount = 0;
666  MODULE* tmp;
667 
668  msg.Printf( _( "Processing component \"%s:%s:%s\"." ),
669  component->GetReference(),
670  component->GetTimeStamp(),
671  component->GetFPID().Format().wx_str() );
673 
674  for( MODULE* footprint = m_board->m_Modules; footprint; footprint = footprint->Next() )
675  {
676  bool match = false;
677 
678  if( footprint )
679  {
680  if( aNetlist.IsFindByTimeStamp() )
681  match = footprint->GetPath() == component->GetTimeStamp();
682  else
683  match = footprint->GetReference().CmpNoCase( component->GetReference() ) == 0;
684  }
685 
686  if( match )
687  {
688  tmp = footprint;
689 
690  if( m_replaceFootprints && component->GetFPID() != footprint->GetFPID() )
691  tmp = replaceComponent( aNetlist, footprint, component );
692 
693  if( tmp )
694  {
695  updateComponentParameters( tmp, component );
696  updateComponentPadConnections( tmp, component );
697  }
698 
699  matchCount++;
700  }
701 
702  if( footprint == lastPreexistingFootprint )
703  {
704  // No sense going through the newly-created footprints: end of loop
705  break;
706  }
707  }
708 
709  if( matchCount == 0 )
710  {
711  tmp = addNewComponent( component );
712 
713  if( tmp )
714  {
715  updateComponentParameters( tmp, component );
716  updateComponentPadConnections( tmp, component );
717  }
718  }
719  else if( matchCount > 1 )
720  {
721  msg.Printf( _( "Multiple footprints found for \"%s\"." ),
722  component->GetReference() );
724  }
725  }
726 
727  updateCopperZoneNets( aNetlist );
728 
730  deleteUnusedComponents( aNetlist );
731 
732  if( !m_isDryRun )
733  {
734  m_commit.Push( _( "Update netlist" ) );
735  m_board->GetConnectivity()->Build( m_board );
736  testConnectivity( aNetlist );
737 
738  // Now the connectivity data is rebuilt, we can delete single pads nets
741  }
743  // We can delete single net pads in dry run mode only if no new footprints
744  // are added, because these new footprints are not actually added to the board
745  // and the current pad list is wrong in this case.
747 
748  if( m_isDryRun )
749  {
750  for( auto it : m_addedNets )
751  delete it.second;
752 
753  m_addedNets.clear();
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 fix them "
766  "your board will not be consistent with the schematics." ),
768  return false;
769  }
770 
771  m_reporter->ReportTail( _( "Netlist update successful!" ), REPORTER::RPT_ACTION );
772  return true;
773 }
774 
775 
776 bool BOARD_NETLIST_UPDATER::UpdateNetlist( const wxString& aNetlistFileName,
777  const wxString& aCmpFileName )
778 {
779  return false;
780 }
NETINFO_ITEM * FindNet(int aNetcode) const
Function FindNet searches for a net with the given netcode.
void BuildListOfNets()
Definition: class_board.h:727
Class ZONE_CONTAINER handles a list of polygons defining a copper zone.
Definition: class_zone.h:59
COMMIT & Modify(EDA_ITEM *aItem)
Modifies a given item in the model.
Definition: commit.h:103
MODULE * replaceComponent(NETLIST &aNetlist, MODULE *aPcbComponent, COMPONENT *aNewComponent)
const PAGE_INFO & GetPageSettings() const
Definition: class_board.h:549
void cacheNetname(D_PAD *aPad, const wxString &aNetname)
T * GetLast() const
Function GetLast returns the last T* in the list without removing it, or NULL if the list is empty.
Definition: dlist.h:170
COMMIT & Add(EDA_ITEM *aItem)
Adds a new item to the model
Definition: commit.h:78
const EDA_RECT GetBoardEdgesBoundingBox() const
Function GetBoardEdgesBoundingBox Returns the board bounding box calculated using exclusively the boa...
Definition: class_board.h:802
void SetIsCurrent(bool isCurrent)
Definition: netinfo.h:245
bool IsFindByTimeStamp() const
Definition: pcb_netlist.h:313
Class BOARD to handle a board.
std::map< ZONE_CONTAINER *, std::vector< D_PAD * > > m_zoneConnectionsCache
const wxString & GetPath() const
Definition: class_module.h:201
int GetWidth() const
Definition: eda_rect.h:117
const wxString GetValue() const
Function GetValue.
Definition: class_module.h:487
Classes to handle copper zones.
BOARD_NETLIST_UPDATER class definition.
unsigned GetCount() const
Function GetCount.
Definition: pcb_netlist.h:256
int GetStatus(EDA_ITEM *aItem)
Returns status of an item.
Definition: commit.cpp:132
const LIB_ID & GetFPID() const
Definition: class_module.h:192
bool updateComponentPadConnections(MODULE *aPcbComponent, COMPONENT *aNewComponent)
bool updateCopperZoneNets(NETLIST &aNetlist)
bool testConnectivity(NETLIST &aNetlist)
bool UpdateNetlist(NETLIST &aNetlist)
Function UpdateNetlist()
bool empty() const
Definition: lib_id.h:186
int GetBottom() const
Definition: eda_rect.h:122
const wxString GetReference() const
Function GetReference.
Definition: class_module.h:462
std::map< wxString, NETINFO_ITEM * > m_addedNets
const LIB_ID & GetFPID() const
Definition: pcb_netlist.h:166
Class COMPONENT_NET is used to store the component pin name to net name associations stored in a netl...
Definition: pcb_netlist.h:48
timestamp_t GetNewTimeStamp()
Definition: common.cpp:217
D_PAD * FindPadByName(const wxString &aPadName) const
Function FindPadByName returns a D_PAD* with a matching name.
const wxString & GetNetName() const
Definition: pcb_netlist.h:63
int GetAreaCount() const
Function GetAreaCount.
Definition: class_board.h:981
Class NETLIST stores all of information read from a netlist along with the flags used to update the N...
Definition: pcb_netlist.h:214
wxString getNetname(D_PAD *aPad)
void SetParent(EDA_ITEM *aParent)
Definition: base_struct.h:219
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
unsigned GetNetCount() const
Definition: pcb_netlist.h:137
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:292
std::map< wxString, wxString > m_oldToNewNets
bool SetNetCode(int aNetCode, bool aNoAssert=false)
Function SetNetCode sets net using a net code.
void SetReference(const wxString &aReference)
Function SetReference.
Definition: class_module.h:472
EDA_ITEM * Clone() const override
Function Clone creates a duplicate of this item with linked list members set to NULL.
COMMIT & Remove(EDA_ITEM *aItem)
Removes a new item from the model
Definition: commit.h:90
void SetPosition(const wxPoint &aPos) override
const wxString & GetNetname() const
Function GetNetname.
NETINFO_LIST & GetNetInfo()
Definition: class_board.h:748
const COMPONENT_NET & GetNet(unsigned aIndex) const
Definition: pcb_netlist.h:139
std::map< D_PAD *, wxString > m_padNets
int GetHeight() const
Definition: eda_rect.h:118
UTF8 Format() const
Definition: lib_id.cpp:237
bool GetIsKeepout() const
Accessors to parameters used in Keepout zones:
Definition: class_zone.h:651
Pad object description.
Class COMPONENT is used to store components and all of their related information found in a netlist.
Definition: pcb_netlist.h:83
bool IsValid() const
Definition: pcb_netlist.h:65
COMPONENT * GetComponent(unsigned aIndex)
Function GetComponent returns the COMPONENT at aIndex.
Definition: pcb_netlist.h:265
COMMIT & Modified(EDA_ITEM *aItem, EDA_ITEM *aCopy)
Creates an undo entry for an item that has been already modified.
Definition: commit.h:110
const std::vector< D_PAD * > GetPads()
Function GetPads returns a reference to a list of all the pads.
Class NETINFO_ITEM handles the data for a net.
Definition: netinfo.h:65
ZONE_CONTAINERS & Zones()
Definition: class_board.h:254
MODULE * LoadFootprint(const LIB_ID &aFootprintId)
Function LoadFootprint attempts to load aFootprintId from the footprint library table.
bool updateComponentParameters(MODULE *aPcbComponent, COMPONENT *aNewComponent)
Class BOARD holds information pertinent to a Pcbnew printed circuit board.
Definition: class_board.h:170
DLIST< MODULE > m_Modules
Definition: class_board.h:248
wxString UnescapeString(const wxString &aSource)
Definition: string.cpp:123
size_t i
Definition: json11.cpp:597
wxString wx_str() const
Definition: utf8.cpp:51
Class EDA_RECT handles the component boundary box.
Definition: eda_rect.h:44
Class PCB_EDIT_FRAME is the main frame for Pcbnew.
void SetValue(const wxString &aValue)
Function SetValue.
Definition: class_module.h:496
The common library.
virtual void Push(const wxString &aMessage=wxT("A commit"), bool aCreateUndoEntry=true, bool aSetDirtyBit=true) override
Executes the changes.
MODULE * FindModuleByReference(const wxString &aReference) const
Function FindModuleByReference searches for a MODULE within this board with the given reference desig...
void SetStatus(STATUS_FLAGS aStatus)
Definition: base_struct.h:257
wxPoint Centre() const
Definition: eda_rect.h:60
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.
MODULE * Next() const
Definition: class_module.h:122
const wxString & GetValue() const
Definition: pcb_netlist.h:153
COMPONENT * GetComponentByReference(const wxString &aReference)
Function GetComponentByReference returns a COMPONENT by aReference.
DLIST< D_PAD > & PadsList()
Definition: class_module.h:162
std::vector< MODULE * > m_addedComponents
Module description (excepted pads)
ZONE_CONTAINER * GetArea(int index) const
Function GetArea returns the Area (Zone Container) at a given index.
Definition: class_board.h:952
static REPORTER & GetInstance()
Definition: reporter.cpp:104
BOARD_NETLIST_UPDATER(PCB_EDIT_FRAME *aFrame, BOARD *aBoard)
bool deleteUnusedComponents(NETLIST &aNetlist)
static const int UNCONNECTED
Constant that holds the "unconnected net" number (typically 0) all items "connected" to this net are ...
Definition: netinfo.h:465
bool IsOnCopperLayer() const
Function IsOnCopperLayer.
Definition: class_zone.cpp:191
bool IsEmpty() const
Definition: class_board.h:269
void SetPath(const wxString &aPath)
Definition: class_module.h:202
const wxString & GetTimeStamp() const
Definition: pcb_netlist.h:170
COMPONENT * GetComponentByTimeStamp(const wxString &aTimeStamp)
Function GetComponentByTimeStamp returns a COMPONENT by aTimeStamp.
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,...
void SetTimeStamp(timestamp_t aNewTimeStamp)
Definition: base_struct.h:209
MODULE * addNewComponent(COMPONENT *aComponent)