Correct node/pad count in pcbnew

Pads count all pads/pins on the board including unconnected and NPTH.
Nodes count only the pads that can connect to a net and are therefore
routable.  These were being calculated as the same number (displayed in
the info bar at the bottom of the screen)
This commit is contained in:
Seth Hillbrand 2018-05-12 10:07:04 -07:00
parent ff1802d7a1
commit 5dbfa6a9c1
2 changed files with 20 additions and 6 deletions

View File

@ -1019,9 +1019,17 @@ int BOARD::GetNumSegmZone() const
}
unsigned BOARD::GetNodesCount() const
unsigned BOARD::GetNodesCount()
{
return m_connectivity->GetPadCount();
unsigned retval = 0;
for( auto mod : Modules() )
{
for( auto pad : mod->Pads() )
if( pad->GetNetCode() > 0 )
retval++;
}
return retval;
}
@ -2941,9 +2949,15 @@ const std::vector<D_PAD*> BOARD::GetPads()
}
unsigned BOARD::GetPadCount() const
unsigned BOARD::GetPadCount()
{
return m_connectivity->GetPadCount();
unsigned retval = 0;
for( auto mod : Modules() )
{
retval += mod->Pads().Size();
}
return retval;
}

View File

@ -691,7 +691,7 @@ public:
* Function GetNodesCount
* @return the number of pads members of nets (i.e. with netcode > 0)
*/
unsigned GetNodesCount() const;
unsigned GetNodesCount();
/**
* Function GetUnconnectedNetCount
@ -703,7 +703,7 @@ public:
* Function GetPadCount
* @return the number of pads in board
*/
unsigned GetPadCount() const;
unsigned GetPadCount();
/**
* Function GetPad