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

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

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