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-2015 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>
44 #include <connectivity_data.h>
45 #include <reporter.h>
46 
47 #include <board_netlist_updater.h>
48 
49 #include <pcb_edit_frame.h>
50 
51 
53  m_commit( aFrame ),
54  m_board( aBoard )
55 {
57 
58  m_deleteSinglePadNets = true;
60  m_isDryRun = false;
61  m_replaceFootprints = true;
62  m_lookupByTimestamp = false;
63 
64  m_warningCount = 0;
65  m_errorCount = 0;
66 }
67 
68 
70 {
71 }
72 
73 
74 // These functions allow inspection of pad nets during dry runs by keeping a cache of
75 // current pad netnames indexed by pad.
76 
77 void BOARD_NETLIST_UPDATER::cacheNetname( D_PAD* aPad, const wxString& aNetname )
78 {
79  m_padNets[ aPad ] = aNetname;
80 }
81 
83 {
84  if( m_isDryRun && m_padNets.count( aPad ) )
85  return m_padNets[ aPad ];
86  else
87  return aPad->GetNetname();
88 }
89 
90 
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 }
117 
118 
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 }
168 
169 
170 MODULE* BOARD_NETLIST_UPDATER::replaceComponent( NETLIST& aNetlist, MODULE* aPcbComponent, COMPONENT* aNewComponent )
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 }
233 
234 
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 }
313 
314 
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 }
424 
425 
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 }
438 
439 
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 }
515 
516 
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 }
558 
559 
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 }
650 
651 
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 }
691 
692 
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 }
778 
779 
780 bool BOARD_NETLIST_UPDATER::UpdateNetlist( const wxString& aNetlistFileName,
781  const wxString& aCmpFileName )
782 {
783  return false;
784 }
const wxString & GetPinName() const
Definition: pcb_netlist.h:61
void BuildListOfNets()
Definition: class_board.h:728
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
MODULE * replaceComponent(NETLIST &aNetlist, MODULE *aPcbComponent, COMPONENT *aNewComponent)
bool empty() const
Definition: lib_id.h:186
const LIB_ID & GetFPID() const
Definition: pcb_netlist.h:166
void cacheNetname(D_PAD *aPad, const wxString &aNetname)
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
Class BOARD to handle a board.
std::map< ZONE_CONTAINER *, std::vector< D_PAD * > > m_zoneConnectionsCache
D_PAD * FindPadByName(const wxString &aPadName) const
Function FindPadByName returns a D_PAD* with a matching name.
MODULE * Next() const
Definition: class_module.h:123
MODULE * GetParent() const
Definition: class_pad.h:162
int GetHeight() const
Definition: eda_rect.h:118
MODULE * FindModuleByReference(const wxString &aReference) const
Function FindModuleByReference searches for a MODULE within this board with the given reference desig...
Classes to handle copper zones.
BOARD_NETLIST_UPDATER class definition.
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
bool updateComponentPadConnections(MODULE *aPcbComponent, COMPONENT *aNewComponent)
bool IsValid() const
Definition: pcb_netlist.h:65
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)
bool UpdateNetlist(NETLIST &aNetlist)
Function UpdateNetlist()
const EDA_RECT GetBoardEdgesBoundingBox() const
Function GetBoardEdgesBoundingBox Returns the board bounding box calculated using exclusively the boa...
Definition: class_board.h:803
bool GetIsKeepout() const
Accessors to parameters used in Keepout zones:
Definition: class_zone.h:602
std::map< wxString, NETINFO_ITEM * > m_addedNets
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
const wxString & GetValue() const
Definition: pcb_netlist.h:153
timestamp_t GetNewTimeStamp()
Definition: common.cpp:159
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:213
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 IsEmpty() const
Definition: class_board.h:271
const wxString & GetNetName() const
Definition: pcb_netlist.h:63
bool IsFindByTimeStamp() const
Definition: pcb_netlist.h:313
D_PAD * Next() const
Definition: class_pad.h:160
bool SetNetCode(int aNetCode, bool aNoAssert=false)
Function SetNetCode sets net using a net code.
const wxString & GetName() const
Definition: class_pad.h:190
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.
COMMIT & Remove(EDA_ITEM *aItem)
Removes a new item from the model
Definition: commit.h:90
int GetAreaCount() const
Function GetAreaCount.
Definition: class_board.h:1017
const wxString & GetTimeStamp() const
Definition: pcb_netlist.h:170
int GetBottom() const
Definition: eda_rect.h:122
wxPoint Centre() const
Definition: eda_rect.h:60
void SetPosition(const wxPoint &aPos) override
std::map< D_PAD *, wxString > m_padNets
const PAGE_INFO & GetPageSettings() const
Definition: class_board.h:552
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
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:69
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
bool updateComponentParameters(MODULE *aPcbComponent, COMPONENT *aNewComponent)
Class BOARD holds information pertinent to a Pcbnew printed circuit board.
Definition: class_board.h:169
const wxString & GetReference() const
Function GetReference.
Definition: class_module.h:460
DLIST< MODULE > m_Modules
Definition: class_board.h:247
size_t i
Definition: json11.cpp:597
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:503
NETINFO_ITEM * FindNet(int aNetcode) const
Function FindNet searches for a net with the given netcode.
The common library.
int GetWidth() const
Definition: eda_rect.h:117
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
COMPONENT * GetComponentByReference(const wxString &aReference)
Function GetComponentByReference returns a COMPONENT by aReference.
const COMPONENT_NET & GetNet(unsigned aIndex) const
Definition: pcb_netlist.h:139
void CopyNetlistSettings(MODULE *aModule, bool aCopyLocalSettings)
Function CopyNetlistSettings copies the netlist settings to aModule.
DLIST< D_PAD > & PadsList()
Definition: class_module.h:163
std::vector< MODULE * > m_addedComponents
Module description (excepted pads)
static REPORTER & GetInstance()
Definition: reporter.cpp:104
const wxString & GetPath() const
Definition: class_module.h:202
BOARD_NETLIST_UPDATER(PCB_EDIT_FRAME *aFrame, BOARD *aBoard)
unsigned GetCount() const
Function GetCount.
Definition: pcb_netlist.h:256
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:461
unsigned GetNetCount() const
Definition: pcb_netlist.h:137
std::shared_ptr< CONNECTIVITY_DATA > GetConnectivity() const
Function GetConnectivity() returns list of missing connections between components/tracks.
Definition: class_board.h:295
void SetPath(const wxString &aPath)
Definition: class_module.h:203
COMPONENT * GetComponentByTimeStamp(const wxString &aTimeStamp)
Function GetComponentByTimeStamp returns a COMPONENT by aTimeStamp.
void SetTimeStamp(timestamp_t aNewTimeStamp)
Definition: base_struct.h:203
MODULE * addNewComponent(COMPONENT *aComponent)