7
mirror of https://gitlab.com/kicad/code/kicad.git synced 2025-04-18 19:39:17 +00:00

API: make thermal spoke settings optional

This commit is contained in:
Jon Evans 2025-01-09 20:55:50 -05:00
parent 0f6669a68c
commit 4dfcbc6d2a
2 changed files with 17 additions and 8 deletions
api/proto/board
pcbnew

View File

@ -423,9 +423,9 @@ enum CustomPadShapeZoneFillStrategy
message ThermalSpokeSettings
{
int64 width = 1;
optional int64 width = 1;
kiapi.common.types.Angle angle = 2;
int64 gap = 3;
optional int64 gap = 3;
}
message Pad

View File

@ -230,6 +230,9 @@ bool PADSTACK::Deserialize( const google::protobuf::Any& aContainer )
return false;
}
CopperLayer( ALL_LAYERS ).thermal_gap = std::nullopt;
CopperLayer( ALL_LAYERS ).thermal_spoke_width = std::nullopt;
if( padstack.has_zone_settings() )
{
CopperLayer( ALL_LAYERS ).zone_connection =
@ -239,16 +242,18 @@ bool PADSTACK::Deserialize( const google::protobuf::Any& aContainer )
{
const ThermalSpokeSettings& thermals = padstack.zone_settings().thermal_spokes();
CopperLayer( ALL_LAYERS ).thermal_gap = thermals.gap();
CopperLayer( ALL_LAYERS ).thermal_spoke_width = thermals.width();
if( thermals.has_gap() )
CopperLayer( ALL_LAYERS ).thermal_gap = thermals.gap();
if( thermals.has_width() )
CopperLayer( ALL_LAYERS ).thermal_spoke_width = thermals.width();
SetThermalSpokeAngle( thermals.angle().value_degrees(), F_Cu );
}
}
else
{
CopperLayer( ALL_LAYERS ).zone_connection = ZONE_CONNECTION::INHERITED;
CopperLayer( ALL_LAYERS ).thermal_gap = std::nullopt;
CopperLayer( ALL_LAYERS ).thermal_spoke_width = std::nullopt;
CopperLayer( ALL_LAYERS ).thermal_spoke_angle = DefaultThermalSpokeAngleForShape( F_Cu );
}
@ -447,8 +452,12 @@ void PADSTACK::Serialize( google::protobuf::Any& aContainer ) const
*CopperLayer( ALL_LAYERS ).zone_connection ) );
}
thermalSettings->set_width( CopperLayer( ALL_LAYERS ).thermal_spoke_width.value_or( 0 ) );
thermalSettings->set_gap( CopperLayer( ALL_LAYERS ).thermal_gap.value_or( 0 ) );
if( CopperLayer( ALL_LAYERS ).thermal_spoke_width.has_value() )
thermalSettings->set_width( *CopperLayer( ALL_LAYERS ).thermal_spoke_width );
if( CopperLayer( ALL_LAYERS ).thermal_gap.has_value() )
thermalSettings->set_gap( *CopperLayer( ALL_LAYERS ).thermal_gap );
thermalSettings->mutable_angle()->set_value_degrees( ThermalSpokeAngle( F_Cu ).AsDegrees() );
padstack.set_unconnected_layer_removal(