From cb06d750de39a87226f742d55049789480e570e8 Mon Sep 17 00:00:00 2001 From: Jon Evans Date: Sun, 17 Nov 2024 22:32:35 -0500 Subject: [PATCH] Add trapezoid delta to the padstack API definition --- api/proto/board/board_types.proto | 4 ++++ pcbnew/api/api_handler_pcb.cpp | 2 ++ pcbnew/padstack.cpp | 9 +++++++++ 3 files changed, 15 insertions(+) diff --git a/api/proto/board/board_types.proto b/api/proto/board/board_types.proto index b325117a9f..389b08f683 100644 --- a/api/proto/board/board_types.proto +++ b/api/proto/board/board_types.proto @@ -246,6 +246,10 @@ message PadStackLayer // Reserved for future use -- at the moment, zone connection settings are not per-layer ZoneConnectionSettings zone_settings = 9; + + // 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; } enum SolderMaskMode diff --git a/pcbnew/api/api_handler_pcb.cpp b/pcbnew/api/api_handler_pcb.cpp index 7da1e513fd..0ce28e62e9 100644 --- a/pcbnew/api/api_handler_pcb.cpp +++ b/pcbnew/api/api_handler_pcb.cpp @@ -433,6 +433,8 @@ HANDLER_RESULT API_HANDLER_PCB::handleGetItems( GetItems& aMsg if( inserted ) typesInserted.insert( PCB_SHAPE_T ); + + break; } default: diff --git a/pcbnew/padstack.cpp b/pcbnew/padstack.cpp index e3ad3a143f..e727f8591d 100644 --- a/pcbnew/padstack.cpp +++ b/pcbnew/padstack.cpp @@ -169,6 +169,9 @@ bool PADSTACK::unpackCopperLayer( const kiapi::board::types::PadStackLayer& aPro props.chamfered_rect_ratio = aProto.chamfer_ratio(); props.round_rect_radius_ratio = aProto.corner_rounding_ratio(); + if( Shape( layer ) == PAD_SHAPE::TRAPEZOID && aProto.has_trapezoid_delta() ) + TrapezoidDeltaSize( layer ) = kiapi::common::UnpackVector2( aProto.trapezoid_delta() ); + if( aProto.chamfered_corners().top_left() ) props.chamfered_rect_positions |= RECT_CHAMFER_TOP_LEFT; @@ -384,6 +387,12 @@ void PADSTACK::packCopperLayer( PCB_LAYER_ID aLayer, kiapi::board::types::PadSta stackLayer->set_chamfer_ratio( CopperLayer( aLayer ).shape.chamfered_rect_ratio ); stackLayer->set_corner_rounding_ratio( CopperLayer( aLayer ).shape.round_rect_radius_ratio ); + if( Shape( aLayer ) == PAD_SHAPE::TRAPEZOID ) + { + kiapi::common::PackVector2( *stackLayer->mutable_trapezoid_delta(), + TrapezoidDeltaSize( aLayer ) ); + } + google::protobuf::Any a; for( const std::shared_ptr& shape : Primitives( aLayer ) )