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 140 of file pad_tool.cpp.

146 {
147  const MODULE* moduleRef = aSrcPad.GetParent();
148 
149  double pad_orient = aSrcPad.GetOrientation() - moduleRef->GetOrientation();
150 
151  for( auto module : board.Modules() )
152  {
153  if( !aSameFootprints && ( module != moduleRef ) )
154  continue;
155 
156  if( module->GetFPID() != moduleRef->GetFPID() )
157  continue;
158 
159  for( auto pad : module->Pads() )
160  {
161  if( aPadShapeFilter && ( pad->GetShape() != aSrcPad.GetShape() ) )
162  continue;
163 
164  double currpad_orient = pad->GetOrientation() - module->GetOrientation();
165 
166  if( aPadOrientFilter && ( currpad_orient != pad_orient ) )
167  continue;
168 
169  if( aPadLayerFilter && ( pad->GetLayerSet() != aSrcPad.GetLayerSet() ) )
170  continue;
171 
172  if( aPadTypeFilter && ( pad->GetAttribute() != aSrcPad.GetAttribute() ) )
173  continue;
174 
175  // Special-case for aperture pads
176  if( aPadTypeFilter && pad->GetAttribute() == PAD_ATTRIB_CONN )
177  {
178  if( pad->IsAperturePad() != aSrcPad.IsAperturePad() )
179  continue;
180  }
181 
182  commit.Modify( pad );
183 
184  // Apply source pad settings to this pad
185  pad->ImportSettingsFrom( aSrcPad );
186  }
187  }
188 }
double GetOrientation() const
Definition: class_module.h:215
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:219
PAD_ATTR_T GetAttribute() const
Definition: class_pad.h:445
MODULES & Modules()
Definition: class_board.h:226
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:442
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:422
bool IsAperturePad() const
Definition: class_pad.h:452
PAD_SHAPE_T GetShape() const
Function GetShape.
Definition: class_pad.h:237

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().