125 bestPosition.
x = pageSize.GetWidth() / 2;
126 bestPosition.
y = pageSize.GetHeight() / 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( changed &&
copy )
425 copy->SetParentGroup(
nullptr );
428 bool changed =
false;
435 wxString pinFunction;
446 if(
pad->GetPinFunction() != pinFunction )
449 pad->SetPinFunction( pinFunction );
452 if(
pad->GetPinType() != pinType )
455 pad->SetPinType( pinType );
464 if( !net.
IsValid() || !
pad->IsOnCopperLayer() )
466 if( !
pad->GetNetname().IsEmpty() )
470 msg.Printf(
_(
"Disconnect %s pin %s." ),
476 msg.Printf(
_(
"Disconnected %s pin %s." ),
483 else if(
pad->IsOnCopperLayer() && !
pad->GetNumber().IsEmpty() )
486 msg.Printf(
_(
"No net found for symbol %s pin %s." ),
499 if(
pad->GetNetname().IsEmpty() )
500 pad->SetPinFunction( wxEmptyString );
516 if(
pad->GetNetname() != netName )
519 if( netinfo ==
nullptr )
526 if( netinfo ==
nullptr )
542 if( !
pad->GetNetname().IsEmpty() )
548 msg.Printf(
_(
"Reconnect %s pin %s from %s to %s."),
556 msg.Printf(
_(
"Reconnected %s pin %s from %s to %s."),
567 msg.Printf(
_(
"Connect %s pin %s to %s."),
574 msg.Printf(
_(
"Connected %s pin %s to %s."),
586 pad->SetNet( netinfo );
596 if( changed &&
copy )
609 if( !zone->IsOnCopperLayer() || zone->GetIsRuleArea() )
620 std::set<wxString> netlistNetnames;
622 for(
int ii = 0; ii < (int) aNetlist.
GetCount(); ii++ )
626 for(
unsigned jj = 0; jj < component->
GetNetCount(); jj++ )
638 if( netlistNetnames.count(
via->GetNetname() ) == 0 )
640 wxString updatedNetname = wxEmptyString;
649 if( !updatedNetname.IsEmpty() )
653 msg.Printf(
_(
"Reconnect via from %s to %s." ),
669 via->SetNet( netinfo );
671 msg.Printf(
_(
"Reconnected via from %s to %s." ),
681 msg.Printf(
_(
"Via connected to unknown net (%s)." ),
692 if( !zone->IsOnCopperLayer() || zone->GetIsRuleArea() )
695 if( netlistNetnames.count( zone->GetNetname() ) == 0 )
700 wxString updatedNetname = wxEmptyString;
713 if( updatedNetname.IsEmpty() &&
m_oldToNewNets.count( zone->GetNetname() ) )
718 if( !updatedNetname.IsEmpty() )
722 if( !zone->GetZoneName().IsEmpty() )
724 msg.Printf(
_(
"Reconnect copper zone '%s' from %s to %s." ),
731 msg.Printf(
_(
"Reconnect copper zone from %s to %s." ),
748 zone->SetNet( netinfo );
750 if( !zone->GetZoneName().IsEmpty() )
752 msg.Printf(
_(
"Reconnected copper zone '%s' from %s to %s." ),
759 msg.Printf(
_(
"Reconnected copper zone from %s to %s." ),
770 if( !zone->GetZoneName().IsEmpty() )
772 msg.Printf(
_(
"Copper zone '%s' has no pads connected." ),
773 zone->GetZoneName() );
780 msg.Printf(
_(
"Copper zone on layer %s at (%s, %s) has no pads connected." ),
797 std::map<COMPONENT*, FOOTPRINT*>& aFootprintMap )
805 for(
int i = 0; i < (int) aNetlist.
GetCount(); i++ )
808 FOOTPRINT* footprint = aFootprintMap[component];
814 for(
unsigned jj = 0; jj < component->
GetNetCount(); jj++ )
818 if( padNumber.IsEmpty() )
821 msg.Printf(
_(
"Symbol %s has pins with no number. These pins can not be matched "
831 msg.Printf(
_(
"%s pad %s not found in %s." ),
847 FOOTPRINT* lastPreexistingFootprint =
nullptr;
855 std::map<COMPONENT*, FOOTPRINT*> footprintMap;
870 net->SetIsCurrent( net->GetNetCode() == 0 );
876 for(
unsigned i = 0; i < aNetlist.
GetCount(); i++ )
880 if( component->
GetProperties().count( wxT(
"exclude_from_board" ) ) )
883 msg.Printf(
_(
"Processing symbol '%s:%s'." ),
899 base.push_back( uuid );
901 if( footprint->GetPath() == base )
910 match = footprint->GetReference().CmpNoCase( component->
GetReference() ) == 0;
922 footprintMap[ component ] = tmp;
931 if( footprint == lastPreexistingFootprint )
938 if( matchCount == 0 )
944 footprintMap[ component ] = footprint;
950 else if( matchCount > 1 )
952 msg.Printf(
_(
"Multiple footprints found for '%s'." ), component->
GetReference() );
965 bool matched =
false;
976 if( component && component->
GetProperties().count( wxT(
"exclude_from_board" ) ) == 0 )
979 if( doDelete && !matched && footprint->IsLocked() )
983 msg.Printf(
_(
"Cannot remove unused footprint %s (locked)." ),
984 footprint->GetReference() );
988 msg.Printf(
_(
"Could not remove unused footprint %s (locked)." ),
989 footprint->GetReference() );
997 if( doDelete && !matched )
1001 msg.Printf(
_(
"Remove unused footprint %s." ), footprint->GetReference() );
1006 msg.Printf(
_(
"Removed unused footprint %s." ), footprint->GetReference() );
1016 for(
PAD*
pad : footprint->Pads() )
1019 pad->GetNet()->SetIsCurrent(
true );
1031 if( !net->IsCurrent() )
1033 msg.Printf(
_(
"Removed unused net %s." ), net->GetNetname() );
1053 for(
const std::pair<const wxString, NETINFO_ITEM*>& addedNet :
m_addedNets )
1054 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 & Modify(EDA_ITEM *aItem)
Create an undo entry for an item that has been already modified.
COMMIT & Modified(EDA_ITEM *aItem, EDA_ITEM *aCopy)
COMMIT & Removed(EDA_ITEM *aItem)
Modify a given item in the model.
COMMIT & Remove(EDA_ITEM *aItem)
Notify observers that aItem has been removed.
int GetStatus(EDA_ITEM *aItem)
COMMIT & Add(EDA_ITEM *aItem)
Notify observers that aItem has been added.
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
void SetStatus(EDA_ITEM_FLAGS aStatus)
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 forces initialization of a netinfo item to the NETINFO_ITEM ORPHANED (typically -1) whe...
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 wxSize 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 SaveProjectSettings() override
Save changes to the project settings to the project (.pro) file.
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)