37 const double defaultProportion = 0.25;
38 const double minimumSizeIU =
pcbIUScale.mmToIU( 0.25 );
41 const int padMinSizeIU = std::min( size.
x, size.
y );
42 const double defaultRadiusIU = std::min( minimumSizeIU, padMinSizeIU * defaultProportion );
45 return defaultRadiusIU / padMinSizeIU;
58 aPadstack.
Drill() = {};
84 const int min_drill_size = 4;
89 wxString::Format(
_(
"PTH pad hole size must be larger than %s" ),
112 _(
"PTH pad hole leaves no copper" ) } );
114 else if( aForPadProperties )
124 _(
"PTH pad hole not fully inside copper" ) } );
134 _(
"pad hole not inside pad shape" ) } );
142 _(
"negative local clearance values have no effect" ) } );
150 if( solderMaskMargin.has_value() && solderMaskMargin.value() < 0 )
152 int absMargin =
abs( solderMaskMargin.value() );
156 for(
const std::shared_ptr<PCB_SHAPE>& shape : aPad.
GetPrimitives( aLayer ) )
158 BOX2I shapeBBox = shape->GetBoundingBox();
163 _(
"negative solder mask clearance is larger than some shape primitives; "
164 "results may be surprising" ) } );
170 else if( absMargin > pad_size.
x || absMargin > pad_size.
y )
173 _(
"negative solder mask clearance is larger than pad; no solder mask will "
174 "be generated" ) } );
187 paste_size.x = pad_size.
x + paste_margin +
KiROUND( pad_size.
x * mratio.value_or( 0 ) );
188 paste_size.y = pad_size.
y + paste_margin +
KiROUND( pad_size.
y * mratio.value_or( 0 ) );
190 if( paste_size.x <= 0 || paste_size.y <= 0 )
193 _(
"negative solder paste margin is larger than pad; no solder paste mask will "
194 "be generated" ) } );
202 _(
"negative corner radius is not allowed" ) } );
207 _(
"corner size will make pad circular" ) } );
215 _(
"negative corner chamfer is not allowed" ) } );
220 _(
"corner chamfer is too large" ) } );
231 _(
"trapezoid delta is too large" ) } );
243 _(
"custom pad shape must resolve to a single polygon" ) });
257 checkPadLayer( aPad, aLayer, aUnitsProvider, aForPadProperties, aErrorHandler );
263 if( !padlayers_mask[
F_Cu] && !padlayers_mask[
B_Cu] )
268 _(
"plated through holes normally have a copper pad on at least one outer layer" ) } );
307 _(
"'press-fit' pads are normally PTH with round holes" ) } );
314 if( drill_size.
x <= 0
325 _(
"connector pads normally have no solder paste; use a SMD pad instead" ) } );
331 if( drill_size.
x > 0 || drill_size.
y > 0 )
341 _(
"SMD pad has copper on both sides of the board" ) } );
348 _(
"SMD pad has copper and mask layers on different sides of the board" ) } );
353 _(
"SMD pad has copper and paste layers on different sides of the board" ) } );
361 _(
"SMD pad has copper and mask layers on different sides of the board" ) } );
366 _(
"SMD pad has copper and paste layers on different sides of the board" ) } );
369 else if( innerlayers_mask.count() != 0 )
constexpr EDA_IU_SCALE pcbIUScale
constexpr BOX2I KiROUND(const BOX2D &aBoxD)
constexpr size_type GetWidth() const
constexpr size_type GetHeight() const
constexpr const SizeVec & GetSize() const
LSET is a set of PCB_LAYER_IDs.
static const LSET & InternalCuMask()
Return a complete set of internal copper layers which is all Cu layers except F_Cu and B_Cu.
A PADSTACK defines the characteristics of a single or multi-layer pad, in the IPC sense of the word.
void ForEachUniqueLayer(const std::function< void(PCB_LAYER_ID)> &aMethod) const
Runs the given callable for each active unique copper layer in this padstack, meaning F_Cu for MODE::...
POST_MACHINING_PROPS & FrontPostMachining()
DRILL_PROPS & TertiaryDrill()
DRILL_PROPS & SecondaryDrill()
POST_MACHINING_PROPS & BackPostMachining()
PAD_PROP GetProperty() const
LSET GetLayerSet() const override
Return a std::bitset of all layers on which the item physically resides.
const std::vector< std::shared_ptr< PCB_SHAPE > > & GetPrimitives(PCB_LAYER_ID aLayer) const
Accessor to the basic shape list for custom-shaped pads.
void MergePrimitivesAsPolygon(PCB_LAYER_ID aLayer, SHAPE_POLY_SET *aMergedPolygon, ERROR_LOC aErrorLoc=ERROR_INSIDE) const
Merge all basic shapes to a SHAPE_POLY_SET.
std::shared_ptr< SHAPE_SEGMENT > GetEffectiveHoleShape(PCB_LAYER_ID aLayer=UNDEFINED_LAYER, DRC_CONSTRAINT_T aUsage=NULL_CONSTRAINT) const override
Return a SHAPE_SEGMENT object representing the pad's hole.
const BOX2I GetBoundingBox() const override
The bounding box is cached, so this will be efficient most of the time.
bool IsOnLayer(PCB_LAYER_ID aLayer) const override
Test to see if this object is on the given layer.
std::optional< double > GetLocalSolderPasteMarginRatio() const
PAD_ATTRIB GetAttribute() const
const VECTOR2I & GetDelta(PCB_LAYER_ID aLayer) const
void TransformShapeToPolygon(SHAPE_POLY_SET &aBuffer, PCB_LAYER_ID aLayer, int aClearance, int aMaxError, ERROR_LOC aErrorLoc=ERROR_INSIDE, bool aIgnoreLineWidth=false) const override
Convert the pad shape to a closed polygon.
VECTOR2I GetPosition() const override
VECTOR2I GetDrillSize() const
double GetRoundRectRadiusRatio(PCB_LAYER_ID aLayer) const
PAD_SHAPE GetShape(PCB_LAYER_ID aLayer) const
VECTOR2I GetSize(PCB_LAYER_ID aLayer) const
std::optional< int > GetLocalClearance() const override
Return any local clearances set in the "classic" (ie: pre-rule) system.
bool IsOnCopperLayer() const override
const PADSTACK & Padstack() const
PAD_DRILL_SHAPE GetDrillShape() const
std::optional< int > GetLocalSolderPasteMargin() const
std::optional< int > GetLocalSolderMaskMargin() const
double GetChamferRectRatio(PCB_LAYER_ID aLayer) const
bool HasDrilledHole() const override
Represent a set of closed polygons.
bool IsEmpty() const
Return true if the set is empty (no polygons at all)
bool Collide(const SHAPE *aShape, int aClearance=0, int *aActual=nullptr, VECTOR2I *aLocation=nullptr) const override
Check if the boundary of shape (this) lies closer to the shape aShape than aClearance,...
int OutlineCount() const
Return the number of outlines in the set.
void BooleanSubtract(const SHAPE_POLY_SET &b)
Perform boolean polyset difference.
wxString StringFromValue(double aValue, bool aAddUnitLabel=false, EDA_DATA_TYPE aType=EDA_DATA_TYPE::DISTANCE) const
Converts aValue in internal units into a united string.
void TransformOvalToPolygon(SHAPE_POLY_SET &aBuffer, const VECTOR2I &aStart, const VECTOR2I &aEnd, int aWidth, int aError, ERROR_LOC aErrorLoc, int aMinSegCount=0)
Convert a oblong shape to a polygon, using multiple segments.
PCB_LAYER_ID
A quick note on layer IDs:
#define KI_FALLTHROUGH
The KI_FALLTHROUGH macro is to be used when switch statement cases should purposely fallthrough from ...
bool PadHasMeaningfulRoundingRadius(const PAD &aPad, PCB_LAYER_ID aLayer)
Returns true if the pad's rounding ratio is valid (i.e.
void RemoveAllDrillsFromPadstack(PADSTACK &aPadstack)
Remove the primary drill, the secondary and tertiary drills, and any post-machining operations from a...
double GetDefaultIpcRoundingRatio(const PAD &aPad, PCB_LAYER_ID aLayer)
Get a sensible default for a rounded rectangle pad's rounding ratio.
void CheckPad(const PAD &aPad, const UNITS_PROVIDER &aUnitsProvider, bool aForPadProperties, const PAD_CHECK_HANDLER &aErrorHandler)
Run non-board-specific checks on a pad.
std::function< void(const PAD_CHECK_RESULT &)> PAD_CHECK_HANDLER
@ TRAPEZOID_DELTA_TOO_LARGE
@ ROUNDRECT_RADIUS_NEGATIVE
@ NEGATIVE_MASK_CLEARANCE_TOO_LARGE
@ NEGATIVE_PASTE_MARGIN_TOO_LARGE
@ CUSTOM_SHAPE_NOT_SINGLE_POLYGON
@ PTH_HOLE_LEAVES_NO_COPPER
@ ROUNDRECT_RADIUS_TOO_LARGE
@ NEGATIVE_LOCAL_CLEARANCE
@ PTH_HOLE_NOT_INSIDE_COPPER
EDA_ANGLE abs(const EDA_ANGLE &aAngle)
@ NPTH
like PAD_PTH, but not plated mechanical use only, no connection allowed
@ SMD
Smd pad, appears on the solder paste layer (default)
@ PTH
Plated through hole pad.
@ CONN
Like smd, does not appear on the solder paste layer (default) Note: also has a special attribute in G...
PAD_SHAPE
The set of pad shapes, used with PAD::{Set,Get}Shape()
@ FIDUCIAL_LOCAL
a fiducial (usually a smd) local to the parent footprint
@ FIDUCIAL_GLBL
a fiducial (usually a smd) for the full board
@ MECHANICAL
a pad used for mechanical support
@ PRESSFIT
a PTH with a hole diameter with tight tolerances for press fit pin
@ HEATSINK
a pad used as heat sink, usually in SMD footprints
@ TESTPOINT
a test point pad
@ CASTELLATED
a pad with a castellated through hole
@ BGA
Smd pad, used in BGA footprints.
VECTOR2< int32_t > VECTOR2I