KiCad PCB EDA Suite
pad_tool.cpp File Reference

Go to the source code of this file.

Functions

static void doPushPadProperties (BOARD &board, const D_PAD &aSrcPad, BOARD_COMMIT &commit, bool aSameFootprints, bool aPadShapeFilter, bool aPadOrientFilter, bool aPadLayerFilter, bool aPadTypeFilter)
 

Function Documentation

◆ doPushPadProperties()

static void doPushPadProperties ( BOARD board,
const D_PAD aSrcPad,
BOARD_COMMIT commit,
bool  aSameFootprints,
bool  aPadShapeFilter,
bool  aPadOrientFilter,
bool  aPadLayerFilter,
bool  aPadTypeFilter 
)
static

Definition at line 135 of file pad_tool.cpp.

141 {
142  const MODULE* moduleRef = aSrcPad.GetParent();
143 
144  double pad_orient = aSrcPad.GetOrientation() - moduleRef->GetOrientation();
145 
146  for( auto module : board.Modules() )
147  {
148  if( !aSameFootprints && ( module != moduleRef ) )
149  continue;
150 
151  if( module->GetFPID() != moduleRef->GetFPID() )
152  continue;
153 
154  for( auto pad : module->Pads() )
155  {
156  if( aPadShapeFilter && ( pad->GetShape() != aSrcPad.GetShape() ) )
157  continue;
158 
159  double currpad_orient = pad->GetOrientation() - module->GetOrientation();
160 
161  if( aPadOrientFilter && ( currpad_orient != pad_orient ) )
162  continue;
163 
164  if( aPadLayerFilter && ( pad->GetLayerSet() != aSrcPad.GetLayerSet() ) )
165  continue;
166 
167  if( aPadTypeFilter && ( pad->GetAttribute() != aSrcPad.GetAttribute() ) )
168  continue;
169 
170  // Special-case for aperture pads
171  if( aPadTypeFilter && pad->GetAttribute() == PAD_ATTRIB_CONN )
172  {
173  if( pad->IsAperturePad() != aSrcPad.IsAperturePad() )
174  continue;
175  }
176 
177  commit.Modify( pad );
178 
179  // Apply source pad settings to this pad
180  pad->ImportSettingsFrom( aSrcPad );
181  }
182  }
183 }
double GetOrientation() const
Definition: class_module.h:202
COMMIT & Modify(EDA_ITEM *aItem)
Modifies a given item in the model.
Definition: commit.h:103
const LIB_ID & GetFPID() const
Definition: class_module.h:206
PAD_ATTR_T GetAttribute() const
Definition: class_pad.h:429
MODULES & Modules()
Definition: class_board.h:236
LSET GetLayerSet() const override
Function GetLayerSet returns a "layer mask", which is a bitmap of all layers on which the TRACK segme...
Definition: class_pad.h:426
Like smd, does not appear on the solder paste layer (default) note also has a special attribute in Ge...
Definition: pad_shapes.h:63
MODULE * GetParent() const
Definition: class_pad.h:167
double GetOrientation() const
Function GetOrientation returns the rotation angle of the pad in tenths of degrees,...
Definition: class_pad.h:406
bool IsAperturePad() const
Definition: class_pad.h:433
PAD_SHAPE_T GetShape() const
Function GetShape.
Definition: class_pad.h:221

References D_PAD::GetAttribute(), MODULE::GetFPID(), D_PAD::GetLayerSet(), MODULE::GetOrientation(), D_PAD::GetOrientation(), D_PAD::GetParent(), D_PAD::GetShape(), D_PAD::IsAperturePad(), COMMIT::Modify(), BOARD::Modules(), and PAD_ATTRIB_CONN.

Referenced by PAD_TOOL::pushPadSettings().