CvPcb pin count filtering improvement. (fixes lp:1188325)

* Add option to MODULE::GetPadCount() to exclude non-plated through holes.
This commit is contained in:
Wayne Stambaugh 2013-06-07 09:17:52 -04:00
parent 9929919b59
commit ecbe947bc6
3 changed files with 32 additions and 3 deletions

View File

@ -99,7 +99,7 @@ bool FOOTPRINT_LIST::ReadFootprintFiles( wxArrayString& aFootprintsLibNames )
fpinfo->SetLibraryName( filename.GetName() );
fpinfo->SetLibraryPath( filename.GetFullPath() );
fpinfo->m_Module = fpnames[i];
fpinfo->m_padCount = m->GetPadCount();
fpinfo->m_padCount = m->GetPadCount( MODULE::DO_NOT_INCLUDE_NPTH );
fpinfo->m_KeyWord = m->GetKeywords();
fpinfo->m_Doc = m->GetDescription();
@ -163,7 +163,7 @@ bool FOOTPRINT_LIST::ReadFootprintFiles( FP_LIB_TABLE& aTable )
fpinfo->SetLibraryName( libNickNames[ii] );
fpinfo->SetLibraryPath( path );
fpinfo->m_Module = fpnames[i];
fpinfo->m_padCount = m->GetPadCount();
fpinfo->m_padCount = m->GetPadCount( MODULE::DO_NOT_INCLUDE_NPTH );
fpinfo->m_KeyWord = m->GetKeywords();
fpinfo->m_Doc = m->GetDescription();

View File

@ -603,6 +603,25 @@ D_PAD* MODULE::GetPad( const wxPoint& aPosition, LAYER_MSK aLayerMask )
}
unsigned MODULE::GetPadCount( INCLUDE_NPTH_T aIncludeNPTH ) const
{
if( aIncludeNPTH )
return m_Pads.GetCount();
unsigned cnt = 0;
for( D_PAD* pad = m_Pads; pad; pad = pad->Next() )
{
if( pad->GetAttribute() == PAD_HOLE_NOT_PLATED )
continue;
cnt++;
}
return cnt;
}
void MODULE::Add3DModel( S3D_MASTER* a3DModel )
{
a3DModel->SetParent( this );

View File

@ -384,11 +384,21 @@ public:
*/
D_PAD* GetPad( const wxPoint& aPosition, LAYER_MSK aLayerMask = ALL_LAYERS );
enum INCLUDE_NPTH_T
{
DO_NOT_INCLUDE_NPTH = false,
INCLUDE_NPTH = true
};
/**
* GetPadCount
* returns the number of pads.
*
* @param aIncludeNPTH includes non-plated through holes when true. Does not include
* non-plated through holes when false.
* @return the number of pads according to \a aIncludeNPTH.
*/
unsigned GetPadCount() const { return m_Pads.GetCount() ; }
unsigned GetPadCount( INCLUDE_NPTH_T aIncludeNPTH = INCLUDE_NPTH ) const;
double GetArea() const { return m_Surface; }