Browse Source

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)
pull/17/head
Seth Hillbrand 8 years ago
parent
commit
5dbfa6a9c1
  1. 22
      pcbnew/class_board.cpp
  2. 4
      pcbnew/class_board.h

22
pcbnew/class_board.cpp

@ -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;
}

4
pcbnew/class_board.h

@ -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

Loading…
Cancel
Save