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 ,
  UNEXPECTED_HOLE , MULTIPLE_COPPER_LAYERS , MASK_WRONG_SIDE , 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 , NON_COMPONENT_NO_COPPER , NON_COMPONENT_TECH_ON_INNER , NON_COMPONENT_INNER_NEEDS_CUSTOM_STACKUP
}
 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.
 
wxString GetPadAttributeString (PAD_ATTRIB aAttrib)
 Get the human-readable string for a pad attribute.
 
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 128 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 
UNEXPECTED_HOLE 
MULTIPLE_COPPER_LAYERS 
MASK_WRONG_SIDE 
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 
NON_COMPONENT_NO_COPPER 
NON_COMPONENT_TECH_ON_INNER 
NON_COMPONENT_INNER_NEEDS_CUSTOM_STACKUP 

Definition at line 81 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.

Check single-sided copper pads have mask and paste layers on the same side. Applies to SMD, CONN, NON_COMPONENT

Definition at line 269 of file pad_utils.cpp.

References _, LSET::AllCuMask(), B_Cu, B_Mask, B_Paste, BGA, BGA_NOT_SMD, CASTELLATED, CASTELLATED_NOT_PTH, CONN, CONN_HAS_PASTE, EXPAND_INNER_LAYERS, LSET::ExternalCuMask(), F_Cu, F_Mask, F_Paste, FIDUCIAL_GLBL, FIDUCIAL_LOCAL, FIDUCIAL_NOT_PLATED, PADSTACK::ForEachUniqueLayer(), PAD::GetAttribute(), PAD::GetDrillShape(), PAD::GetDrillSize(), PAD::GetLayerSet(), GetPadAttributeString(), BOARD_ITEM::GetParentFootprint(), PAD::GetProperty(), FOOTPRINT::GetStackupMode(), PAD::HasDrilledHole(), HEATSINK, HEATSINK_NOT_PLATED, LSET::InternalCuMask(), PAD::IsOnLayer(), KI_FALLTHROUGH, MASK_WRONG_SIDE, MECHANICAL, MECHANICAL_NOT_PTH, MULTIPLE_COPPER_LAYERS, NON_COMPONENT, NON_COMPONENT_INNER_NEEDS_CUSTOM_STACKUP, NON_COMPONENT_NO_COPPER, NON_COMPONENT_TECH_ON_INNER, NPTH, OBLONG, PAD_NO_OUTER_COPPER, PAD::Padstack(), PASTE_WRONG_SIDE, PRESSFIT, PRESSFIT_NOT_PTH, PTH, PTH_NO_OUTER_COPPER, SMD, TESTPOINT, TESTPOINT_NOT_PLATED, TH_NO_HOLE, UNEXPECTED_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 37 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().

◆ GetPadAttributeString()

wxString PAD_UTILS::GetPadAttributeString ( PAD_ATTRIB aAttrib)

Get the human-readable string for a pad attribute.

Used for UI display and error messages.

Note: you have to handle 'aperture' outside this function.

Definition at line 68 of file pad_utils.cpp.

References _, CONN, NON_COMPONENT, NPTH, PTH, and SMD.

Referenced by CheckPad(), and GetPadTypeString().

◆ 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 51 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 58 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().