125 bestPosition.
x = pageSize.
x / 2;
126 bestPosition.
y = pageSize.
y / 2;
139 msg.Printf(
_(
"Cannot add %s (no footprint assigned)." ),
149 if( footprint ==
nullptr )
151 msg.Printf(
_(
"Cannot add %s (footprint '%s' not found)." ),
161 msg.Printf(
_(
"Add %s (footprint '%s')." ),
176 pad->SetNetCode( 0 );
191 msg.Printf(
_(
"Added %s (footprint '%s')." ),
209 msg.Printf(
_(
"Cannot update %s (no footprint assigned)." ),
219 if( newFootprint ==
nullptr )
221 msg.Printf(
_(
"Cannot update %s (footprint '%s' not found)." ),
231 msg.Printf(
_(
"Change %s footprint from '%s' to '%s'."),
237 newFootprint =
nullptr;
243 msg.Printf(
_(
"Changed %s footprint from '%s' to '%s'."),
266 copy->SetParentGroup(
nullptr );
269 bool changed =
false;
276 msg.Printf(
_(
"Change %s reference designator to %s." ),
282 msg.Printf(
_(
"Changed %s reference designator to %s." ),
298 msg.Printf(
_(
"Change %s value from %s to %s." ),
305 msg.Printf(
_(
"Changed %s value from %s to %s." ),
320 if( !aNetlistComponent->
GetKIIDs().empty() )
321 new_path.push_back( aNetlistComponent->
GetKIIDs().front() );
323 if( aPcbFootprint->
GetPath() != new_path )
327 msg.Printf(
_(
"Update %s symbol association from %s to %s." ),
334 msg.Printf(
_(
"Updated %s symbol association from %s to %s." ),
340 aPcbFootprint->
SetPath( new_path );
350 msg.Printf(
_(
"Update %s properties." ),
355 msg.Printf(
_(
"Updated %s properties." ),
365 if( ( aNetlistComponent->
GetProperties().count( wxT(
"exclude_from_bom" ) ) > 0 )
370 if( aNetlistComponent->
GetProperties().count( wxT(
"exclude_from_bom" ) ) )
372 msg.Printf(
_(
"Add %s 'exclude from BOM' fabrication attribute." ),
377 msg.Printf(
_(
"Remove %s 'exclude from BOM' fabrication attribute." ),
385 if( aNetlistComponent->
GetProperties().count( wxT(
"exclude_from_bom" ) ) )
388 msg.Printf(
_(
"Added %s 'exclude from BOM' fabrication attribute." ),
393 attributes &= ~FP_EXCLUDE_FROM_BOM;
394 msg.Printf(
_(
"Removed %s 'exclude from BOM' fabrication attribute." ),
405 if( ( aNetlistComponent->
GetProperties().count( wxT(
"dnp" ) ) > 0 )
410 if( aNetlistComponent->
GetProperties().count( wxT(
"dnp" ) ) )
412 msg.Printf(
_(
"Add %s 'Do not place' fabrication attribute." ),
417 msg.Printf(
_(
"Remove %s 'Do not place' fabrication attribute." ),
425 if( aNetlistComponent->
GetProperties().count( wxT(
"dnp" ) ) )
428 msg.Printf(
_(
"Added %s 'Do not place' fabrication attribute." ),
433 attributes &= ~FP_DNP;
434 msg.Printf(
_(
"Removed %s 'Do not place' fabrication attribute." ),
445 if( changed &&
copy )
465 copy->SetParentGroup(
nullptr );
468 bool changed =
false;
475 wxString pinFunction;
486 if(
pad->GetPinFunction() != pinFunction )
489 pad->SetPinFunction( pinFunction );
492 if(
pad->GetPinType() != pinType )
495 pad->SetPinType( pinType );
504 if( !net.
IsValid() || !
pad->IsOnCopperLayer() )
506 if( !
pad->GetNetname().IsEmpty() )
510 msg.Printf(
_(
"Disconnect %s pin %s." ),
516 msg.Printf(
_(
"Disconnected %s pin %s." ),
523 else if(
pad->IsOnCopperLayer() && !
pad->GetNumber().IsEmpty() )
526 msg.Printf(
_(
"No net found for component %s pad %s (no pin %s in symbol)." ),
541 if(
pad->GetNetname().IsEmpty() )
542 pad->SetPinFunction( wxEmptyString );
558 if(
pad->GetNetname() != netName )
561 if( netinfo ==
nullptr )
568 if( netinfo ==
nullptr )
584 if( !
pad->GetNetname().IsEmpty() )
590 msg.Printf(
_(
"Reconnect %s pin %s from %s to %s."),
598 msg.Printf(
_(
"Reconnected %s pin %s from %s to %s."),
609 msg.Printf(
_(
"Connect %s pin %s to %s."),
616 msg.Printf(
_(
"Connected %s pin %s to %s."),
628 pad->SetNet( netinfo );
638 if( changed &&
copy )
651 if( !zone->IsOnCopperLayer() || zone->GetIsRuleArea() )
662 std::set<wxString> netlistNetnames;
664 for(
int ii = 0; ii < (int) aNetlist.
GetCount(); ii++ )
668 for(
unsigned jj = 0; jj < component->
GetNetCount(); jj++ )
680 if( netlistNetnames.count(
via->GetNetname() ) == 0 )
682 wxString updatedNetname = wxEmptyString;
691 if( !updatedNetname.IsEmpty() )
695 wxString originalNetname =
via->GetNetname();
697 msg.Printf(
_(
"Reconnect via from %s to %s." ),
712 wxString originalNetname =
via->GetNetname();
715 via->SetNet( netinfo );
717 msg.Printf(
_(
"Reconnected via from %s to %s." ),
727 msg.Printf(
_(
"Via connected to unknown net (%s)." ),
738 if( !zone->IsOnCopperLayer() || zone->GetIsRuleArea() )
741 if( netlistNetnames.count( zone->GetNetname() ) == 0 )
746 wxString updatedNetname = wxEmptyString;
759 if( updatedNetname.IsEmpty() &&
m_oldToNewNets.count( zone->GetNetname() ) )
764 if( !updatedNetname.IsEmpty() )
768 wxString originalNetname = zone->GetNetname();
770 if( !zone->GetZoneName().IsEmpty() )
772 msg.Printf(
_(
"Reconnect copper zone '%s' from %s to %s." ),
779 msg.Printf(
_(
"Reconnect copper zone from %s to %s." ),
795 wxString originalNetname = zone->GetNetname();
798 zone->SetNet( netinfo );
800 if( !zone->GetZoneName().IsEmpty() )
802 msg.Printf(
_(
"Reconnected copper zone '%s' from %s to %s." ),
809 msg.Printf(
_(
"Reconnected copper zone from %s to %s." ),
820 if( !zone->GetZoneName().IsEmpty() )
822 msg.Printf(
_(
"Copper zone '%s' has no pads connected." ),
823 zone->GetZoneName() );
830 msg.Printf(
_(
"Copper zone on layer %s at (%s, %s) has no pads connected." ),
847 std::map<COMPONENT*, FOOTPRINT*>& aFootprintMap )
855 for(
int i = 0; i < (int) aNetlist.
GetCount(); i++ )
858 FOOTPRINT* footprint = aFootprintMap[component];
864 for(
unsigned jj = 0; jj < component->
GetNetCount(); jj++ )
868 if( padNumber.IsEmpty() )
871 msg.Printf(
_(
"Symbol %s has pins with no number. These pins can not be matched "
881 msg.Printf(
_(
"%s pad %s not found in %s." ),
897 FOOTPRINT* lastPreexistingFootprint =
nullptr;
905 std::map<COMPONENT*, FOOTPRINT*> footprintMap;
918 net->SetIsCurrent( net->GetNetCode() == 0 );
924 for(
unsigned i = 0; i < aNetlist.
GetCount(); i++ )
928 if( component->
GetProperties().count( wxT(
"exclude_from_board" ) ) )
931 msg.Printf(
_(
"Processing symbol '%s:%s'." ),
947 base.push_back( uuid );
949 if( footprint->GetPath() == base )
958 match = footprint->GetReference().CmpNoCase( component->
GetReference() ) == 0;
970 footprintMap[ component ] = tmp;
979 if( footprint == lastPreexistingFootprint )
986 if( matchCount == 0 )
992 footprintMap[ component ] = footprint;
998 else if( matchCount > 1 )
1000 msg.Printf(
_(
"Multiple footprints found for '%s'." ), component->
GetReference() );
1013 bool matched =
false;
1024 if( component && component->
GetProperties().count( wxT(
"exclude_from_board" ) ) == 0 )
1027 if( doDelete && !matched && footprint->IsLocked() )
1031 msg.Printf(
_(
"Cannot remove unused footprint %s (locked)." ),
1032 footprint->GetReference() );
1036 msg.Printf(
_(
"Could not remove unused footprint %s (locked)." ),
1037 footprint->GetReference() );
1045 if( doDelete && !matched )
1049 msg.Printf(
_(
"Remove unused footprint %s." ), footprint->GetReference() );
1054 msg.Printf(
_(
"Removed unused footprint %s." ), footprint->GetReference() );
1064 for(
PAD*
pad : footprint->Pads() )
1067 pad->GetNet()->SetIsCurrent(
true );
1079 if( !net->IsCurrent() )
1081 msg.Printf(
_(
"Removed unused net %s." ), net->GetNetname() );
1104 for(
const std::pair<const wxString, NETINFO_ITEM*>& addedNet :
m_addedNets )
1105 delete addedNet.second;
constexpr EDA_IU_SCALE pcbIUScale
virtual void Push(const wxString &aMessage=wxT("A commit"), int aCommitFlags=0) override
Revert the commit by restoring the modified items state.
wxString GetNetname() const
std::map< PAD *, wxString > m_padNets
bool m_deleteUnusedFootprints
void cacheNetname(PAD *aPad, const wxString &aNetname)
bool UpdateNetlist(NETLIST &aNetlist)
Update the board's components according to the new netlist.
wxString getNetname(PAD *aPad)
wxString getPinFunction(PAD *aPad)
std::vector< FOOTPRINT * > m_addedFootprints
std::map< wxString, wxString > m_oldToNewNets
bool updateFootprintParameters(FOOTPRINT *aPcbFootprint, COMPONENT *aNetlistComponent)
std::map< wxString, NETINFO_ITEM * > m_addedNets
bool testConnectivity(NETLIST &aNetlist, std::map< COMPONENT *, FOOTPRINT * > &aFootprintMap)
bool updateCopperZoneNets(NETLIST &aNetlist)
void cachePinFunction(PAD *aPad, const wxString &aPinFunction)
BOARD_NETLIST_UPDATER(PCB_EDIT_FRAME *aFrame, BOARD *aBoard)
bool updateComponentPadConnections(FOOTPRINT *aFootprint, COMPONENT *aNewComponent)
VECTOR2I estimateFootprintInsertionPosition()
std::map< PAD *, wxString > m_padPinFunctions
std::map< ZONE *, std::vector< PAD * > > m_zoneConnectionsCache
FOOTPRINT * replaceFootprint(NETLIST &aNetlist, FOOTPRINT *aFootprint, COMPONENT *aNewComponent)
void cacheCopperZoneConnections()
FOOTPRINT * addNewFootprint(COMPONENT *aComponent)
Information pertinent to a Pcbnew printed circuit board.
const NETINFO_LIST & GetNetInfo() const
const BOX2I GetBoardEdgesBoundingBox() const
Return the board bounding box calculated using exclusively the board edges (graphics on Edge....
const PAGE_INFO & GetPageSettings() const
NETINFO_ITEM * FindNet(int aNetcode) const
Search for a net with the given netcode.
bool BuildConnectivity(PROGRESS_REPORTER *aReporter=nullptr)
Build or rebuild the board connectivity database for the board, especially the list of connected item...
void SynchronizeNetsAndNetClasses(bool aResetTrackAndViaSizes)
Copy NETCLASS info to each NET, based on NET membership in a NETCLASS.
FOOTPRINTS & Footprints()
const wxString GetLayerName(PCB_LAYER_ID aLayer) const
Return the name of a aLayer.
std::shared_ptr< CONNECTIVITY_DATA > GetConnectivity() const
Return a list of missing connections between components/tracks.
coord_type GetHeight() const
coord_type GetWidth() const
coord_type GetBottom() const
COMMIT & Remove(EDA_ITEM *aItem, BASE_SCREEN *aScreen=nullptr)
Notify observers that aItem has been removed.
COMMIT & Modify(EDA_ITEM *aItem, BASE_SCREEN *aScreen=nullptr)
Create an undo entry for an item that has been already modified.
COMMIT & Modified(EDA_ITEM *aItem, EDA_ITEM *aCopy, BASE_SCREEN *aScreen=nullptr)
COMMIT & Add(EDA_ITEM *aItem, BASE_SCREEN *aScreen=nullptr)
Notify observers that aItem has been added.
COMMIT & Removed(EDA_ITEM *aItem, BASE_SCREEN *aScreen=nullptr)
Modify a given item in the model.
int GetStatus(EDA_ITEM *aItem, BASE_SCREEN *aScreen=nullptr)
Used to store the component pin name to net name (and pin function) associations stored in a netlist.
const wxString & GetNetName() const
const wxString & GetPinFunction() const
const wxString & GetPinName() const
const wxString & GetPinType() const
Store all of the related footprint information found in a netlist.
const COMPONENT_NET & GetNet(unsigned aIndex) const
const KIID_PATH & GetPath() const
const wxString & GetReference() const
const wxString & GetValue() const
const std::map< wxString, wxString > & GetProperties() const
const std::vector< KIID > & GetKIIDs() const
const LIB_ID & GetFPID() const
unsigned GetNetCount() const
virtual void SetParent(EDA_ITEM *aParent)
wxString AsString() const
Handle the data for a net.
void SetIsCurrent(bool isCurrent)
static const int UNCONNECTED
Constant that holds the "unconnected net" number (typically 0) all items "connected" to this net are ...
Store information read from a netlist along with the flags used to update the NETLIST in the BOARD.
unsigned GetCount() const
COMPONENT * GetComponentByPath(const KIID_PATH &aPath)
Return a COMPONENT by aPath.
COMPONENT * GetComponentByReference(const wxString &aReference)
Return a COMPONENT by aReference.
COMPONENT * GetComponent(unsigned aIndex)
Return the COMPONENT at aIndex.
static REPORTER & GetInstance()
const wxString & GetPinFunction() const
const VECTOR2I GetSizeIU(double aIUScale) const
Gets the page size in internal units.
DISPLAY_OPTIONS m_Display
PCBNEW_SETTINGS * GetPcbNewSettings() const
FOOTPRINT * LoadFootprint(const LIB_ID &aFootprintId)
Attempt to load aFootprintId from the footprint library table.
The main frame for Pcbnew.
void OnModify() override
Must be called after a board change to set the modified flag.
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,...
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.
virtual REPORTER & Report(const wxString &aText, SEVERITY aSeverity=RPT_SEVERITY_UNDEFINED)=0
Report a string with a given severity.
wxString MessageTextFromValue(double aValue, bool aAddUnitLabel=true, EDA_DATA_TYPE aType=EDA_DATA_TYPE::DISTANCE)
A lower-precision version of StringFromValue().
Handle a list of polygons defining a copper zone.
PCB_LAYER_ID
A quick note on layer IDs:
wxString UnescapeString(const wxString &aSource)
constexpr int mmToIU(double mm) const
bool m_ShowGlobalRatsnest
@ PCB_VIA_T
class PCB_VIA, a via (like a track segment on a copper layer)