28#include <api/board/board_types.pb.h>
33#include <magic_enum.hpp>
81 for( std::shared_ptr<PCB_SHAPE>& shape :
CopperLayer( aLayer ).custom_shapes )
183 bool copperMatches =
true;
189 copperMatches =
false;
192 return copperMatches;
219 if( aProto.chamfered_corners().top_left() )
222 if( aProto.chamfered_corners().top_right() )
225 if( aProto.chamfered_corners().bottom_left() )
228 if( aProto.chamfered_corners().bottom_right() )
232 google::protobuf::Any a;
234 for(
const BoardGraphicShape& shapeProto : aProto.custom_shapes() )
236 if( a.PackFrom( shapeProto ) )
238 std::unique_ptr<PCB_SHAPE> shape = std::make_unique<PCB_SHAPE>(
m_parent );
240 if( shape->Deserialize( a ) )
253 auto unpackOptional = []<
typename ProtoEnum>(
const ProtoEnum& aProto,
254 std::optional<bool>& aDest, ProtoEnum aTrueValue,
255 ProtoEnum aFalseValue )
257 if( aProto == aTrueValue )
259 else if( aProto == aFalseValue )
262 aDest = std::nullopt;
265 auto unpackPostMachining = [](
const PostMachiningProperties& aProto,
268 switch( aProto.mode() )
273 default: aDest.mode = std::nullopt;
break;
289 unpackOptional( padstack.drill().capped(),
Drill().is_capped, VDCM_CAPPED, VDCM_UNCAPPED );
290 unpackOptional( padstack.drill().filled(),
Drill().is_filled, VDFM_FILLED, VDFM_UNFILLED );
292 if( padstack.has_front_post_machining() )
295 if( padstack.has_back_post_machining() )
300 if( padstack.has_secondary_drill() )
302 const DrillProperties& secondary = padstack.secondary_drill();
309 unpackOptional( secondary.capped(),
SecondaryDrill().is_capped, VDCM_CAPPED, VDCM_UNCAPPED );
310 unpackOptional( secondary.filled(),
SecondaryDrill().is_filled, VDFM_FILLED, VDFM_UNFILLED );
322 if( padstack.has_tertiary_drill() )
324 const DrillProperties& tertiary = padstack.tertiary_drill();
331 unpackOptional( tertiary.capped(),
TertiaryDrill().is_capped, VDCM_CAPPED, VDCM_UNCAPPED );
332 unpackOptional( tertiary.filled(),
TertiaryDrill().is_filled, VDFM_FILLED, VDFM_UNFILLED );
344 for(
const PadStackLayer& layer : padstack.copper_layers() )
353 if( padstack.has_zone_settings() )
358 if( padstack.zone_settings().has_thermal_spokes() )
360 const ThermalSpokeSettings& thermals = padstack.zone_settings().thermal_spokes();
362 if( thermals.has_gap() )
365 if( thermals.has_width() )
380 unpackOptional( padstack.front_outer_layers().solder_mask_mode(),
383 unpackOptional( padstack.back_outer_layers().solder_mask_mode(),
386 unpackOptional( padstack.front_outer_layers().covering_mode(),
FrontOuterLayers().has_covering,
387 VCM_COVERED, VCM_UNCOVERED );
389 unpackOptional( padstack.back_outer_layers().covering_mode(),
BackOuterLayers().has_covering,
390 VCM_COVERED, VCM_UNCOVERED );
392 unpackOptional( padstack.front_outer_layers().plugging_mode(),
FrontOuterLayers().has_plugging,
393 VPM_PLUGGED, VPM_UNPLUGGED );
395 unpackOptional( padstack.back_outer_layers().plugging_mode(),
BackOuterLayers().has_plugging,
396 VPM_PLUGGED, VPM_UNPLUGGED );
398 unpackOptional( padstack.front_outer_layers().solder_paste_mode(),
401 unpackOptional( padstack.back_outer_layers().solder_paste_mode(),
404 if( padstack.front_outer_layers().has_solder_mask_settings()
405 && padstack.front_outer_layers().solder_mask_settings().has_solder_mask_margin() )
408 padstack.front_outer_layers().solder_mask_settings().solder_mask_margin().value_nm();
415 if( padstack.back_outer_layers().has_solder_mask_settings()
416 && padstack.back_outer_layers().solder_mask_settings().has_solder_mask_margin() )
419 padstack.back_outer_layers().solder_mask_settings().solder_mask_margin().value_nm();
426 if( padstack.front_outer_layers().has_solder_paste_settings()
427 && padstack.front_outer_layers().solder_paste_settings().has_solder_paste_margin() )
430 padstack.front_outer_layers().solder_paste_settings().solder_paste_margin().value_nm();
437 if( padstack.back_outer_layers().has_solder_paste_settings()
438 && padstack.back_outer_layers().solder_paste_settings().has_solder_paste_margin() )
441 padstack.back_outer_layers().solder_paste_settings().solder_paste_margin().value_nm();
448 if( padstack.front_outer_layers().has_solder_paste_settings()
449 && padstack.front_outer_layers().solder_paste_settings().has_solder_paste_margin_ratio() )
452 padstack.front_outer_layers().solder_paste_settings().solder_paste_margin_ratio().value();
459 if( padstack.back_outer_layers().has_solder_paste_settings()
460 && padstack.back_outer_layers().solder_paste_settings().has_solder_paste_margin_ratio() )
463 padstack.back_outer_layers().solder_paste_settings().solder_paste_margin_ratio().value();
477 kiapi::board::types::PadStack padstack;
479 if( !aContainer.UnpackTo( &padstack ) )
506 return const_cast<DRILL_PROPS*
>( std::as_const( *this ).findBackdrillDrill( aTop ) );
521 if( home.
size.
x > 0 && home.
start == otherSide )
545 if( hasTop && hasBottom )
561 [
this](
bool aTop,
bool aWant )
572 if( drill.
size.
x <= 0 )
589 return drill->size.x;
597 if( aSize.has_value() )
600 target.
size = { *aSize, *aSize };
642 padstack.mutable_angle()->set_value_degrees(
m_orientation.GetAngle().AsDegrees() );
649 if(
m_drill.is_capped.has_value() )
650 padstack.mutable_drill()->set_capped(
m_drill.is_capped.value() ? VDCM_CAPPED : VDCM_UNCAPPED );
652 if(
m_drill.is_filled.has_value() )
653 padstack.mutable_drill()->set_filled(
m_drill.is_filled.value() ? VDFM_FILLED : VDFM_UNFILLED );
657 DrillProperties* secondary = padstack.mutable_secondary_drill();
664 secondary->set_capped(
m_secondaryDrill.is_capped.value() ? VDCM_CAPPED : VDCM_UNCAPPED );
667 secondary->set_filled(
m_secondaryDrill.is_filled.value() ? VDFM_FILLED : VDFM_UNFILLED );
672 DrillProperties* tertiary = padstack.mutable_tertiary_drill();
679 tertiary->set_capped(
m_tertiaryDrill.is_capped.value() ? VDCM_CAPPED : VDCM_UNCAPPED );
682 tertiary->set_filled(
m_tertiaryDrill.is_filled.value() ? VDFM_FILLED : VDFM_UNFILLED );
686 PostMachiningProperties* aProto )
688 if( aProps.
mode.has_value() )
690 switch( aProps.
mode.value() )
713 PadStackLayer* layer = padstack.add_copper_layers();
728 layer->mutable_chamfered_corners()->set_top_left(
true );
731 layer->mutable_chamfered_corners()->set_top_right(
true );
734 layer->mutable_chamfered_corners()->set_bottom_left(
true );
737 layer->mutable_chamfered_corners()->set_bottom_right(
true );
739 for(
const std::shared_ptr<PCB_SHAPE>& shape : props.
custom_shapes )
741 google::protobuf::Any a;
742 shape->Serialize( a );
744 if( !a.UnpackTo( layer->add_custom_shapes() ) )
745 wxFAIL_MSG( wxT(
"Failed to unpack PADSTACK from internal serialization" ) );
751 padstack.mutable_zone_settings()->set_zone_connection(
757 padstack.mutable_zone_settings()->mutable_thermal_spokes()->mutable_gap()->set_value_nm(
763 padstack.mutable_zone_settings()->mutable_thermal_spokes()->mutable_width()->set_value_nm(
769 padstack.mutable_zone_settings()->mutable_thermal_spokes()->mutable_angle()->set_value_degrees(
778 padstack.mutable_front_outer_layers()->set_solder_mask_mode(
784 padstack.mutable_back_outer_layers()->set_solder_mask_mode(
785 BackOuterLayers().has_solder_mask.value() ? SMM_MASKED : SMM_UNMASKED );
790 padstack.mutable_front_outer_layers()->set_covering_mode(
796 padstack.mutable_back_outer_layers()->set_covering_mode(
797 BackOuterLayers().has_covering.value() ? VCM_COVERED : VCM_UNCOVERED );
802 padstack.mutable_front_outer_layers()->set_plugging_mode(
808 padstack.mutable_back_outer_layers()->set_plugging_mode(
809 BackOuterLayers().has_plugging.value() ? VPM_PLUGGED : VPM_UNPLUGGED );
814 padstack.mutable_front_outer_layers()->set_solder_paste_mode(
820 padstack.mutable_back_outer_layers()->set_solder_paste_mode(
821 BackOuterLayers().has_solder_paste.value() ? SPM_PASTE : SPM_NO_PASTE );
826 padstack.mutable_front_outer_layers()->mutable_solder_mask_settings()->mutable_solder_mask_margin()->set_value_nm(
832 padstack.mutable_back_outer_layers()->mutable_solder_mask_settings()->mutable_solder_mask_margin()->set_value_nm(
838 padstack.mutable_front_outer_layers()->mutable_solder_paste_settings()->mutable_solder_paste_margin()->set_value_nm(
844 padstack.mutable_back_outer_layers()->mutable_solder_paste_settings()->mutable_solder_paste_margin()->set_value_nm(
850 padstack.mutable_front_outer_layers()->mutable_solder_paste_settings()->mutable_solder_paste_margin_ratio()->set_value(
856 padstack.mutable_back_outer_layers()->mutable_solder_paste_settings()->mutable_solder_paste_margin_ratio()->set_value(
865 kiapi::board::types::PadStack padstack;
868 if( !aContainer.PackFrom( padstack ) )
869 wxFAIL_MSG( wxT(
"Failed to pack PADSTACK" ) );
981 int min_r = std::min( size.
x, size.
y );
1145 if(
CopperLayer( aLayer ).thermal_spoke_angle.has_value() )
1181 for(
const std::shared_ptr<PCB_SHAPE>& item : aList )
1185 list.emplace_back( new_shape );
1224 return const_cast<COPPER_LAYER_PROPS&
>( std::as_const( *this ).CopperLayer( aLayer ) );
1235 for( std::shared_ptr<PCB_SHAPE>& shape : inherited.
custom_shapes )
1237 shape.reset(
static_cast<PCB_SHAPE*
>( shape->Clone() ) );
1241 return m_copperProps.emplace( key, std::move( inherited ) ).first->second;
1305 std::vector<PCB_LAYER_ID> layers;
1310 layers.push_back( layer );
1365 layers.
set( layer );
1370 layers.
set( layer );
1381 return aSize.
y > 0 ? std::min( aSize.
x, aSize.
y ) : aSize.
x;
1388 if( !aProps.
mode.has_value()
1391 || aProps.
size <= 0 )
1397 double tanHalfAngle = tapered ? tan( ( aProps.
angle / 10.0 ) *
M_PI / 360.0 ) : 0.0;
1398 int depth = aProps.
depth;
1401 if( depth <= 0 && tapered )
1402 depth =
static_cast<int>( ( aProps.
size / 2.0 ) / tanHalfAngle );
1409 if( layerDist >= depth )
1412 return std::max( 0, aProps.
size -
static_cast<int>( 2.0 * layerDist * tanHalfAngle ) );
1462 maxHoleSize = std::max( maxHoleSize, frontPM.
size );
1468 maxHoleSize = std::max( maxHoleSize, backPM.
size );
1475 maxHoleSize = std::max( maxHoleSize, secondaryDrill.
size.
x );
1478 maxHoleSize = std::max( maxHoleSize, tertiaryDrill.
size.
x );
1491 return std::nullopt;
1502 return std::nullopt;
1513 return std::nullopt;
1529#define TEST( a, b ) { if( a != b ) return a - b; }
1595 double similarity = 1.0;
1655 std::unordered_map<PCB_LAYER_ID, COPPER_LAYER_PROPS> oldCopperProps =
m_copperProps;
1664 std::unordered_map<PCB_LAYER_ID, COPPER_LAYER_PROPS> oldCopperProps =
m_copperProps;
1667 for(
const auto& [layer, props] : oldCopperProps )
1709 return wxEmptyString;
1715 if( aCustomName.IsEmpty() )
1725 m_customName = std::make_unique<wxString>( aCustomName );
1782 if( !(
shape == aOther.
shape ) )
return false;
1803 double similarity = 1.0;
1830#define TEST_OPT( a, b, v ) \
1832 if( a.has_value() != b.has_value() ) \
1833 return a.has_value() - b.has_value(); \
1834 if( (int) a.value_or( v ) - (int) b.value_or( v ) != 0 ) \
1835 return (int) a.value_or( v ) - (int) b.value_or( v ); \
1838#define TEST_OPT_ORIENTATION( a, b, v ) \
1840 if( a.has_value() != b.has_value() ) \
1841 return a.has_value() - b.has_value(); \
1842 const EDA_ANGLE aVal = a.value_or( EDA_ORIENTATION( v ) ).GetAngle(); \
1843 const EDA_ANGLE bVal = b.value_or( EDA_ORIENTATION( v ) ).GetAngle(); \
1844 if( abs( aVal.AsDegrees() - bVal.AsDegrees() ) > 0.001 ) \
1845 return aVal.AsDegrees() > bVal.AsDegrees() ? 1 : -1; \
1853 if( ( diff =
shape.Compare( aOther.
shape ) ) != 0 )
KICOMMON_API types::KiCadObjectType ToProtoEnum(KICAD_T aValue)
KICOMMON_API KICAD_T FromProtoEnum(types::KiCadObjectType aValue)
constexpr BOX2I KiROUND(const BOX2D &aBoxD)
BASE_SET & set(size_t pos)
BOARD_STACKUP & GetStackupDescriptor()
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Manage layers needed to make a physical board.
int GetLayerDistance(PCB_LAYER_ID aFirstLayer, PCB_LAYER_ID aSecondLayer) const
Calculate the distance (height) between the two given copper layers.
Information pertinent to a Pcbnew printed circuit board.
bool IsLayerEnabled(PCB_LAYER_ID aLayer) const
A proxy function that calls the correspondent function in m_BoardSettings tests whether a given layer...
PCB_LAYER_ID FlipLayer(PCB_LAYER_ID aLayer) const
BOARD_DESIGN_SETTINGS & GetDesignSettings()
int AsTenthsOfADegree() const
virtual void SetParent(EDA_ITEM *aParent)
EDA_ANGLE GetAngle() const
static bool Contains(int aStart_layer, int aEnd_layer, int aTest_layer)
LSET is a set of PCB_LAYER_IDs.
LSEQ Seq(const LSEQ &aSequence) const
Return an LSEQ from the union of this LSET and a desired sequence.
std::optional< bool > IsFilled() const
bool operator==(const PADSTACK &aOther) const
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 SetBackdrillMode(BACKDRILL_MODE aMode)
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)
int GetMaxHoleSize() const
std::optional< double > & SolderPasteMarginRatio(PCB_LAYER_ID aLayer=F_Cu)
void SetBackdrillSize(bool aTop, std::optional< int > aSize)
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)
void SetCustomName(const wxString &aCustomName)
bool HasExplicitDefinitionForLayer(PCB_LAYER_ID aLayer) const
Check if the padstack has an explicit definition for the given layer.
std::optional< bool > IsTented(PCB_LAYER_ID aSide) const
Checks if this padstack is tented (covered in soldermask) on the given side.
int MachiningKnockout(const BOARD &aBoard, PCB_LAYER_ID aLayer) const
Get the diameter of copper removed from aLayer by backdrilling or post-machining.
std::optional< int > & ThermalSpokeWidth(PCB_LAYER_ID aLayer=F_Cu)
std::optional< int > & SolderPasteMargin(PCB_LAYER_ID aLayer=F_Cu)
void FlipLayers(BOARD *aBoard)
Flips the padstack layers in the case that the pad's parent footprint is flipped to the other side of...
POST_MACHINING_PROPS m_backPostMachining
std::optional< int > & SolderMaskMargin(PCB_LAYER_ID aLayer=F_Cu)
const DRILL_PROPS * findBackdrillDrill(bool aTop) const
Return the drill slot holding the top (aTop true) or bottom backdrill, identified by its start layer ...
void SetChamferRatio(double aRatio, PCB_LAYER_ID aLayer)
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 SetOffset(const VECTOR2I &aOffset, PCB_LAYER_ID aLayer)
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
! A back-drill, whose side is given by its start layer rather than by which slot it occupies
void clearBackdrillSide(bool aTop)
Clear every slot whose start layer marks it as the given backdrill side, so a malformed padstack with...
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
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)
POST_MACHINING_PROPS & FrontPostMachining()
DRILL_PROPS m_tertiaryDrill
! The other back-drill; see findBackdrillDrill() for why either slot may hold either side
void SetRoundRectRadius(double aRadius, PCB_LAYER_ID aLayer)
std::optional< bool > IsPlugged(PCB_LAYER_ID aSide) 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)
DRILL_PROPS & TertiaryDrill()
PAD_SHAPE Shape(PCB_LAYER_ID aLayer) const
void SetAnchorShape(PAD_SHAPE aShape, PCB_LAYER_ID aLayer)
EDA_ORIENTATION m_orientation
! The rotation of the pad relative to an outer reference frame
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
void SetBackdrillEndLayer(bool aTop, PCB_LAYER_ID aLayer)
LSET m_layerSet
! The board layers that this padstack is active on
std::optional< int > GetBackdrillSize(bool aTop) const
std::unordered_map< PCB_LAYER_ID, COPPER_LAYER_PROPS > m_copperProps
BACKDRILL_MODE GetBackdrillMode() const
static int Compare(const PADSTACK *aPadstackRef, const PADSTACK *aPadstackCmp)
Compare two padstacks and return 0 if they are equal.
PCB_LAYER_ID EndLayer() const
std::optional< bool > IsCovered(PCB_LAYER_ID aSide) const
DRILL_PROPS & backdrillWriteSlot(bool aTop)
Return the slot to write a backdrill side into, reusing the slot already holding that side or otherwi...
int & ChamferPositions(PCB_LAYER_ID aLayer)
MASK_LAYER_PROPS m_frontMaskProps
! The overrides applied to front outer technical layers
int PostMachiningKnockout(const BOARD_STACKUP &aStackup, PCB_LAYER_ID aLayer) const
Get the diameter the front and back post-machining operations cut into aLayer.
const VECTOR2I & Size(PCB_LAYER_ID aLayer) const
MODE
! Copper geometry mode: controls how many unique copper layer shapes this padstack has
@ NORMAL
Shape is the same on all layers.
@ 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
PCB_LAYER_ID GetBackdrillEndLayer(bool aTop) const
PCB_LAYER_ID StartLayer() const
POST_MACHINING_PROPS & BackPostMachining()
POST_MACHINING_PROPS m_frontPostMachining
std::unique_ptr< wxString > m_customName
! An override for the IPC-7351 padstack name
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)
void SetOrientation(const EDA_ANGLE &aAngle)
double ChamferRatio(PCB_LAYER_ID aLayer) const
static constexpr PCB_LAYER_ID ALL_LAYERS
! The layer identifier to use for the single defintion on normal padstacks
const wxChar * CustomName() 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.
MODE m_mode
! The copper layer variation mode this padstack is in
std::vector< std::shared_ptr< PCB_SHAPE > > & Primitives(PCB_LAYER_ID aLayer)
@ RECT_CHAMFER_BOTTOM_RIGHT
@ RECT_CHAMFER_BOTTOM_LEFT
static constexpr EDA_ANGLE ANGLE_0
static constexpr EDA_ANGLE ANGLE_90
static constexpr EDA_ANGLE ANGLE_45
PCB_LAYER_ID FlipLayer(PCB_LAYER_ID aLayerId, int aCopperLayersCount)
bool IsFrontLayer(PCB_LAYER_ID aLayerId)
Layer classification: check if it's a front layer.
bool IsBackLayer(PCB_LAYER_ID aLayerId)
Layer classification: check if it's a back layer.
bool IsNonCopperLayer(int aLayerId)
Test whether a layer is a non copper layer.
PCB_LAYER_ID
A quick note on layer IDs:
This file contains miscellaneous commonly used macros and functions.
void PackLayerSet(google::protobuf::RepeatedField< int > &aOutput, const LSET &aLayerSet)
LSET UnpackLayerSet(const google::protobuf::RepeatedField< int > &aProtoLayerSet)
KICOMMON_API int UnpackDistance(const types::Distance &aInput, const EDA_IU_SCALE &aScale)
KICOMMON_API VECTOR2I UnpackVector2(const types::Vector2 &aInput, const EDA_IU_SCALE &aScale)
KICOMMON_API void PackDistance(types::Distance &aOutput, int aInput, const EDA_IU_SCALE &aScale)
KICOMMON_API void PackVector2(types::Vector2 &aOutput, const VECTOR2I &aInput, const EDA_IU_SCALE &aScale)
#define TEST_OPT_ORIENTATION(a, b, v)
static int effectiveDrillDiameter(const VECTOR2I &aSize)
#define TEST_OPT(a, b, v)
static int surfaceKnockout(const BOARD_STACKUP &aStackup, const PADSTACK::POST_MACHINING_PROPS &aProps, PCB_LAYER_ID aSurface, PCB_LAYER_ID aLayer)
PAD_DRILL_POST_MACHINING_MODE
PAD_DRILL_SHAPE
The set of pad drill shapes, used with PAD::{Set,Get}DrillShape()
PAD_SHAPE
The set of pad shapes, used with PAD::{Set,Get}Shape()
#define IMPLEMENT_ENUM_TO_WXANY(type)
The features of a padstack that can vary between copper layers All parameters are optional; leaving t...
double Similarity(const COPPER_LAYER_PROPS &aOther) const
std::optional< ZONE_CONNECTION > zone_connection
int Compare(const COPPER_LAYER_PROPS &aOther) const
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_ORIENTATION > thermal_spoke_angle
std::optional< int > clearance
std::optional< int > thermal_gap
The properties of a padstack drill.
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.
int Compare(const DRILL_PROPS &aOther) const
The features of a padstack that can vary on outer layers.
bool operator==(const MASK_LAYER_PROPS &aOther) const
std::optional< int > solder_mask_margin
int Compare(const MASK_LAYER_PROPS &aOther) const
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.
std::optional< PAD_DRILL_POST_MACHINING_MODE > mode
bool operator==(const POST_MACHINING_PROPS &aOther) const
int Compare(const POST_MACHINING_PROPS &aOther) const
int chamfered_rect_positions
VECTOR2I trapezoid_delta_size
Delta for PAD_SHAPE::TRAPEZOID; half the delta squeezes one end and half expands the other.
int Compare(const SHAPE_PROPS &aOther) const
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
@ NONE
Pads are not covered.