From 33ebc389e46a7ed60110a21c64f13fa99737ad13 Mon Sep 17 00:00:00 2001 From: Adam Chalmers Date: Thu, 19 Feb 2026 11:39:44 -0600 Subject: [PATCH 1/2] New command, BoundingBox --- modeling-cmds/src/def_enum.rs | 13 +++++++++++++ modeling-cmds/src/ok_response.rs | 10 ++++++++++ 2 files changed, 23 insertions(+) diff --git a/modeling-cmds/src/def_enum.rs b/modeling-cmds/src/def_enum.rs index 1b2abe52..a44fdb74 100644 --- a/modeling-cmds/src/def_enum.rs +++ b/modeling-cmds/src/def_enum.rs @@ -2395,6 +2395,19 @@ define_modeling_cmd_enum! { /// Where in the window was selected 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, + } } } diff --git a/modeling-cmds/src/ok_response.rs b/modeling-cmds/src/ok_response.rs index 4ffbf907..21e24cb1 100644 --- a/modeling-cmds/src/ok_response.rs +++ b/modeling-cmds/src/ok_response.rs @@ -1226,5 +1226,15 @@ 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 { + /// Corner of the box + pub corner: Point3d, + /// Dimensions of the box, starting from the corner. + pub dimensions: Point3d, + } + } } From a08b0b44d262953eb0ae92a0cea7680687e32ab5 Mon Sep 17 00:00:00 2001 From: Adam Chalmers Date: Fri, 20 Feb 2026 23:37:37 -0600 Subject: [PATCH 2/2] Use center and dimensions --- modeling-cmds/openapi/api.json | 24 ++++++++++++++++++++++++ modeling-cmds/src/ok_response.rs | 8 ++++---- 2 files changed, 28 insertions(+), 4 deletions(-) diff --git a/modeling-cmds/openapi/api.json b/modeling-cmds/openapi/api.json index 5cbf2cfa..6e6bdd92 100644 --- a/modeling-cmds/openapi/api.json +++ b/modeling-cmds/openapi/api.json @@ -6579,6 +6579,30 @@ "selected_at_window", "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" + ] } ] }, diff --git a/modeling-cmds/src/ok_response.rs b/modeling-cmds/src/ok_response.rs index 21e24cb1..97f66b55 100644 --- a/modeling-cmds/src/ok_response.rs +++ b/modeling-cmds/src/ok_response.rs @@ -1230,10 +1230,10 @@ define_ok_modeling_cmd_response_enum! { #[derive(Debug, Serialize, Deserialize, Clone, JsonSchema, ModelingCmdOutput)] #[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)] pub struct BoundingBox { - /// Corner of the box - pub corner: Point3d, - /// Dimensions of the box, starting from the corner. - pub dimensions: Point3d, + /// Center of the box. + pub center: Point3d, + /// Dimensions of the box along each axis. + pub dimensions: Point3d, } }