Browse Source

Add trapezoid delta to the padstack API definition

pcb_db
Jon Evans 11 months ago
parent
commit
cb06d750de
  1. 4
      api/proto/board/board_types.proto
  2. 2
      pcbnew/api/api_handler_pcb.cpp
  3. 9
      pcbnew/padstack.cpp

4
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

2
pcbnew/api/api_handler_pcb.cpp

@ -433,6 +433,8 @@ HANDLER_RESULT<GetItemsResponse> API_HANDLER_PCB::handleGetItems( GetItems& aMsg
if( inserted )
typesInserted.insert( PCB_SHAPE_T );
break;
}
default:

9
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<PCB_SHAPE>& shape : Primitives( aLayer ) )

Loading…
Cancel
Save