7
mirror of https://gitlab.com/kicad/code/kicad.git synced 2025-04-21 18:33:45 +00:00

API: Include custom layer names in stackup

This commit is contained in:
Jon Evans 2025-01-07 18:28:07 -05:00
parent 19e5ca3430
commit bd47692bf2
2 changed files with 16 additions and 0 deletions
api/proto/board
pcbnew/api

View File

@ -95,6 +95,10 @@ message BoardStackupLayer
BoardStackupDielectricLayer dielectric = 5;
kiapi.common.types.Color color = 6;
string material_name = 7;
// The name of the layer shown in the KiCad GUI, which may be a default value like "F.Cu" or may
// have been customized by the user. This field does not apply to dielectric layers.
string user_name = 8;
}
message BoardStackup

View File

@ -675,6 +675,18 @@ HANDLER_RESULT<BoardStackupResponse> API_HANDLER_PCB::handleGetStackup(
any.UnpackTo( response.mutable_stackup() );
// User-settable layer names are not stored in BOARD_STACKUP at the moment
for( board::BoardStackupLayer& layer : *response.mutable_stackup()->mutable_layers() )
{
if( layer.type() == board::BoardStackupLayerType::BSLT_DIELECTRIC )
continue;
PCB_LAYER_ID id = FromProtoEnum<PCB_LAYER_ID>( layer.layer() );
wxCHECK2( id != UNDEFINED_LAYER, continue );
layer.set_user_name( frame()->GetBoard()->GetLayerName( id ) );
}
return response;
}