diff --git a/api/proto/board/board_types.proto b/api/proto/board/board_types.proto index b506f4ab01..89be1dd287 100644 --- a/api/proto/board/board_types.proto +++ b/api/proto/board/board_types.proto @@ -284,6 +284,14 @@ message PadStackOuterLayer SolderPasteOverrides solder_paste_settings = 4; } +enum DrillShape +{ + DS_UNKNOWN = 0; + DS_CIRCLE = 1; + DS_OBLONG = 2; + DS_UNDEFINED = 3; +} + message DrillProperties { // Lowest (closest to F_Cu) layer this drill exists on. @@ -295,6 +303,8 @@ message DrillProperties // The diameter, in x and y, of the pad's drilled hole, if this pad has a hole. // x and y will be the same value if the hole is round. kiapi.common.types.Vector2 diameter = 3; + + DrillShape shape = 4; } // A pad stack definition for a multilayer pad or via. diff --git a/pcbnew/api/api_pcb_enums.cpp b/pcbnew/api/api_pcb_enums.cpp index 0f9530d481..2cc6cd9993 100644 --- a/pcbnew/api/api_pcb_enums.cpp +++ b/pcbnew/api/api_pcb_enums.cpp @@ -62,6 +62,34 @@ PAD_ATTRIB FromProtoEnum( types::PadType aValue ) } } +template<> +types::DrillShape ToProtoEnum( PAD_DRILL_SHAPE aValue ) +{ + switch( aValue ) + { + case PAD_DRILL_SHAPE::CIRCLE: return types::DrillShape::DS_CIRCLE; + case PAD_DRILL_SHAPE::OBLONG: return types::DrillShape::DS_OBLONG; + case PAD_DRILL_SHAPE::UNDEFINED: return types::DrillShape::DS_UNDEFINED; + default: + wxCHECK_MSG( false, types::DrillShape::DS_UNKNOWN, + "Unhandled case in ToProtoEnum"); + } +} + +template<> +PAD_DRILL_SHAPE FromProtoEnum( types::DrillShape aValue ) +{ + switch( aValue ) + { + case types::DrillShape::DS_CIRCLE: return PAD_DRILL_SHAPE::CIRCLE; + case types::DrillShape::DS_OBLONG: return PAD_DRILL_SHAPE::OBLONG; + case types::DrillShape::DS_UNDEFINED: return PAD_DRILL_SHAPE::UNDEFINED; + default: + wxCHECK_MSG( false, PAD_DRILL_SHAPE::UNDEFINED, + "Unhandled case in FromProtoEnum" ); + } +} + template<> types::PadStackShape ToProtoEnum( PAD_SHAPE aValue ) { diff --git a/qa/tests/api/test_api_enums.cpp b/qa/tests/api/test_api_enums.cpp index 1aee19e956..29318e290d 100644 --- a/qa/tests/api/test_api_enums.cpp +++ b/qa/tests/api/test_api_enums.cpp @@ -171,6 +171,11 @@ BOOST_AUTO_TEST_CASE( PadStackType ) testEnums(); } +BOOST_AUTO_TEST_CASE( DrillShape ) +{ + testEnums(); +} + BOOST_AUTO_TEST_CASE( UnconnectedLayerRemoval ) { testEnums();