KiCad PCB EDA Suite
BOARD_NETLIST_UPDATER Class Reference

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

#include <board_netlist_updater.h>

Public Member Functions

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

Private Member Functions

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

Private Attributes

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

Detailed Description

Update the BOARD with a new netlist.

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

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

Definition at line 65 of file board_netlist_updater.h.

Constructor & Destructor Documentation

◆ BOARD_NETLIST_UPDATER()

BOARD_NETLIST_UPDATER::BOARD_NETLIST_UPDATER ( PCB_EDIT_FRAME aFrame,
BOARD aBoard 
)

Definition at line 49 of file board_netlist_updater.cpp.

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

◆ ~BOARD_NETLIST_UPDATER()

BOARD_NETLIST_UPDATER::~BOARD_NETLIST_UPDATER ( )

Definition at line 67 of file board_netlist_updater.cpp.

68{
69}

Member Function Documentation

◆ addNewFootprint()

FOOTPRINT * BOARD_NETLIST_UPDATER::addNewFootprint ( COMPONENT aComponent)
private

Definition at line 133 of file board_netlist_updater.cpp.

134{
135 wxString msg;
136
137 if( aComponent->GetFPID().empty() )
138 {
139 msg.Printf( _( "Cannot add %s (no footprint assigned)." ),
140 aComponent->GetReference(),
141 aComponent->GetFPID().Format().wx_str() );
143 ++m_errorCount;
144 return nullptr;
145 }
146
147 FOOTPRINT* footprint = m_frame->LoadFootprint( aComponent->GetFPID() );
148
149 if( footprint == nullptr )
150 {
151 msg.Printf( _( "Cannot add %s (footprint '%s' not found)." ),
152 aComponent->GetReference(),
153 aComponent->GetFPID().Format().wx_str() );
155 ++m_errorCount;
156 return nullptr;
157 }
158
159 if( m_isDryRun )
160 {
161 msg.Printf( _( "Add %s (footprint '%s')." ),
162 aComponent->GetReference(),
163 aComponent->GetFPID().Format().wx_str() );
164
165 delete footprint;
166 footprint = nullptr;
167 }
168 else
169 {
170 for( PAD* pad : footprint->Pads() )
171 {
172 // Set the pads ratsnest settings to the global settings
173 pad->SetLocalRatsnestVisible( m_frame->GetPcbNewSettings()->m_Display.m_ShowGlobalRatsnest );
174
175 // Pads in the library all have orphaned nets. Replace with Default.
176 pad->SetNetCode( 0 );
177 }
178
179 footprint->SetParent( m_board );
181
182 // This flag is used to prevent connectivity from considering the footprint during its
183 // initial build after the footprint is committed, because we're going to immediately start
184 // a move operation on the footprint and don't want its pads to drive nets onto vias/tracks
185 // it happens to land on at the initial position.
186 footprint->SetAttributes( footprint->GetAttributes() | FP_JUST_ADDED );
187
188 m_addedFootprints.push_back( footprint );
189 m_commit.Add( footprint );
190
191 msg.Printf( _( "Added %s (footprint '%s')." ),
192 aComponent->GetReference(),
193 aComponent->GetFPID().Format().wx_str() );
194 }
195
198 return footprint;
199}
std::vector< FOOTPRINT * > m_addedFootprints
COMMIT & Add(EDA_ITEM *aItem)
Notify observers that aItem has been added.
Definition: commit.h:78
const wxString & GetReference() const
Definition: pcb_netlist.h:126
const LIB_ID & GetFPID() const
Definition: pcb_netlist.h:138
virtual void SetParent(EDA_ITEM *aParent)
Definition: eda_item.h:100
void SetPosition(const VECTOR2I &aPos) override
Definition: footprint.cpp:1688
void SetAttributes(int aAttributes)
Definition: footprint.h:251
int GetAttributes() const
Definition: footprint.h:250
PADS & Pads()
Definition: footprint.h:170
bool empty() const
Definition: lib_id.h:193
UTF8 Format() const
Definition: lib_id.cpp:117
Definition: pad.h:60
DISPLAY_OPTIONS m_Display
PCBNEW_SETTINGS * GetPcbNewSettings() const
FOOTPRINT * LoadFootprint(const LIB_ID &aFootprintId)
Attempt to load aFootprintId from the footprint library table.
virtual REPORTER & Report(const wxString &aText, SEVERITY aSeverity=RPT_SEVERITY_UNDEFINED)=0
Report a string with a given severity.
wxString wx_str() const
Definition: utf8.cpp:46
#define _(s)
@ FP_JUST_ADDED
Definition: footprint.h:73
@ RPT_SEVERITY_ERROR
@ RPT_SEVERITY_ACTION

References _, COMMIT::Add(), LIB_ID::empty(), estimateFootprintInsertionPosition(), LIB_ID::Format(), FP_JUST_ADDED, FOOTPRINT::GetAttributes(), COMPONENT::GetFPID(), PCB_BASE_FRAME::GetPcbNewSettings(), COMPONENT::GetReference(), PCB_BASE_FRAME::LoadFootprint(), m_addedFootprints, m_board, m_commit, PCBNEW_SETTINGS::m_Display, m_errorCount, m_frame, m_isDryRun, m_newFootprintsCount, m_reporter, PCBNEW_SETTINGS::DISPLAY_OPTIONS::m_ShowGlobalRatsnest, pad, FOOTPRINT::Pads(), REPORTER::Report(), RPT_SEVERITY_ACTION, RPT_SEVERITY_ERROR, FOOTPRINT::SetAttributes(), EDA_ITEM::SetParent(), FOOTPRINT::SetPosition(), and UTF8::wx_str().

Referenced by UpdateNetlist().

◆ cacheCopperZoneConnections()

void BOARD_NETLIST_UPDATER::cacheCopperZoneConnections ( )
private

Definition at line 605 of file board_netlist_updater.cpp.

606{
607 for( ZONE* zone : m_board->Zones() )
608 {
609 if( !zone->IsOnCopperLayer() || zone->GetIsRuleArea() )
610 continue;
611
612 m_zoneConnectionsCache[ zone ] = m_board->GetConnectivity()->GetConnectedPads( zone );
613 }
614}
std::map< ZONE *, std::vector< PAD * > > m_zoneConnectionsCache
ZONES & Zones()
Definition: board.h:317
std::shared_ptr< CONNECTIVITY_DATA > GetConnectivity() const
Return a list of missing connections between components/tracks.
Definition: board.h:430
Handle a list of polygons defining a copper zone.
Definition: zone.h:57

References BOARD::GetConnectivity(), m_board, m_zoneConnectionsCache, and BOARD::Zones().

Referenced by UpdateNetlist().

◆ cacheNetname()

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

Definition at line 75 of file board_netlist_updater.cpp.

76{
77 m_padNets[ aPad ] = aNetname;
78}
std::map< PAD *, wxString > m_padNets

References m_padNets.

Referenced by updateComponentPadConnections().

◆ cachePinFunction()

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

Definition at line 90 of file board_netlist_updater.cpp.

91{
92 m_padPinFunctions[ aPad ] = aPinFunction;
93}
std::map< PAD *, wxString > m_padPinFunctions

References m_padPinFunctions.

Referenced by updateComponentPadConnections().

◆ estimateFootprintInsertionPosition()

VECTOR2I BOARD_NETLIST_UPDATER::estimateFootprintInsertionPosition ( )
private

Definition at line 105 of file board_netlist_updater.cpp.

106{
107 VECTOR2I bestPosition;
108
109 if( !m_board->IsEmpty() )
110 {
111 // Position new components below any existing board features.
113
114 if( bbox.GetWidth() || bbox.GetHeight() )
115 {
116 bestPosition.x = bbox.Centre().x;
117 bestPosition.y = bbox.GetBottom() + pcbIUScale.mmToIU( 10 );
118 }
119 }
120 else
121 {
122 // Position new components in the center of the page when the board is empty.
124
125 bestPosition.x = pageSize.x / 2;
126 bestPosition.y = pageSize.y / 2;
127 }
128
129 return bestPosition;
130}
constexpr EDA_IU_SCALE pcbIUScale
Definition: base_units.h:109
const BOX2I GetBoardEdgesBoundingBox() const
Return the board bounding box calculated using exclusively the board edges (graphics on Edge....
Definition: board.h:842
const PAGE_INFO & GetPageSettings() const
Definition: board.h:632
bool IsEmpty() const
Definition: board.h:361
coord_type GetHeight() const
Definition: box2.h:188
coord_type GetWidth() const
Definition: box2.h:187
Vec Centre() const
Definition: box2.h:70
coord_type GetBottom() const
Definition: box2.h:190
const VECTOR2I GetSizeIU(double aIUScale) const
Gets the page size in internal units.
Definition: page_info.h:162
const double IU_PER_MILS
Definition: base_units.h:78
constexpr int mmToIU(double mm) const
Definition: base_units.h:89

References BOX2< Vec >::Centre(), BOARD::GetBoardEdgesBoundingBox(), BOX2< Vec >::GetBottom(), BOX2< Vec >::GetHeight(), BOARD::GetPageSettings(), PAGE_INFO::GetSizeIU(), BOX2< Vec >::GetWidth(), BOARD::IsEmpty(), EDA_IU_SCALE::IU_PER_MILS, m_board, EDA_IU_SCALE::mmToIU(), pcbIUScale, VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by addNewFootprint().

◆ GetAddedFootprints()

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

Definition at line 92 of file board_netlist_updater.h.

92{ return m_addedFootprints; }

References m_addedFootprints.

Referenced by PCB_EDIT_FRAME::OnNetlistChanged().

◆ getNetname()

wxString BOARD_NETLIST_UPDATER::getNetname ( PAD aPad)
private

Definition at line 81 of file board_netlist_updater.cpp.

82{
83 if( m_isDryRun && m_padNets.count( aPad ) )
84 return m_padNets[ aPad ];
85 else
86 return aPad->GetNetname();
87}

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

Referenced by updateCopperZoneNets().

◆ getPinFunction()

wxString BOARD_NETLIST_UPDATER::getPinFunction ( PAD aPad)
private

Definition at line 96 of file board_netlist_updater.cpp.

97{
98 if( m_isDryRun && m_padPinFunctions.count( aPad ) )
99 return m_padPinFunctions[ aPad ];
100 else
101 return aPad->GetPinFunction();
102}
const wxString & GetPinFunction() const
Definition: pad.h:147

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

◆ replaceFootprint()

FOOTPRINT * BOARD_NETLIST_UPDATER::replaceFootprint ( NETLIST aNetlist,
FOOTPRINT aFootprint,
COMPONENT aNewComponent 
)
private

Definition at line 202 of file board_netlist_updater.cpp.

204{
205 wxString msg;
206
207 if( aNewComponent->GetFPID().empty() )
208 {
209 msg.Printf( _( "Cannot update %s (no footprint assigned)." ),
210 aNewComponent->GetReference(),
211 aNewComponent->GetFPID().Format().wx_str() );
213 ++m_errorCount;
214 return nullptr;
215 }
216
217 FOOTPRINT* newFootprint = m_frame->LoadFootprint( aNewComponent->GetFPID() );
218
219 if( newFootprint == nullptr )
220 {
221 msg.Printf( _( "Cannot update %s (footprint '%s' not found)." ),
222 aNewComponent->GetReference(),
223 aNewComponent->GetFPID().Format().wx_str() );
225 ++m_errorCount;
226 return nullptr;
227 }
228
229 if( m_isDryRun )
230 {
231 msg.Printf( _( "Change %s footprint from '%s' to '%s'."),
232 aFootprint->GetReference(),
233 aFootprint->GetFPID().Format().wx_str(),
234 aNewComponent->GetFPID().Format().wx_str() );
235
236 delete newFootprint;
237 newFootprint = nullptr;
238 }
239 else
240 {
241 m_frame->ExchangeFootprint( aFootprint, newFootprint, m_commit );
242
243 msg.Printf( _( "Changed %s footprint from '%s' to '%s'."),
244 aFootprint->GetReference(),
245 aFootprint->GetFPID().Format().wx_str(),
246 aNewComponent->GetFPID().Format().wx_str() );
247 }
248
251 return newFootprint;
252}
const LIB_ID & GetFPID() const
Definition: footprint.h:212
const wxString & GetReference() const
Definition: footprint.h:519
void ExchangeFootprint(FOOTPRINT *aExisting, FOOTPRINT *aNew, BOARD_COMMIT &aCommit, bool deleteExtraTexts=true, bool resetTextLayers=true, bool resetTextEffects=true, bool resetFabricationAttrs=true, bool reset3DModels=true, bool *aUpdated=nullptr)
Replace aExisting footprint by aNew footprint using the Existing footprint settings (position,...

References _, LIB_ID::empty(), PCB_EDIT_FRAME::ExchangeFootprint(), LIB_ID::Format(), FOOTPRINT::GetFPID(), COMPONENT::GetFPID(), FOOTPRINT::GetReference(), COMPONENT::GetReference(), PCB_BASE_FRAME::LoadFootprint(), m_commit, m_errorCount, m_frame, m_isDryRun, m_newFootprintsCount, m_reporter, REPORTER::Report(), RPT_SEVERITY_ACTION, RPT_SEVERITY_ERROR, and UTF8::wx_str().

Referenced by UpdateNetlist().

◆ SetDeleteUnusedFootprints()

void BOARD_NETLIST_UPDATER::SetDeleteUnusedFootprints ( bool  aEnabled)
inline

◆ SetIsDryRun()

void BOARD_NETLIST_UPDATER::SetIsDryRun ( bool  aEnabled)
inline

Definition at line 84 of file board_netlist_updater.h.

84{ m_isDryRun = aEnabled; }

References m_isDryRun.

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

◆ SetLookupByTimestamp()

void BOARD_NETLIST_UPDATER::SetLookupByTimestamp ( bool  aEnabled)
inline

◆ SetReplaceFootprints()

void BOARD_NETLIST_UPDATER::SetReplaceFootprints ( bool  aEnabled)
inline

◆ SetReporter()

void BOARD_NETLIST_UPDATER::SetReporter ( REPORTER aReporter)
inline

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

Definition at line 81 of file board_netlist_updater.h.

References m_reporter.

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

◆ testConnectivity()

bool BOARD_NETLIST_UPDATER::testConnectivity ( NETLIST aNetlist,
std::map< COMPONENT *, FOOTPRINT * > &  aFootprintMap 
)
private

Definition at line 804 of file board_netlist_updater.cpp.

806{
807 // Verify that board contains all pads in netlist: if it doesn't then footprints are
808 // wrong or missing.
809
810 wxString msg;
811 wxString padNumber;
812
813 for( int i = 0; i < (int) aNetlist.GetCount(); i++ )
814 {
815 COMPONENT* component = aNetlist.GetComponent( i );
816 FOOTPRINT* footprint = aFootprintMap[component];
817
818 if( !footprint ) // It can be missing in partial designs
819 continue;
820
821 // Explore all pins/pads in component
822 for( unsigned jj = 0; jj < component->GetNetCount(); jj++ )
823 {
824 padNumber = component->GetNet( jj ).GetPinName();
825
826 if( padNumber.IsEmpty() )
827 {
828 // bad symbol, report error
829 msg.Printf( _( "Symbol %s has pins with no number. These pins can not be matched "
830 "to pads in %s." ),
831 component->GetReference(),
832 footprint->GetFPID().Format().wx_str() );
834 ++m_errorCount;
835 }
836 else if( !footprint->FindPadByNumber( padNumber ) )
837 {
838 // not found: bad footprint, report error
839 msg.Printf( _( "%s pad %s not found in %s." ),
840 component->GetReference(),
841 padNumber,
842 footprint->GetFPID().Format().wx_str() );
844 ++m_errorCount;
845 }
846 }
847 }
848
849 return true;
850}
const wxString & GetPinName() const
Definition: pcb_netlist.h:57
Store all of the related footprint information found in a netlist.
Definition: pcb_netlist.h:85
const COMPONENT_NET & GetNet(unsigned aIndex) const
Definition: pcb_netlist.h:111
unsigned GetNetCount() const
Definition: pcb_netlist.h:109
PAD * FindPadByNumber(const wxString &aPadNumber, PAD *aSearchAfterMe=nullptr) const
Return a PAD with a matching number.
Definition: footprint.cpp:1188
unsigned GetCount() const
Definition: pcb_netlist.h:234
COMPONENT * GetComponent(unsigned aIndex)
Return the COMPONENT at aIndex.
Definition: pcb_netlist.h:242

References _, FOOTPRINT::FindPadByNumber(), LIB_ID::Format(), NETLIST::GetComponent(), NETLIST::GetCount(), FOOTPRINT::GetFPID(), COMPONENT::GetNet(), COMPONENT::GetNetCount(), COMPONENT_NET::GetPinName(), COMPONENT::GetReference(), m_errorCount, m_reporter, REPORTER::Report(), RPT_SEVERITY_ERROR, and UTF8::wx_str().

Referenced by UpdateNetlist().

◆ updateComponentPadConnections()

bool BOARD_NETLIST_UPDATER::updateComponentPadConnections ( FOOTPRINT aFootprint,
COMPONENT aNewComponent 
)
private

Definition at line 414 of file board_netlist_updater.cpp.

416{
417 wxString msg;
418
419 // Create a copy only if the footprint has not been added during this update
420 FOOTPRINT* copy = nullptr;
421
422 if( !m_commit.GetStatus( aFootprint ) )
423 {
424 copy = static_cast<FOOTPRINT*>( aFootprint->Clone() );
425 copy->SetParentGroup( nullptr );
426 }
427
428 bool changed = false;
429
430 // At this point, the component footprint is updated. Now update the nets.
431 for( PAD* pad : aFootprint->Pads() )
432 {
433 const COMPONENT_NET& net = aNewComponent->GetNet( pad->GetNumber() );
434
435 wxString pinFunction;
436 wxString pinType;
437
438 if( net.IsValid() ) // i.e. the pad has a name
439 {
440 pinFunction = net.GetPinFunction();
441 pinType = net.GetPinType();
442 }
443
444 if( !m_isDryRun )
445 {
446 if( pad->GetPinFunction() != pinFunction )
447 {
448 changed = true;
449 pad->SetPinFunction( pinFunction );
450 }
451
452 if( pad->GetPinType() != pinType )
453 {
454 changed = true;
455 pad->SetPinType( pinType );
456 }
457 }
458 else
459 {
460 cachePinFunction( pad, pinFunction );
461 }
462
463 // Test if new footprint pad has no net (pads not on copper layers have no net).
464 if( !net.IsValid() || !pad->IsOnCopperLayer() )
465 {
466 if( !pad->GetNetname().IsEmpty() )
467 {
468 if( m_isDryRun )
469 {
470 msg.Printf( _( "Disconnect %s pin %s." ),
471 aFootprint->GetReference(),
472 pad->GetNumber() );
473 }
474 else
475 {
476 msg.Printf( _( "Disconnected %s pin %s." ),
477 aFootprint->GetReference(),
478 pad->GetNumber() );
479 }
480
482 }
483 else if( pad->IsOnCopperLayer() && !pad->GetNumber().IsEmpty() )
484 {
485 // pad is connectable but has no net found in netlist
486 msg.Printf( _( "No net found for symbol %s pin %s." ),
487 aFootprint->GetReference(),
488 pad->GetNumber() );
490 }
491
492 if( !m_isDryRun )
493 {
494 changed = true;
495 pad->SetNetCode( NETINFO_LIST::UNCONNECTED );
496
497 // If the pad has no net from netlist (i.e. not in netlist
498 // it cannot have a pin function
499 if( pad->GetNetname().IsEmpty() )
500 pad->SetPinFunction( wxEmptyString );
501
502 }
503 else
504 {
505 cacheNetname( pad, wxEmptyString );
506 }
507 }
508 else // New footprint pad has a net.
509 {
510 const wxString& netName = net.GetNetName();
511 NETINFO_ITEM* netinfo = m_board->FindNet( netName );
512
513 if( netinfo && !m_isDryRun )
514 netinfo->SetIsCurrent( true );
515
516 if( pad->GetNetname() != netName )
517 {
518
519 if( netinfo == nullptr )
520 {
521 // It might be a new net that has not been added to the board yet
522 if( m_addedNets.count( netName ) )
523 netinfo = m_addedNets[ netName ];
524 }
525
526 if( netinfo == nullptr )
527 {
528 netinfo = new NETINFO_ITEM( m_board, netName );
529
530 // It is a new net, we have to add it
531 if( !m_isDryRun )
532 {
533 changed = true;
534 m_commit.Add( netinfo );
535 }
536
537 m_addedNets[netName] = netinfo;
538 msg.Printf( _( "Add net %s." ), UnescapeString( netName ) );
540 }
541
542 if( !pad->GetNetname().IsEmpty() )
543 {
544 m_oldToNewNets[ pad->GetNetname() ] = netName;
545
546 if( m_isDryRun )
547 {
548 msg.Printf( _( "Reconnect %s pin %s from %s to %s."),
549 aFootprint->GetReference(),
550 pad->GetNumber(),
551 UnescapeString( pad->GetNetname() ),
552 UnescapeString( netName ) );
553 }
554 else
555 {
556 msg.Printf( _( "Reconnected %s pin %s from %s to %s."),
557 aFootprint->GetReference(),
558 pad->GetNumber(),
559 UnescapeString( pad->GetNetname() ),
560 UnescapeString( netName ) );
561 }
562 }
563 else
564 {
565 if( m_isDryRun )
566 {
567 msg.Printf( _( "Connect %s pin %s to %s."),
568 aFootprint->GetReference(),
569 pad->GetNumber(),
570 UnescapeString( netName ) );
571 }
572 else
573 {
574 msg.Printf( _( "Connected %s pin %s to %s."),
575 aFootprint->GetReference(),
576 pad->GetNumber(),
577 UnescapeString( netName ) );
578 }
579 }
580
582
583 if( !m_isDryRun )
584 {
585 changed = true;
586 pad->SetNet( netinfo );
587 }
588 else
589 {
590 cacheNetname( pad, netName );
591 }
592 }
593 }
594 }
595
596 if( changed && copy )
597 m_commit.Modified( aFootprint, copy );
598 else if( copy )
599 delete copy;
600
601 return true;
602}
void cacheNetname(PAD *aPad, const wxString &aNetname)
std::map< wxString, wxString > m_oldToNewNets
std::map< wxString, NETINFO_ITEM * > m_addedNets
void cachePinFunction(PAD *aPad, const wxString &aPinFunction)
NETINFO_ITEM * FindNet(int aNetcode) const
Search for a net with the given netcode.
Definition: board.cpp:1478
COMMIT & Modified(EDA_ITEM *aItem, EDA_ITEM *aCopy)
Definition: commit.h:110
int GetStatus(EDA_ITEM *aItem)
Definition: commit.cpp:123
Used to store the component pin name to net name (and pin function) associations stored in a netlist.
Definition: pcb_netlist.h:44
const wxString & GetNetName() const
Definition: pcb_netlist.h:58
bool IsValid() const
Definition: pcb_netlist.h:62
const wxString & GetPinFunction() const
Definition: pcb_netlist.h:59
const wxString & GetPinType() const
Definition: pcb_netlist.h:60
EDA_ITEM * Clone() const override
Create a duplicate of this item with linked list members set to NULL.
Definition: footprint.cpp:1387
Handle the data for a net.
Definition: netinfo.h:67
void SetIsCurrent(bool isCurrent)
Definition: netinfo.h:163
static const int UNCONNECTED
Constant that forces initialization of a netinfo item to the NETINFO_ITEM ORPHANED (typically -1) whe...
Definition: netinfo.h:387
@ RPT_SEVERITY_WARNING
wxString UnescapeString(const wxString &aSource)

References _, COMMIT::Add(), cacheNetname(), cachePinFunction(), FOOTPRINT::Clone(), copy, BOARD::FindNet(), COMPONENT::GetNet(), COMPONENT_NET::GetNetName(), COMPONENT_NET::GetPinFunction(), COMPONENT_NET::GetPinType(), FOOTPRINT::GetReference(), COMMIT::GetStatus(), COMPONENT_NET::IsValid(), m_addedNets, m_board, m_commit, m_isDryRun, m_oldToNewNets, m_reporter, COMMIT::Modified(), pad, FOOTPRINT::Pads(), REPORTER::Report(), RPT_SEVERITY_ACTION, RPT_SEVERITY_WARNING, NETINFO_ITEM::SetIsCurrent(), NETINFO_LIST::UNCONNECTED, and UnescapeString().

Referenced by UpdateNetlist().

◆ updateCopperZoneNets()

bool BOARD_NETLIST_UPDATER::updateCopperZoneNets ( NETLIST aNetlist)
private

Definition at line 617 of file board_netlist_updater.cpp.

618{
619 wxString msg;
620 std::set<wxString> netlistNetnames;
621
622 for( int ii = 0; ii < (int) aNetlist.GetCount(); ii++ )
623 {
624 const COMPONENT* component = aNetlist.GetComponent( ii );
625
626 for( unsigned jj = 0; jj < component->GetNetCount(); jj++ )
627 {
628 const COMPONENT_NET& net = component->GetNet( jj );
629 netlistNetnames.insert( net.GetNetName() );
630 }
631 }
632
633 for( PCB_TRACK* via : m_board->Tracks() )
634 {
635 if( via->Type() != PCB_VIA_T )
636 continue;
637
638 if( netlistNetnames.count( via->GetNetname() ) == 0 )
639 {
640 wxString updatedNetname = wxEmptyString;
641
642 // Take via name from name change map if it didn't match to a new pad
643 // (this is useful for stitching vias that don't connect to tracks)
644 if( m_oldToNewNets.count( via->GetNetname() ) )
645 {
646 updatedNetname = m_oldToNewNets[via->GetNetname()];
647 }
648
649 if( !updatedNetname.IsEmpty() )
650 {
651 if( m_isDryRun )
652 {
653 wxString originalNetname = via->GetNetname();
654
655 msg.Printf( _( "Reconnect via from %s to %s." ),
656 UnescapeString( originalNetname ),
657 UnescapeString( updatedNetname ) );
658
660 }
661 else
662 {
663 NETINFO_ITEM* netinfo = m_board->FindNet( updatedNetname );
664
665 if( !netinfo )
666 netinfo = m_addedNets[updatedNetname];
667
668 if( netinfo )
669 {
670 wxString originalNetname = via->GetNetname();
671
673 via->SetNet( netinfo );
674
675 msg.Printf( _( "Reconnected via from %s to %s." ),
676 UnescapeString( originalNetname ),
677 UnescapeString( updatedNetname ) );
678
680 }
681 }
682 }
683 else
684 {
685 msg.Printf( _( "Via connected to unknown net (%s)." ),
686 UnescapeString( via->GetNetname() ) );
689 }
690 }
691 }
692
693 // Test copper zones to detect "dead" nets (nets without any pad):
694 for( ZONE* zone : m_board->Zones() )
695 {
696 if( !zone->IsOnCopperLayer() || zone->GetIsRuleArea() )
697 continue;
698
699 if( netlistNetnames.count( zone->GetNetname() ) == 0 )
700 {
701 // Look for a pad in the zone's connected-pad-cache which has been updated to
702 // a new net and use that. While this won't always be the right net, the dead
703 // net is guaranteed to be wrong.
704 wxString updatedNetname = wxEmptyString;
705
706 for( PAD* pad : m_zoneConnectionsCache[ zone ] )
707 {
708 if( getNetname( pad ) != zone->GetNetname() )
709 {
710 updatedNetname = getNetname( pad );
711 break;
712 }
713 }
714
715 // Take zone name from name change map if it didn't match to a new pad
716 // (this is useful for zones on internal layers)
717 if( updatedNetname.IsEmpty() && m_oldToNewNets.count( zone->GetNetname() ) )
718 {
719 updatedNetname = m_oldToNewNets[ zone->GetNetname() ];
720 }
721
722 if( !updatedNetname.IsEmpty() )
723 {
724 if( m_isDryRun )
725 {
726 wxString originalNetname = zone->GetNetname();
727
728 if( !zone->GetZoneName().IsEmpty() )
729 {
730 msg.Printf( _( "Reconnect copper zone '%s' from %s to %s." ),
731 zone->GetZoneName(),
732 UnescapeString( originalNetname ),
733 UnescapeString( updatedNetname ) );
734 }
735 else
736 {
737 msg.Printf( _( "Reconnect copper zone from %s to %s." ),
738 UnescapeString( originalNetname ),
739 UnescapeString( updatedNetname ) );
740 }
741
743 }
744 else
745 {
746 NETINFO_ITEM* netinfo = m_board->FindNet( updatedNetname );
747
748 if( !netinfo )
749 netinfo = m_addedNets[ updatedNetname ];
750
751 if( netinfo )
752 {
753 wxString originalNetname = zone->GetNetname();
754
755 m_commit.Modify( zone );
756 zone->SetNet( netinfo );
757
758 if( !zone->GetZoneName().IsEmpty() )
759 {
760 msg.Printf( _( "Reconnected copper zone '%s' from %s to %s." ),
761 zone->GetZoneName(),
762 UnescapeString( originalNetname ),
763 UnescapeString( updatedNetname ) );
764 }
765 else
766 {
767 msg.Printf( _( "Reconnected copper zone from %s to %s." ),
768 UnescapeString( originalNetname ),
769 UnescapeString( updatedNetname ) );
770 }
771
773 }
774 }
775 }
776 else
777 {
778 if( !zone->GetZoneName().IsEmpty() )
779 {
780 msg.Printf( _( "Copper zone '%s' has no pads connected." ),
781 zone->GetZoneName() );
782 }
783 else
784 {
785 PCB_LAYER_ID layer = zone->GetLayer();
786 VECTOR2I pos = zone->GetPosition();
787
788 msg.Printf( _( "Copper zone on layer %s at (%s, %s) has no pads connected." ),
789 m_board->GetLayerName( layer ),
792 }
793
796 }
797 }
798 }
799
800 return true;
801}
wxString getNetname(PAD *aPad)
TRACKS & Tracks()
Definition: board.h:308
const wxString GetLayerName(PCB_LAYER_ID aLayer) const
Return the name of a aLayer.
Definition: board.cpp:474
COMMIT & Modify(EDA_ITEM *aItem)
Create an undo entry for an item that has been already modified.
Definition: commit.h:103
wxString MessageTextFromValue(double aValue, bool aAddUnitLabel=true, EDA_DATA_TYPE aType=EDA_DATA_TYPE::DISTANCE)
A lower-precision version of StringFromValue().
PCB_LAYER_ID
A quick note on layer IDs:
Definition: layer_ids.h:59
@ PCB_VIA_T
class PCB_VIA, a via (like a track segment on a copper layer)
Definition: typeinfo.h:102

References _, BOARD::FindNet(), NETLIST::GetComponent(), NETLIST::GetCount(), BOARD::GetLayerName(), COMPONENT::GetNet(), COMPONENT::GetNetCount(), COMPONENT_NET::GetNetName(), getNetname(), m_addedNets, m_board, m_commit, m_frame, m_isDryRun, m_oldToNewNets, m_reporter, m_warningCount, m_zoneConnectionsCache, UNITS_PROVIDER::MessageTextFromValue(), COMMIT::Modify(), pad, PCB_VIA_T, REPORTER::Report(), RPT_SEVERITY_ACTION, RPT_SEVERITY_WARNING, BOARD::Tracks(), UnescapeString(), via, VECTOR2< T >::x, VECTOR2< T >::y, and BOARD::Zones().

Referenced by UpdateNetlist().

◆ updateFootprintParameters()

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

Definition at line 255 of file board_netlist_updater.cpp.

257{
258 wxString msg;
259
260 // Create a copy only if the footprint has not been added during this update
261 FOOTPRINT* copy = nullptr;
262
263 if( !m_commit.GetStatus( aPcbFootprint ) )
264 {
265 copy = static_cast<FOOTPRINT*>( aPcbFootprint->Clone() );
266 copy->SetParentGroup( nullptr );
267 }
268
269 bool changed = false;
270
271 // Test for reference designator field change.
272 if( aPcbFootprint->GetReference() != aNetlistComponent->GetReference() )
273 {
274 if( m_isDryRun )
275 {
276 msg.Printf( _( "Change %s reference designator to %s." ),
277 aPcbFootprint->GetReference(),
278 aNetlistComponent->GetReference() );
279 }
280 else
281 {
282 msg.Printf( _( "Changed %s reference designator to %s." ),
283 aPcbFootprint->GetReference(),
284 aNetlistComponent->GetReference() );
285
286 changed = true;
287 aPcbFootprint->SetReference( aNetlistComponent->GetReference() );
288 }
289
291 }
292
293 // Test for value field change.
294 if( aPcbFootprint->GetValue() != aNetlistComponent->GetValue() )
295 {
296 if( m_isDryRun )
297 {
298 msg.Printf( _( "Change %s value from %s to %s." ),
299 aPcbFootprint->GetReference(),
300 aPcbFootprint->GetValue(),
301 aNetlistComponent->GetValue() );
302 }
303 else
304 {
305 msg.Printf( _( "Changed %s value from %s to %s." ),
306 aPcbFootprint->GetReference(),
307 aPcbFootprint->GetValue(),
308 aNetlistComponent->GetValue() );
309
310 changed = true;
311 aPcbFootprint->SetValue( aNetlistComponent->GetValue() );
312 }
313
315 }
316
317 // Test for time stamp change.
318 KIID_PATH new_path = aNetlistComponent->GetPath();
319
320 if( !aNetlistComponent->GetKIIDs().empty() )
321 new_path.push_back( aNetlistComponent->GetKIIDs().front() );
322
323 if( aPcbFootprint->GetPath() != new_path )
324 {
325 if( m_isDryRun )
326 {
327 msg.Printf( _( "Update %s symbol association from %s to %s." ),
328 aPcbFootprint->GetReference(),
329 aPcbFootprint->GetPath().AsString(),
330 new_path.AsString() );
331 }
332 else
333 {
334 msg.Printf( _( "Updated %s symbol association from %s to %s." ),
335 aPcbFootprint->GetReference(),
336 aPcbFootprint->GetPath().AsString(),
337 new_path.AsString() );
338
339 changed = true;
340 aPcbFootprint->SetPath( new_path );
341 }
342
344 }
345
346 if( aPcbFootprint->GetProperties() != aNetlistComponent->GetProperties() )
347 {
348 if( m_isDryRun )
349 {
350 msg.Printf( _( "Update %s properties." ),
351 aPcbFootprint->GetReference() );
352 }
353 else
354 {
355 msg.Printf( _( "Updated %s properties." ),
356 aPcbFootprint->GetReference() );
357
358 changed = true;
359 aPcbFootprint->SetProperties( aNetlistComponent->GetProperties() );
360 }
361
363 }
364
365 if( ( aNetlistComponent->GetProperties().count( wxT( "exclude_from_bom" ) ) > 0 )
366 != ( ( aPcbFootprint->GetAttributes() & FP_EXCLUDE_FROM_BOM ) > 0 ) )
367 {
368 if( m_isDryRun )
369 {
370 if( aNetlistComponent->GetProperties().count( wxT( "exclude_from_bom" ) ) )
371 {
372 msg.Printf( _( "Add %s 'exclude from BOM' fabrication attribute." ),
373 aPcbFootprint->GetReference() );
374 }
375 else
376 {
377 msg.Printf( _( "Remove %s 'exclude from BOM' fabrication attribute." ),
378 aPcbFootprint->GetReference() );
379 }
380 }
381 else
382 {
383 int attributes = aPcbFootprint->GetAttributes();
384
385 if( aNetlistComponent->GetProperties().count( wxT( "exclude_from_bom" ) ) )
386 {
387 attributes |= FP_EXCLUDE_FROM_BOM;
388 msg.Printf( _( "Added %s 'exclude from BOM' fabrication attribute." ),
389 aPcbFootprint->GetReference() );
390 }
391 else
392 {
393 attributes &= ~FP_EXCLUDE_FROM_BOM;
394 msg.Printf( _( "Removed %s 'exclude from BOM' fabrication attribute." ),
395 aPcbFootprint->GetReference() );
396 }
397
398 changed = true;
399 aPcbFootprint->SetAttributes( attributes );
400 }
401
403 }
404
405 if( changed && copy )
406 m_commit.Modified( aPcbFootprint, copy );
407 else if( copy )
408 delete copy;
409
410 return true;
411}
const KIID_PATH & GetPath() const
Definition: pcb_netlist.h:143
const wxString & GetValue() const
Definition: pcb_netlist.h:129
const std::map< wxString, wxString > & GetProperties() const
Definition: pcb_netlist.h:135
const std::vector< KIID > & GetKIIDs() const
Definition: pcb_netlist.h:145
void SetPath(const KIID_PATH &aPath)
Definition: footprint.h:225
void SetReference(const wxString &aReference)
Definition: footprint.h:528
void SetValue(const wxString &aValue)
Definition: footprint.h:555
const wxString & GetValue() const
Definition: footprint.h:547
void SetProperties(const std::map< wxString, wxString > &aProps)
Definition: footprint.h:575
const KIID_PATH & GetPath() const
Definition: footprint.h:224
const std::map< wxString, wxString > & GetProperties() const
Definition: footprint.h:574
wxString AsString() const
Definition: kiid.cpp:359
@ FP_EXCLUDE_FROM_BOM
Definition: footprint.h:71

References _, KIID_PATH::AsString(), FOOTPRINT::Clone(), copy, FP_EXCLUDE_FROM_BOM, FOOTPRINT::GetAttributes(), COMPONENT::GetKIIDs(), FOOTPRINT::GetPath(), COMPONENT::GetPath(), FOOTPRINT::GetProperties(), COMPONENT::GetProperties(), FOOTPRINT::GetReference(), COMPONENT::GetReference(), COMMIT::GetStatus(), FOOTPRINT::GetValue(), COMPONENT::GetValue(), m_commit, m_isDryRun, m_reporter, COMMIT::Modified(), REPORTER::Report(), RPT_SEVERITY_ACTION, FOOTPRINT::SetAttributes(), FOOTPRINT::SetPath(), FOOTPRINT::SetProperties(), FOOTPRINT::SetReference(), and FOOTPRINT::SetValue().

Referenced by UpdateNetlist().

◆ UpdateNetlist()

bool BOARD_NETLIST_UPDATER::UpdateNetlist ( NETLIST aNetlist)

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

See BOARD_NETLIST_UPDATER class description for the details of the process.

Parameters
aNetlistthe new netlist
Returns
true if process was completed successfully

Definition at line 853 of file board_netlist_updater.cpp.

854{
855 FOOTPRINT* lastPreexistingFootprint = nullptr;
856 COMPONENT* component = nullptr;
857 wxString msg;
858
859 m_errorCount = 0;
860 m_warningCount = 0;
862
863 std::map<COMPONENT*, FOOTPRINT*> footprintMap;
864
865 if( !m_board->Footprints().empty() )
866 lastPreexistingFootprint = m_board->Footprints().back();
867
869
870 // First mark all nets (except <no net>) as stale; we'll update those which are current
871 // in the following two loops.
872 //
873 if( !m_isDryRun )
874 {
875 m_board->SetStatus( 0 );
876
877 for( NETINFO_ITEM* net : m_board->GetNetInfo() )
878 net->SetIsCurrent( net->GetNetCode() == 0 );
879 }
880
881 // Next go through the netlist updating all board footprints which have matching component
882 // entries and adding new footprints for those that don't.
883 //
884 for( unsigned i = 0; i < aNetlist.GetCount(); i++ )
885 {
886 component = aNetlist.GetComponent( i );
887
888 if( component->GetProperties().count( wxT( "exclude_from_board" ) ) )
889 continue;
890
891 msg.Printf( _( "Processing symbol '%s:%s'." ),
892 component->GetReference(),
893 component->GetFPID().Format().wx_str() );
895
896 int matchCount = 0;
897
898 for( FOOTPRINT* footprint : m_board->Footprints() )
899 {
900 bool match = false;
901
903 {
904 for( const KIID& uuid : component->GetKIIDs() )
905 {
906 KIID_PATH base = component->GetPath();
907 base.push_back( uuid );
908
909 if( footprint->GetPath() == base )
910 {
911 match = true;
912 break;
913 }
914 }
915 }
916 else
917 {
918 match = footprint->GetReference().CmpNoCase( component->GetReference() ) == 0;
919 }
920
921 if( match )
922 {
923 FOOTPRINT* tmp = footprint;
924
925 if( m_replaceFootprints && component->GetFPID() != footprint->GetFPID() )
926 tmp = replaceFootprint( aNetlist, footprint, component );
927
928 if( tmp )
929 {
930 footprintMap[ component ] = tmp;
931
932 updateFootprintParameters( tmp, component );
933 updateComponentPadConnections( tmp, component );
934 }
935
936 matchCount++;
937 }
938
939 if( footprint == lastPreexistingFootprint )
940 {
941 // No sense going through the newly-created footprints: end of loop
942 break;
943 }
944 }
945
946 if( matchCount == 0 )
947 {
948 FOOTPRINT* footprint = addNewFootprint( component );
949
950 if( footprint )
951 {
952 footprintMap[ component ] = footprint;
953
954 updateFootprintParameters( footprint, component );
955 updateComponentPadConnections( footprint, component );
956 }
957 }
958 else if( matchCount > 1 )
959 {
960 msg.Printf( _( "Multiple footprints found for '%s'." ), component->GetReference() );
962 m_errorCount++;
963 }
964 }
965
966 updateCopperZoneNets( aNetlist );
967
968 // Finally go through the board footprints and update all those that *don't* have matching
969 // component entries.
970 //
971 for( FOOTPRINT* footprint : m_board->Footprints() )
972 {
973 bool matched = false;
974 bool doDelete = m_deleteUnusedFootprints;
975
976 if( ( footprint->GetAttributes() & FP_BOARD_ONLY ) > 0 )
977 doDelete = false;
978
980 component = aNetlist.GetComponentByPath( footprint->GetPath() );
981 else
982 component = aNetlist.GetComponentByReference( footprint->GetReference() );
983
984 if( component && component->GetProperties().count( wxT( "exclude_from_board" ) ) == 0 )
985 matched = true;
986
987 if( doDelete && !matched && footprint->IsLocked() )
988 {
989 if( m_isDryRun )
990 {
991 msg.Printf( _( "Cannot remove unused footprint %s (locked)." ),
992 footprint->GetReference() );
993 }
994 else
995 {
996 msg.Printf( _( "Could not remove unused footprint %s (locked)." ),
997 footprint->GetReference() );
998 }
999
1001 m_errorCount++;
1002 doDelete = false;
1003 }
1004
1005 if( doDelete && !matched )
1006 {
1007 if( m_isDryRun )
1008 {
1009 msg.Printf( _( "Remove unused footprint %s." ), footprint->GetReference() );
1010 }
1011 else
1012 {
1013 m_commit.Remove( footprint );
1014 msg.Printf( _( "Removed unused footprint %s." ), footprint->GetReference() );
1015 }
1016
1018 }
1019 else if( !m_isDryRun )
1020 {
1021 if( !matched )
1022 footprint->SetPath( KIID_PATH() );
1023
1024 for( PAD* pad : footprint->Pads() )
1025 {
1026 if( pad->GetNet() )
1027 pad->GetNet()->SetIsCurrent( true );
1028 }
1029 }
1030 }
1031
1032 if( !m_isDryRun )
1033 {
1035 testConnectivity( aNetlist, footprintMap );
1036
1037 for( NETINFO_ITEM* net : m_board->GetNetInfo() )
1038 {
1039 if( !net->IsCurrent() )
1040 {
1041 msg.Printf( _( "Removed unused net %s." ), net->GetNetname() );
1043 m_commit.Removed( net );
1044 }
1045 }
1046
1048
1049 // When new footprints are added, the automatic zone refill is disabled because:
1050 // * it creates crashes when calculating dynamic ratsnests if auto refill is enabled.
1051 // (the auto refills rebuild the connectivity with incomplete data)
1052 // * it is useless because zones will be refilled after placing new footprints
1053 m_commit.Push( _( "Update netlist" ), m_newFootprintsCount ? ZONE_FILL_OP : 0 );
1054
1056
1057 // Although m_commit will probably also set this, it's not guaranteed, and we need to make
1058 // sure any modification to netclasses gets persisted to project settings through a save.
1059 m_frame->OnModify();
1060 }
1061
1062 if( m_isDryRun )
1063 {
1064 for( const std::pair<const wxString, NETINFO_ITEM*>& addedNet : m_addedNets )
1065 delete addedNet.second;
1066
1067 m_addedNets.clear();
1068 }
1069
1070 // Update the ratsnest
1073
1074 msg.Printf( _( "Total warnings: %d, errors: %d." ), m_warningCount, m_errorCount );
1076
1077 return true;
1078}
#define ZONE_FILL_OP
Definition: board_commit.h:43
virtual void Push(const wxString &aMessage=wxT("A commit"), int aCommitFlags=0) override
Revert the commit by restoring the modified items state.
bool updateFootprintParameters(FOOTPRINT *aPcbFootprint, COMPONENT *aNetlistComponent)
bool testConnectivity(NETLIST &aNetlist, std::map< COMPONENT *, FOOTPRINT * > &aFootprintMap)
bool updateCopperZoneNets(NETLIST &aNetlist)
bool updateComponentPadConnections(FOOTPRINT *aFootprint, COMPONENT *aNewComponent)
FOOTPRINT * replaceFootprint(NETLIST &aNetlist, FOOTPRINT *aFootprint, COMPONENT *aNewComponent)
FOOTPRINT * addNewFootprint(COMPONENT *aComponent)
const NETINFO_LIST & GetNetInfo() const
Definition: board.h:784
bool BuildConnectivity(PROGRESS_REPORTER *aReporter=nullptr)
Build or rebuild the board connectivity database for the board, especially the list of connected item...
Definition: board.cpp:166
void SynchronizeNetsAndNetClasses(bool aResetTrackAndViaSizes)
Copy NETCLASS info to each NET, based on NET membership in a NETCLASS.
Definition: board.cpp:1546
FOOTPRINTS & Footprints()
Definition: board.h:311
COMMIT & Removed(EDA_ITEM *aItem)
Modify a given item in the model.
Definition: commit.h:96
COMMIT & Remove(EDA_ITEM *aItem)
Notify observers that aItem has been removed.
Definition: commit.h:90
void SetStatus(EDA_ITEM_FLAGS aStatus)
Definition: eda_item.h:137
bool IsLocked() const override
Definition: footprint.h:340
Definition: kiid.h:48
void RemoveUnusedNets()
COMPONENT * GetComponentByPath(const KIID_PATH &aPath)
Return a COMPONENT by aPath.
COMPONENT * GetComponentByReference(const wxString &aReference)
Return a COMPONENT by aReference.
void OnModify() override
Must be called after a board change to set the modified flag.
virtual REPORTER & ReportTail(const wxString &aText, SEVERITY aSeverity=RPT_SEVERITY_UNDEFINED)
Places the report at the end of the list, for objects that support report ordering.
Definition: reporter.h:99
@ FP_BOARD_ONLY
Definition: footprint.h:72
@ RPT_SEVERITY_INFO

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

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

Member Data Documentation

◆ m_addedFootprints

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

Definition at line 127 of file board_netlist_updater.h.

Referenced by addNewFootprint(), and GetAddedFootprints().

◆ m_addedNets

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

◆ m_board

◆ m_commit

◆ m_deleteUnusedFootprints

bool BOARD_NETLIST_UPDATER::m_deleteUnusedFootprints
private

◆ m_errorCount

int BOARD_NETLIST_UPDATER::m_errorCount
private

◆ m_frame

PCB_EDIT_FRAME* BOARD_NETLIST_UPDATER::m_frame
private

◆ m_isDryRun

◆ m_lookupByTimestamp

bool BOARD_NETLIST_UPDATER::m_lookupByTimestamp
private

◆ m_newFootprintsCount

int BOARD_NETLIST_UPDATER::m_newFootprintsCount
private

◆ m_oldToNewNets

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

Definition at line 124 of file board_netlist_updater.h.

Referenced by updateComponentPadConnections(), and updateCopperZoneNets().

◆ m_padNets

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

Definition at line 125 of file board_netlist_updater.h.

Referenced by cacheNetname(), and getNetname().

◆ m_padPinFunctions

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

Definition at line 126 of file board_netlist_updater.h.

Referenced by cachePinFunction(), and getPinFunction().

◆ m_replaceFootprints

bool BOARD_NETLIST_UPDATER::m_replaceFootprints
private

◆ m_reporter

◆ m_warningCount

int BOARD_NETLIST_UPDATER::m_warningCount
private

◆ m_zoneConnectionsCache

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

Definition at line 123 of file board_netlist_updater.h.

Referenced by cacheCopperZoneConnections(), and updateCopperZoneNets().


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