KiCad PCB EDA Suite
pad_tool.cpp File Reference

Go to the source code of this file.

Classes

class  PAD_CONTEXT_MENU
 
struct  PAD_CONTEXT_MENU::ENABLEMENTS
 

Functions

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

Function Documentation

◆ doPushPadProperties()

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

Definition at line 236 of file pad_tool.cpp.

241 {
242  const MODULE* moduleRef = aSrcPad.GetParent();
243 
244  double pad_orient = aSrcPad.GetOrientation() - moduleRef->GetOrientation();
245 
246  for( auto module : board.Modules() )
247  {
248  if( !aSameFootprints && ( module != moduleRef ) )
249  continue;
250 
251  if( module->GetFPID() != moduleRef->GetFPID() )
252  continue;
253 
254  for( auto pad : module->Pads() )
255  {
256  if( aPadShapeFilter && ( pad->GetShape() != aSrcPad.GetShape() ) )
257  continue;
258 
259  double currpad_orient = pad->GetOrientation() - module->GetOrientation();
260 
261  if( aPadOrientFilter && ( currpad_orient != pad_orient ) )
262  continue;
263 
264  if( aPadLayerFilter && ( pad->GetLayerSet() != aSrcPad.GetLayerSet() ) )
265  continue;
266 
267  if( aPadLayerFilter && ( pad->GetLayerSet() != aSrcPad.GetLayerSet() ) )
268  continue;
269 
270  commit.Modify( pad );
271 
272  // Apply source pad settings to this pad
273  pad->ImportSettingsFrom( aSrcPad );
274  }
275  }
276 }
double GetOrientation() const
Definition: class_module.h:193
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:197
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
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
PAD_SHAPE_T GetShape() const
Function GetShape.
Definition: class_pad.h:221

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

Referenced by PAD_TOOL::pushPadSettings().