diff --git a/modeling-cmds/openapi/api.json b/modeling-cmds/openapi/api.json index 68f0deb3..bc9f5bb2 100644 --- a/modeling-cmds/openapi/api.json +++ b/modeling-cmds/openapi/api.json @@ -6646,6 +6646,30 @@ "type" ] }, + { + "description": "Get the smallest box that could contain the given parts.", + "type": "object", + "properties": { + "entity_ids": { + "description": "IDs of the entities to be included in the box. If this is empty, then all entities are included (the entire scene).", + "type": "array", + "items": { + "type": "string", + "format": "uuid" + } + }, + "type": { + "type": "string", + "enum": [ + "bounding_box" + ] + } + }, + "required": [ + "entity_ids", + "type" + ] + }, { "description": "Offset a surface by a given distance.", "type": "object", diff --git a/modeling-cmds/src/def_enum.rs b/modeling-cmds/src/def_enum.rs index 7191053b..5d3ce44d 100644 --- a/modeling-cmds/src/def_enum.rs +++ b/modeling-cmds/src/def_enum.rs @@ -2433,6 +2433,19 @@ define_modeling_cmd_enum! { pub selected_at_window: Point2d, } + /// Get the smallest box that could contain the given parts. + #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant, Builder)] + #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))] + #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))] + #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))] + #[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)] + pub struct BoundingBox { + /// IDs of the entities to be included in the box. + /// If this is empty, then all entities are included (the entire scene). + #[builder(default)] + pub entity_ids: Vec, + } + ///Offset a surface by a given distance. #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant, Builder)] #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))] diff --git a/modeling-cmds/src/ok_response.rs b/modeling-cmds/src/ok_response.rs index a25965ad..33c753b0 100644 --- a/modeling-cmds/src/ok_response.rs +++ b/modeling-cmds/src/ok_response.rs @@ -1242,6 +1242,16 @@ define_ok_modeling_cmd_response_enum! { pub region: Option, } + /// The response from the 'BoundingBox'. + #[derive(Debug, Serialize, Deserialize, Clone, JsonSchema, ModelingCmdOutput)] + #[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)] + pub struct BoundingBox { + /// Center of the box. + pub center: Point3d, + /// Dimensions of the box along each axis. + pub dimensions: Point3d, + } + /// The response from the 'OffsetSurface'. #[derive(Debug, Serialize, Deserialize, Clone, JsonSchema, ModelingCmdOutput)] pub struct OffsetSurface {