KiCad PCB EDA Suite
Loading...
Searching...
No Matches
PAD_UTILS Namespace Reference

Classes

struct  PAD_CHECK_RESULT
 A single finding from CheckPad(). More...
 

Typedefs

using PAD_CHECK_HANDLER = std::function<void( const PAD_CHECK_RESULT& )>
 

Enumerations

enum class  PAD_CHECK_CODE {
  PAD_SIZE_NOT_POSITIVE , PTH_HOLE_TOO_SMALL , PTH_HOLE_LEAVES_NO_COPPER , PTH_HOLE_NOT_INSIDE_COPPER ,
  HOLE_NOT_INSIDE_PAD , NEGATIVE_LOCAL_CLEARANCE , NEGATIVE_MASK_CLEARANCE_TOO_LARGE , NEGATIVE_PASTE_MARGIN_TOO_LARGE ,
  ROUNDRECT_RADIUS_NEGATIVE , ROUNDRECT_RADIUS_TOO_LARGE , CHAMFER_NEGATIVE , CHAMFER_TOO_LARGE ,
  TRAPEZOID_DELTA_TOO_LARGE , CUSTOM_SHAPE_NOT_SINGLE_POLYGON , TH_NO_HOLE , PTH_NO_OUTER_COPPER ,
  SMD_HAS_HOLE , SMD_BOTH_OUTER_SIDES , SMD_MASK_WRONG_SIDE , SMD_PASTE_WRONG_SIDE ,
  PAD_NO_OUTER_COPPER , CONN_HAS_PASTE , FIDUCIAL_NOT_PLATED , TESTPOINT_NOT_PLATED ,
  HEATSINK_NOT_PLATED , CASTELLATED_NOT_PTH , BGA_NOT_SMD , MECHANICAL_NOT_PTH ,
  PRESSFIT_NOT_PTH
}
 A specific pad check finding reason. More...
 

Functions

bool PadHasMeaningfulRoundingRadius (const PAD &aPad, PCB_LAYER_ID aLayer)
 Returns true if the pad's rounding ratio is valid (i.e.
 
double GetDefaultIpcRoundingRatio (const PAD &aPad, PCB_LAYER_ID aLayer)
 Get a sensible default for a rounded rectangle pad's rounding ratio.
 
void RemoveAllDrillsFromPadstack (PADSTACK &aPadstack)
 Remove the primary drill, the secondary and tertiary drills, and any post-machining operations from a padstack.
 
void CheckPad (const PAD &aPad, const UNITS_PROVIDER &aUnitsProvider, bool aForPadProperties, const PAD_CHECK_HANDLER &aErrorHandler)
 Run non-board-specific checks on a pad.
 

Typedef Documentation

◆ PAD_CHECK_HANDLER

using PAD_UTILS::PAD_CHECK_HANDLER = std::function<void( const PAD_CHECK_RESULT& )>

Definition at line 113 of file pad_utils.h.

Enumeration Type Documentation

◆ PAD_CHECK_CODE

enum class PAD_UTILS::PAD_CHECK_CODE
strong

A specific pad check finding reason.

Deliberately independent of the DRC error codes: this is an internal check function with granular, but not API-stable, findings. There is a function ConvertPadCheckToDrcCode() that can map these findings to DRC error codes for reporting and processing as fully-fledged DRC errors.

Any of these code can then be remapped to different or new DRC error codes more freely, and new pad codes can be added as needed without affecting existing DRCE codes.

Enumerator
PAD_SIZE_NOT_POSITIVE 
PTH_HOLE_TOO_SMALL 
PTH_HOLE_LEAVES_NO_COPPER 
PTH_HOLE_NOT_INSIDE_COPPER 
HOLE_NOT_INSIDE_PAD 
NEGATIVE_LOCAL_CLEARANCE 
NEGATIVE_MASK_CLEARANCE_TOO_LARGE 
NEGATIVE_PASTE_MARGIN_TOO_LARGE 
ROUNDRECT_RADIUS_NEGATIVE 
ROUNDRECT_RADIUS_TOO_LARGE 
CHAMFER_NEGATIVE 
CHAMFER_TOO_LARGE 
TRAPEZOID_DELTA_TOO_LARGE 
CUSTOM_SHAPE_NOT_SINGLE_POLYGON 
TH_NO_HOLE 
PTH_NO_OUTER_COPPER 
SMD_HAS_HOLE 
SMD_BOTH_OUTER_SIDES 
SMD_MASK_WRONG_SIDE 
SMD_PASTE_WRONG_SIDE 
PAD_NO_OUTER_COPPER 
CONN_HAS_PASTE 
FIDUCIAL_NOT_PLATED 
TESTPOINT_NOT_PLATED 
HEATSINK_NOT_PLATED 
CASTELLATED_NOT_PTH 
BGA_NOT_SMD 
MECHANICAL_NOT_PTH 
PRESSFIT_NOT_PTH 

Definition at line 69 of file pad_utils.h.

Function Documentation

◆ CheckPad()

void PAD_UTILS::CheckPad ( const PAD & aPad,
const UNITS_PROVIDER & aUnitsProvider,
bool aForPadProperties,
const PAD_CHECK_HANDLER & aErrorHandler )

Run non-board-specific checks on a pad.

These are the checks shared by the PCB DRC, the Footprint Editor Footprint Checker, and the pad properties dialog.

Parameters
aPadis the pad to check.
aUnitsProviderprovides unit formatting for the messages.
aForPadPropertiesenables checks that are only meaningful while editing pad properties, such as the hole being fully inside the copper.
aErrorHandlerreceives each finding.

Definition at line 251 of file pad_utils.cpp.

References _, B_Cu, B_Mask, B_Paste, BGA, BGA_NOT_SMD, CASTELLATED, CASTELLATED_NOT_PTH, CONN, CONN_HAS_PASTE, F_Cu, F_Mask, F_Paste, FIDUCIAL_GLBL, FIDUCIAL_LOCAL, FIDUCIAL_NOT_PLATED, PADSTACK::ForEachUniqueLayer(), PAD::GetAttribute(), PAD::GetDrillShape(), PAD::GetDrillSize(), PAD::GetLayerSet(), PAD::GetProperty(), PAD::HasDrilledHole(), HEATSINK, HEATSINK_NOT_PLATED, LSET::InternalCuMask(), PAD::IsOnLayer(), KI_FALLTHROUGH, MECHANICAL, MECHANICAL_NOT_PTH, NPTH, OBLONG, PAD_NO_OUTER_COPPER, PAD::Padstack(), PRESSFIT, PRESSFIT_NOT_PTH, PTH, PTH_NO_OUTER_COPPER, SMD, SMD_BOTH_OUTER_SIDES, SMD_HAS_HOLE, SMD_MASK_WRONG_SIDE, SMD_PASTE_WRONG_SIDE, TESTPOINT, TESTPOINT_NOT_PLATED, TH_NO_HOLE, VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by FOOTPRINT_UTILS::CheckPads(), DIALOG_PAD_PROPERTIES::padValuesOK(), and PAD_CHECK_FIXTURE::runPadCheckOnPad().

◆ GetDefaultIpcRoundingRatio()

double PAD_UTILS::GetDefaultIpcRoundingRatio ( const PAD & aPad,
PCB_LAYER_ID aLayer )

Get a sensible default for a rounded rectangle pad's rounding ratio.

According to IPC-7351C, this is 25%, or 0.25mm, whichever is smaller

Definition at line 35 of file pad_utils.cpp.

References PAD::GetSize(), pcbIUScale, VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by PAD_MASTER_PROVIDER::MakeDefaultPad(), DIALOG_PAD_PROPERTIES::onPadShapeSelection(), and PAD::SetFrontShape().

◆ PadHasMeaningfulRoundingRadius()

bool PAD_UTILS::PadHasMeaningfulRoundingRadius ( const PAD & aPad,
PCB_LAYER_ID aLayer )

Returns true if the pad's rounding ratio is valid (i.e.

the pad has a shape where that is meaningful)

Definition at line 49 of file pad_utils.cpp.

References CHAMFERED_RECT, PAD::GetShape(), and ROUNDRECT.

Referenced by DIALOG_PAD_PROPERTIES::DIALOG_PAD_PROPERTIES(), PAD_DESC::PAD_DESC(), and PAD::SetFrontShape().

◆ RemoveAllDrillsFromPadstack()

void PAD_UTILS::RemoveAllDrillsFromPadstack ( PADSTACK & aPadstack)

Remove the primary drill, the secondary and tertiary drills, and any post-machining operations from a padstack.

Definition at line 56 of file pad_utils.cpp.

References PADSTACK::BackPostMachining(), PADSTACK::Drill(), PADSTACK::FrontPostMachining(), PADSTACK::SecondaryDrill(), and PADSTACK::TertiaryDrill().

Referenced by PAD::ImportSettingsFrom(), PAD::SetAttribute(), and DIALOG_PAD_PROPERTIES::transferDataToPad().