From b44015e2040b9da06f85a82974d7241c81f433e2 Mon Sep 17 00:00:00 2001 From: Jon Evans Date: Sun, 17 Nov 2024 23:56:11 -0500 Subject: [PATCH] Add padstack copper offset to API --- api/proto/board/board_types.proto | 3 +++ pcbnew/padstack.cpp | 2 ++ 2 files changed, 5 insertions(+) diff --git a/api/proto/board/board_types.proto b/api/proto/board/board_types.proto index 389b08f683..b506f4ab01 100644 --- a/api/proto/board/board_types.proto +++ b/api/proto/board/board_types.proto @@ -250,6 +250,9 @@ message PadStackLayer // The difference in side length between the short and long pads in a trapezoid. Only one of x or y may be nonzero. // Only used for PSS_TRAPEZOID kiapi.common.types.Vector2 trapezoid_delta = 10; + + // The offset of the center of this shape from the center of the pad (which is defined as the hole center) + kiapi.common.types.Vector2 offset = 11; } enum SolderMaskMode diff --git a/pcbnew/padstack.cpp b/pcbnew/padstack.cpp index e727f8591d..718f8bc57f 100644 --- a/pcbnew/padstack.cpp +++ b/pcbnew/padstack.cpp @@ -163,6 +163,7 @@ bool PADSTACK::unpackCopperLayer( const kiapi::board::types::PadStackLayer& aPro SetSize( kiapi::common::UnpackVector2( aProto.size() ), layer ); SetShape( FromProtoEnum( aProto.shape() ), layer ); + Offset( layer ) = kiapi::common::UnpackVector2( aProto.offset() ); SetAnchorShape( FromProtoEnum( aProto.custom_anchor_shape() ), layer ); SHAPE_PROPS& props = CopperLayer( layer ).shape; @@ -378,6 +379,7 @@ void PADSTACK::packCopperLayer( PCB_LAYER_ID aLayer, kiapi::board::types::PadSta stackLayer->set_layer( ToProtoEnum( aLayer ) ); kiapi::common::PackVector2( *stackLayer->mutable_size(), Size( aLayer ) ); + kiapi::common::PackVector2( *stackLayer->mutable_offset(), Offset( aLayer ) ); stackLayer->set_shape( ToProtoEnum( Shape( aLayer ) ) );