Cvpcb: Fix incorrect unique pad count for footprints using mixed letters/digits in pad name (like AA12, AB12 or Anod for instance.) and skip pads with no pad name.
This commit is contained in:
parent
8f79b4fb11
commit
a356293fee
|
@ -719,25 +719,34 @@ unsigned MODULE::GetPadCount( INCLUDE_NPTH_T aIncludeNPTH ) const
|
|||
|
||||
unsigned MODULE::GetUniquePadCount( INCLUDE_NPTH_T aIncludeNPTH ) const
|
||||
{
|
||||
std::set<int> usedNumbers;
|
||||
std::set<wxUint32> usedNames;
|
||||
|
||||
// Create a set of used pad numbers
|
||||
for( D_PAD* pad = Pads(); pad; pad = pad->Next() )
|
||||
{
|
||||
// Skip pads not on copper layers (used to build complex
|
||||
// solder paste shapes for instance)
|
||||
if( ( pad->GetLayerSet() & LSET::AllCuMask() ).none() )
|
||||
continue;
|
||||
|
||||
// Skip pads with no name, because they are usually "mechanical"
|
||||
// pads, not "electrical" pads
|
||||
if( pad->GetPadName().IsEmpty() )
|
||||
continue;
|
||||
|
||||
if( !aIncludeNPTH )
|
||||
{
|
||||
//remove NPTH
|
||||
// skip NPTH
|
||||
if( pad->GetAttribute() == PAD_ATTRIB_HOLE_NOT_PLATED )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
int padNumber = getTrailingInt( pad->GetPadName() );
|
||||
usedNumbers.insert( padNumber );
|
||||
usedNames.insert( pad->GetPackedPadName() );
|
||||
}
|
||||
|
||||
return usedNumbers.size();
|
||||
return usedNames.size();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -499,6 +499,10 @@ public:
|
|||
/**
|
||||
* GetUniquePadCount
|
||||
* returns the number of unique pads.
|
||||
* A complex pad can be built with many pads having the same pad name
|
||||
* to create a complex shape or fragmented solder paste areas.
|
||||
*
|
||||
* GetUniquePadCount calculate the count of not blank pad names
|
||||
*
|
||||
* @param aIncludeNPTH includes non-plated through holes when true. Does not include
|
||||
* non-plated through holes when false.
|
||||
|
|
|
@ -105,9 +105,27 @@ public:
|
|||
|
||||
MODULE* GetParent() const { return (MODULE*) m_Parent; }
|
||||
|
||||
/**
|
||||
* Set the pad name (sometimes called pad number, although
|
||||
* it can be an array ref like AA12
|
||||
* the pad name is limited to 4 ASCII chars
|
||||
*/
|
||||
void SetPadName( const wxString& name ); // Change pad name
|
||||
|
||||
/**
|
||||
* @return the pad name
|
||||
* the pad name is limited to 4 ASCII chars
|
||||
*/
|
||||
const wxString GetPadName() const;
|
||||
|
||||
/**
|
||||
* @return the pad name in a wxUint32 which is possible
|
||||
* because the pad name is limited to 4 ASCII chars
|
||||
* The packed pad name should be used only to compare 2
|
||||
* pad names, not to try to print this name
|
||||
*/
|
||||
const wxUint32 GetPackedPadName() const { return m_NumPadName; }
|
||||
|
||||
/*!
|
||||
* Function IncrementItemReference
|
||||
* Implementation of the generic "reference" incrementing interface
|
||||
|
|
Loading…
Reference in New Issue