KiCad PCB EDA Suite
kicad_plugin.cpp File Reference
#include <fctsys.h>
#include <common.h>
#include <build_version.h>
#include <macros.h>
#include <wildcards_and_files_ext.h>
#include <advanced_config.h>
#include <base_units.h>
#include <trace_helpers.h>
#include <class_board.h>
#include <class_module.h>
#include <class_pcb_text.h>
#include <class_dimension.h>
#include <class_track.h>
#include <class_zone.h>
#include <class_drawsegment.h>
#include <class_pcb_target.h>
#include <class_edge_mod.h>
#include <zones.h>
#include <kicad_plugin.h>
#include <pcb_parser.h>
#include <pcbnew_settings.h>
#include <wx/dir.h>
#include <wx/filename.h>
#include <wx/wfstream.h>
#include <boost/ptr_container/ptr_map.hpp>
#include <memory.h>
#include <connectivity/connectivity_data.h>
#include <convert_basic_shapes_to_polygon.h>
#include <kiface_i.h>

Go to the source code of this file.


 FP_CACHE_ITEM is helper class for creating a footprint library cache. More...
class  FP_CACHE


typedef boost::ptr_map< wxString, FP_CACHE_ITEMMODULE_MAP
typedef MODULE_MAP::iterator MODULE_ITER
typedef MODULE_MAP::const_iterator MODULE_CITER


void filterNetClass (const BOARD &aBoard, NETCLASS &aNetClass)

Removes empty nets (i.e. with node count equal zero) from net classes


Typedef Documentation


typedef MODULE_MAP::const_iterator MODULE_CITER

Definition at line 105 of file kicad_plugin.cpp.


typedef MODULE_MAP::iterator MODULE_ITER

Definition at line 104 of file kicad_plugin.cpp.


typedef boost::ptr_map< wxString, FP_CACHE_ITEM > MODULE_MAP

Definition at line 103 of file kicad_plugin.cpp.

Function Documentation

◆ filterNetClass()

void filterNetClass ( const BOARD aBoard,

Removes empty nets (i.e. with node count equal zero) from net classes

Definition at line 60 of file kicad_plugin.cpp.

61 {
62  auto connectivity = aBoard.GetConnectivity();
64  for( NETCLASS::iterator it = aNetClass.begin(); it != aNetClass.end(); )
65  {
66  NETINFO_ITEM* netinfo = aBoard.FindNet( *it );
68  if( netinfo && connectivity->GetNodeCount( netinfo->GetNet() ) <= 0 ) // hopefully there are no nets with negative
69  aNetClass.Remove( it++ ); // node count, but you never know..
70  else
71  ++it;
72  }
73 }
NETINFO_ITEM * FindNet(int aNetcode) const
Function FindNet searches for a net with the given netcode.
iterator begin()
Definition: netclass.h:128
STRINGSET::iterator iterator
Definition: netclass.h:127
iterator end()
Definition: netclass.h:129
std::shared_ptr< CONNECTIVITY_DATA > GetConnectivity() const
Function GetConnectivity() returns list of missing connections between components/tracks.
Definition: class_board.h:355
NETINFO_ITEM handles the data for a net.
Definition: netinfo.h:65
void Remove(iterator aName)
Function Remove will remove NET name aName from the collection of members.
Definition: netclass.h:139
int GetNet() const
Function GetNet.
Definition: netinfo.h:223

References NETCLASS::begin(), NETCLASS::end(), BOARD::FindNet(), BOARD::GetConnectivity(), NETINFO_ITEM::GetNet(), and NETCLASS::Remove().