diff --git a/modeling-cmds/openapi/api.json b/modeling-cmds/openapi/api.json index 7e24f231..07ccc2cc 100644 --- a/modeling-cmds/openapi/api.json +++ b/modeling-cmds/openapi/api.json @@ -642,6 +642,25 @@ "direction" ] }, + "BodyType": { + "description": "Body type determining if the operation will create a solid or a surface.", + "oneOf": [ + { + "description": "Create a body that has two caps, creating a solid object.", + "type": "string", + "enum": [ + "solid" + ] + }, + { + "description": "Create only the surface of the body without any caps.", + "type": "string", + "enum": [ + "surface" + ] + } + ] + }, "CameraDragInteractionType": { "description": "The type of camera drag interaction.", "oneOf": [ @@ -1829,6 +1848,15 @@ "description": "Command for extruding a solid 2d.", "type": "object", "properties": { + "body_type": { + "description": "Should this extrude create a solid body or a surface?", + "default": "solid", + "allOf": [ + { + "$ref": "#/components/schemas/BodyType" + } + ] + }, "distance": { "description": "How far off the plane to extrude", "allOf": [ @@ -1890,6 +1918,15 @@ "description": "Command for extruding a solid 2d to a reference geometry.", "type": "object", "properties": { + "body_type": { + "description": "Should this extrude create a solid body or a surface?", + "default": "solid", + "allOf": [ + { + "$ref": "#/components/schemas/BodyType" + } + ] + }, "extrude_method": { "description": "Should the extrusion create a new object or be part of the existing object.", "default": "merge", @@ -1954,6 +1991,15 @@ } ] }, + "body_type": { + "description": "Should this extrude create a solid body or a surface?", + "default": "solid", + "allOf": [ + { + "$ref": "#/components/schemas/BodyType" + } + ] + }, "center_2d": { "description": "Center to twist about (relative to 2D sketch)", "default": { diff --git a/modeling-cmds/src/def_enum.rs b/modeling-cmds/src/def_enum.rs index ce04621b..5aa38c7a 100644 --- a/modeling-cmds/src/def_enum.rs +++ b/modeling-cmds/src/def_enum.rs @@ -23,6 +23,7 @@ define_modeling_cmd_enum! { length_unit::LengthUnit, shared::{ Angle, + BodyType, ComponentTransform, RelativeTo, CutType, CutTypeV2, @@ -128,6 +129,9 @@ define_modeling_cmd_enum! { /// Should the extrusion create a new object or be part of the existing object. #[serde(default)] pub extrude_method: ExtrudeMethod, + /// Should this extrude create a solid body or a surface? + #[serde(default)] + pub body_type: BodyType, } /// Command for extruding a solid 2d to a reference geometry. @@ -150,6 +154,9 @@ define_modeling_cmd_enum! { /// Should the extrusion create a new object or be part of the existing object. #[serde(default)] pub extrude_method: ExtrudeMethod, + /// Should this extrude create a solid body or a surface? + #[serde(default)] + pub body_type: BodyType, } fn default_twist_extrude_section_interval() -> Angle { @@ -182,6 +189,9 @@ define_modeling_cmd_enum! { pub angle_step_size: Angle, ///The twisted surface loft tolerance pub tolerance: LengthUnit, + /// Should this extrude create a solid body or a surface? + #[serde(default)] + pub body_type: BodyType, } /// Extrude the object along a path. diff --git a/modeling-cmds/src/shared.rs b/modeling-cmds/src/shared.rs index 6fb66619..f8fec200 100644 --- a/modeling-cmds/src/shared.rs +++ b/modeling-cmds/src/shared.rs @@ -1041,6 +1041,19 @@ impl From for http::StatusCode { } } +/// Body type determining if the operation will create a solid or a surface. +#[derive(Default, Clone, Copy, Debug, Eq, PartialEq, Serialize, Deserialize, JsonSchema)] +#[serde(rename_all = "snake_case")] +#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))] +#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))] +pub enum BodyType { + ///Create a body that has two caps, creating a solid object. + #[default] + Solid, + ///Create only the surface of the body without any caps. + Surface, +} + /// Extrusion method determining if the extrusion will be part of the existing object or an /// entirely new object. #[derive(Default, Clone, Copy, Debug, Eq, PartialEq, Serialize, Deserialize, JsonSchema)] @@ -1342,6 +1355,7 @@ impl_extern_type! { // Scene SceneSelectionType = "Enums::_SceneSelectionType" SceneToolType = "Enums::_SceneToolType" + BodyType = "Enums::_BodyType" EntityType = "Enums::_EntityType" AnnotationType = "Enums::_AnnotationType" AnnotationTextAlignmentX = "Enums::_AnnotationTextAlignmentX" diff --git a/modeling-session/examples/cube_png.rs b/modeling-session/examples/cube_png.rs index ee77301e..3387d788 100644 --- a/modeling-session/examples/cube_png.rs +++ b/modeling-session/examples/cube_png.rs @@ -113,6 +113,7 @@ async fn main() -> Result<()> { faces: None, opposite: Default::default(), extrude_method: Default::default(), + body_type: Default::default(), } .into(), ) diff --git a/modeling-session/examples/cube_png_batch.rs b/modeling-session/examples/cube_png_batch.rs index dfa77936..0af4bc99 100644 --- a/modeling-session/examples/cube_png_batch.rs +++ b/modeling-session/examples/cube_png_batch.rs @@ -104,6 +104,7 @@ async fn main() -> Result<()> { faces: None, opposite: Default::default(), extrude_method: Default::default(), + body_type: Default::default(), }), cmd_id: random_id(), }); diff --git a/modeling-session/examples/lsystem_png_batch.rs b/modeling-session/examples/lsystem_png_batch.rs index 2e9a30e1..c45d5910 100644 --- a/modeling-session/examples/lsystem_png_batch.rs +++ b/modeling-session/examples/lsystem_png_batch.rs @@ -143,6 +143,7 @@ async fn main() -> Result<()> { faces: None, opposite: Default::default(), extrude_method: Default::default(), + body_type: Default::default(), }), cmd_id: random_id(), });