KiCad PCB EDA Suite
pad_tool.cpp File Reference

Go to the source code of this file.

Functions

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

Function Documentation

◆ doPushPadProperties()

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

Definition at line 189 of file pad_tool.cpp.

195{
196 const FOOTPRINT* refFootprint = aSrcPad.GetParent();
197
198 EDA_ANGLE srcPadAngle = aSrcPad.GetOrientation() - refFootprint->GetOrientation();
199
200 for( FOOTPRINT* footprint : board.Footprints() )
201 {
202 if( !aSameFootprints && ( footprint != refFootprint ) )
203 continue;
204
205 if( footprint->GetFPID() != refFootprint->GetFPID() )
206 continue;
207
208 for( PAD* pad : footprint->Pads() )
209 {
210 if( aPadShapeFilter && ( pad->GetShape() != aSrcPad.GetShape() ) )
211 continue;
212
213 EDA_ANGLE padAngle = pad->GetOrientation() - footprint->GetOrientation();
214
215 if( aPadOrientFilter && ( padAngle != srcPadAngle ) )
216 continue;
217
218 if( aPadLayerFilter && ( pad->GetLayerSet() != aSrcPad.GetLayerSet() ) )
219 continue;
220
221 if( aPadTypeFilter && ( pad->GetAttribute() != aSrcPad.GetAttribute() ) )
222 continue;
223
224 // Special-case for aperture pads
225 if( aPadTypeFilter && pad->GetAttribute() == PAD_ATTRIB::CONN )
226 {
227 if( pad->IsAperturePad() != aSrcPad.IsAperturePad() )
228 continue;
229 }
230
231 commit.Modify( pad );
232
233 // Apply source pad settings to this pad
234 pad->ImportSettingsFrom( aSrcPad );
235 }
236 }
237}
FOOTPRINTS & Footprints()
Definition: board.h:311
COMMIT & Modify(EDA_ITEM *aItem)
Create an undo entry for an item that has been already modified.
Definition: commit.h:103
EDA_ANGLE GetOrientation() const
Definition: footprint.h:191
const LIB_ID & GetFPID() const
Definition: footprint.h:212
Definition: pad.h:60
bool IsAperturePad() const
Definition: pad.h:408
LSET GetLayerSet() const override
Return a std::bitset of all layers on which the item physically resides.
Definition: pad.h:398
PAD_ATTRIB GetAttribute() const
Definition: pad.h:401
FOOTPRINT * GetParent() const
Definition: pad.cpp:1471
PAD_SHAPE GetShape() const
Definition: pad.h:195
EDA_ANGLE GetOrientation() const
Return the rotation angle of the pad.
Definition: pad.h:371
@ CONN
Like smd, does not appear on the solder paste layer (default)

References CONN, BOARD::Footprints(), PAD::GetAttribute(), FOOTPRINT::GetFPID(), PAD::GetLayerSet(), FOOTPRINT::GetOrientation(), PAD::GetOrientation(), PAD::GetParent(), PAD::GetShape(), PAD::IsAperturePad(), COMMIT::Modify(), and pad.

Referenced by PAD_TOOL::pushPadSettings().