Commit ecbe947b authored by Wayne Stambaugh's avatar Wayne Stambaugh

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

* Add option to MODULE::GetPadCount() to exclude non-plated through holes.
parent 9929919b
......@@ -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();
......
......@@ -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 );
......
......@@ -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; }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment