21#ifndef KICAD_PADSTACK_H 
   22#define KICAD_PADSTACK_H 
  265    void Serialize( google::protobuf::Any &aContainer ) 
const override;
 
  266    bool Deserialize( 
const google::protobuf::Any &aContainer ) 
override;
 
  299    wxString 
Name() 
const;
 
  338    std::optional<bool> 
IsCapped() 
const;
 
  340    std::optional<bool> 
IsFilled() 
const;
 
  447    void AppendPrimitives( 
const std::vector<std::shared_ptr<PCB_SHAPE>>& aPrimitivesList,
 
  456    void ReplacePrimitives( 
const std::vector<std::shared_ptr<PCB_SHAPE>>& aPrimitivesList,
 
 
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
 
Represent basic circle geometry with utility geometry functions.
 
LSET is a set of PCB_LAYER_IDs.
 
A PADSTACK defines the characteristics of a single or multi-layer pad, in the IPC sense of the word.
 
std::optional< bool > IsFilled() const
 
const DRILL_PROPS & Drill() const
 
bool operator==(const PADSTACK &aOther) const
 
CUSTOM_SHAPE_ZONE_MODE CustomShapeInZoneMode() const
 
void SetCustomShapeInZoneMode(CUSTOM_SHAPE_ZONE_MODE aM)
 
std::optional< int > & Clearance(PCB_LAYER_ID aLayer=F_Cu)
 
void AddPrimitive(PCB_SHAPE *aShape, PCB_LAYER_ID aLayer)
Adds a custom shape primitive to the padstack.
 
void ReplacePrimitives(const std::vector< std::shared_ptr< PCB_SHAPE > > &aPrimitivesList, PCB_LAYER_ID aLayer)
Clears the existing primitive list (freeing the owned shapes) and adds copies of the given shapes to ...
 
void packCopperLayer(PCB_LAYER_ID aLayer, kiapi::board::types::PadStack &aProto) const
 
bool Deserialize(const google::protobuf::Any &aContainer) override
Deserializes the given protobuf message into this object.
 
MASK_LAYER_PROPS & FrontOuterLayers()
 
double Similarity(const PADSTACK &aOther) const
Return a measure of how likely the other object is to represent the same object.
 
int RoundRectRadius(PCB_LAYER_ID aLayer) const
 
void SetDrillShape(PAD_DRILL_SHAPE aShape)
 
std::optional< double > & SolderPasteMarginRatio(PCB_LAYER_ID aLayer=F_Cu)
 
wxString m_customName
! An override for the IPC-7351 padstack name
 
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::...
 
void SetThermalSpokeAngle(EDA_ANGLE aAngle, PCB_LAYER_ID aLayer=F_Cu)
 
void SetRoundRectRadiusRatio(double aRatio, PCB_LAYER_ID aLayer)
 
UNCONNECTED_LAYER_MODE m_unconnectedLayerMode
 
void ClearPrimitives(PCB_LAYER_ID aLayer)
 
void SetUnconnectedLayerMode(UNCONNECTED_LAYER_MODE aMode)
 
std::optional< bool > IsTented(PCB_LAYER_ID aSide) const
Checks if this padstack is tented (covered in soldermask) on the given side.
 
std::optional< int > & ThermalSpokeWidth(PCB_LAYER_ID aLayer=F_Cu)
 
std::optional< int > & SolderPasteMargin(PCB_LAYER_ID aLayer=F_Cu)
 
void SetOrientation(EDA_ANGLE aAngle)
 
const MASK_LAYER_PROPS & BackOuterLayers() const
 
std::optional< int > & SolderMaskMargin(PCB_LAYER_ID aLayer=F_Cu)
 
void SetChamferRatio(double aRatio, PCB_LAYER_ID aLayer)
 
const LSET & LayerSet() const
 
PCB_LAYER_ID EffectiveLayerFor(PCB_LAYER_ID aLayer) const
Determines which geometry layer should be used for the given input layer.
 
PADSTACK & operator=(const PADSTACK &aOther)
 
void SetShape(PAD_SHAPE aShape, PCB_LAYER_ID aLayer)
 
EDA_ANGLE DefaultThermalSpokeAngleForShape(PCB_LAYER_ID aLayer=F_Cu) const
 
VECTOR2I & TrapezoidDeltaSize(PCB_LAYER_ID aLayer)
 
DRILL_PROPS m_secondaryDrill
! Secondary drill, used to define back-drilling
 
VECTOR2I & Offset(PCB_LAYER_ID aLayer)
 
MASK_LAYER_PROPS m_backMaskProps
! The overrides applied to back outer technical layers
 
COPPER_LAYER_PROPS & CopperLayer(PCB_LAYER_ID aLayer)
 
EDA_ANGLE ThermalSpokeAngle(PCB_LAYER_ID aLayer=F_Cu) const
 
void FlipLayers(int aCopperLayerCount)
Flips the padstack layers in the case that the pad's parent footprint is flipped to the other side of...
 
CUSTOM_SHAPE_ZONE_MODE m_customShapeInZoneMode
How to build the custom shape in zone, to create the clearance area: CUSTOM_SHAPE_ZONE_MODE::OUTLINE ...
 
bool unpackCopperLayer(const kiapi::board::types::PadStackLayer &aProto)
 
PAD_DRILL_SHAPE DrillShape() const
 
void SetChamferPositions(int aPositions, PCB_LAYER_ID aLayer)
 
void SetRoundRectRadius(double aRadius, PCB_LAYER_ID aLayer)
 
std::optional< bool > IsPlugged(PCB_LAYER_ID aSide) const
 
const MASK_LAYER_PROPS & FrontOuterLayers() const
 
UNCONNECTED_LAYER_MODE UnconnectedLayerMode() const
 
LSET RelevantShapeLayers(const PADSTACK &aOther) const
Returns the set of layers that must be considered if checking one padstack against another.
 
std::optional< int > & ThermalGap(PCB_LAYER_ID aLayer=F_Cu)
 
PAD_SHAPE Shape(PCB_LAYER_ID aLayer) const
 
void SetAnchorShape(PAD_SHAPE aShape, PCB_LAYER_ID aLayer)
 
BOARD_ITEM * m_parent
! The BOARD_ITEM this PADSTACK belongs to; will be used as the parent for owned shapes
 
PADSTACK(BOARD_ITEM *aParent)
 
std::optional< bool > IsCapped() const
 
std::vector< PCB_LAYER_ID > UniqueLayers() const
 
LSET m_layerSet
! The board layers that this padstack is active on
 
std::unordered_map< PCB_LAYER_ID, COPPER_LAYER_PROPS > m_copperProps
! The properties applied to copper layers if they aren't overridden
 
static int Compare(const PADSTACK *aPadstackRef, const PADSTACK *aPadstackCmp)
Compare two padstacks and return 0 if they are equal.
 
PCB_LAYER_ID EndLayer() const
 
const DRILL_PROPS & SecondaryDrill() const
 
std::optional< bool > IsCovered(PCB_LAYER_ID aSide) const
 
int & ChamferPositions(PCB_LAYER_ID aLayer)
 
MASK_LAYER_PROPS m_frontMaskProps
! The overrides applied to front outer technical layers
 
const VECTOR2I & Size(PCB_LAYER_ID aLayer) const
 
virtual ~PADSTACK()=default
 
MODE
! Copper geometry mode: controls how many unique copper layer shapes this padstack has
 
@ CUSTOM
Shapes can be defined on arbitrary layers.
 
@ FRONT_INNER_BACK
Up to three shapes can be defined (F_Cu, inner copper layers, B_Cu)
 
void AppendPrimitives(const std::vector< std::shared_ptr< PCB_SHAPE > > &aPrimitivesList, PCB_LAYER_ID aLayer)
Appends a copy of each shape in the given list to this padstack's custom shape list.
 
DRILL_PROPS & SecondaryDrill()
 
double RoundRectRadiusRatio(PCB_LAYER_ID aLayer) const
 
UNCONNECTED_LAYER_MODE
! Whether or not to remove the copper shape for unconnected layers
 
@ REMOVE_EXCEPT_START_AND_END
 
PCB_LAYER_ID StartLayer() const
 
bool operator!=(const PADSTACK &aOther) const
 
PAD_SHAPE AnchorShape(PCB_LAYER_ID aLayer) const
 
MASK_LAYER_PROPS & BackOuterLayers()
 
void Serialize(google::protobuf::Any &aContainer) const override
Serializes this object to the given Any message.
 
wxString Name() const
! Returns the name of this padstack in IPC-7351 format
 
void SetSize(const VECTOR2I &aSize, PCB_LAYER_ID aLayer)
 
double ChamferRatio(PCB_LAYER_ID aLayer) const
 
static constexpr PCB_LAYER_ID ALL_LAYERS
! Temporary layer identifier to identify code that is not padstack-aware
 
EDA_ANGLE GetOrientation() const
 
static constexpr PCB_LAYER_ID INNER_LAYERS
! The layer identifier to use for "inner layers" on top/inner/bottom padstacks
 
void SetLayerSet(const LSET &aSet)
 
std::optional< ZONE_CONNECTION > & ZoneConnection(PCB_LAYER_ID aLayer=F_Cu)
 
@ NORMAL
Padstack for a footprint pad.
 
@ MOUNTING
A mounting hole (plated or unplated, not associated with a footprint)
 
MODE m_mode
! The copper layer variation mode this padstack is in
 
EDA_ANGLE m_orientation
! The rotation of the pad relative to an outer reference frame
 
std::vector< std::shared_ptr< PCB_SHAPE > > & Primitives(PCB_LAYER_ID aLayer)
 
A round rectangle shape, based on a rectangle and a radius.
 
Interface for objects that can be serialized to Protobuf messages.
 
PCB_LAYER_ID
A quick note on layer IDs:
 
PAD_DRILL_SHAPE
The set of pad drill shapes, used with PAD::{Set,Get}DrillShape()
 
PAD_ATTRIB
The set of pad shapes, used with PAD::{Set,Get}Attribute().
 
@ 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()
 
PAD_PROP
The set of pad properties used in Gerber files (Draw files, and P&P files) to define some properties ...
 
@ 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.
 
#define DECLARE_ENUM_TO_WXANY(type)
 
The features of a padstack that can vary between copper layers All parameters are optional; leaving t...
 
std::optional< ZONE_CONNECTION > zone_connection
 
std::optional< int > thermal_spoke_width
 
std::vector< std::shared_ptr< PCB_SHAPE > > custom_shapes
 
bool operator==(const COPPER_LAYER_PROPS &aOther) const
 
std::optional< EDA_ANGLE > thermal_spoke_angle
 
std::optional< int > clearance
 
std::optional< int > thermal_gap
 
! The properties of a padstack drill. Drill position is always the pad position (origin).
 
bool operator==(const DRILL_PROPS &aOther) const
 
VECTOR2I size
Drill diameter (x == y) or slot dimensions (x != y)
 
std::optional< bool > is_capped
True if the drill hole should be capped.
 
std::optional< bool > is_filled
True if the drill hole should be filled completely.
 
bool operator==(const MASK_LAYER_PROPS &aOther) const
 
std::optional< int > solder_mask_margin
 
std::optional< bool > has_covering
True if the pad on this side should have covering.
 
std::optional< int > solder_paste_margin
 
std::optional< double > solder_paste_margin_ratio
 
std::optional< bool > has_solder_mask
True if this outer layer has mask (is not tented)
 
std::optional< bool > has_solder_paste
True if this outer layer has solder paste.
 
std::optional< bool > has_plugging
True if the drill hole should be plugged on this side.
 
! The set of properties that define a pad's shape on a given layer
 
int chamfered_rect_positions
 
VECTOR2I trapezoid_delta_size
Delta for PAD_SHAPE::TRAPEZOID; half the delta squeezes one end and half expands the other.
 
double round_rect_corner_radius
 
VECTOR2I offset
Offset of the shape center from the pad center.
 
bool operator==(const SHAPE_PROPS &aOther) const
 
VECTOR2I size
Size of the shape, or of the anchor pad for custom shape pads.
 
double chamfered_rect_ratio
Size of chamfer: ratio of smallest of X,Y size.
 
double round_rect_radius_ratio
 
PAD_SHAPE shape
Shape of the pad.
 
PAD_SHAPE anchor_shape
Shape of the anchor when shape == PAD_SHAPE::CUSTOM.
 
VECTOR2< int32_t > VECTOR2I