diff --git a/modeling-cmds/openapi/api.json b/modeling-cmds/openapi/api.json index 51ff65e4..68f0deb3 100644 --- a/modeling-cmds/openapi/api.json +++ b/modeling-cmds/openapi/api.json @@ -6571,6 +6571,57 @@ "type" ] }, + { + "description": "Create a region with a query point. The region should have an ID taken from the ID of the 'CreateRegionFromQueryPoint' modeling command.", + "type": "object", + "properties": { + "object_id": { + "description": "Which sketch object to create the region from.", + "type": "string", + "format": "uuid" + }, + "query_point": { + "description": "The query point (in the same coordinates as the sketch itself) if a possible sketch region contains this point, then that region will be created", + "allOf": [ + { + "$ref": "#/components/schemas/Point2d" + } + ] + }, + "type": { + "type": "string", + "enum": [ + "create_region_from_query_point" + ] + } + }, + "required": [ + "object_id", + "query_point", + "type" + ] + }, + { + "description": "Finds a suitable point inside the region for calling such that CreateRegionFromQueryPoint will generate an identical region.", + "type": "object", + "properties": { + "region_id": { + "description": "Which region to search within", + "type": "string", + "format": "uuid" + }, + "type": { + "type": "string", + "enum": [ + "region_get_query_point" + ] + } + }, + "required": [ + "region_id", + "type" + ] + }, { "description": "The user clicked on a point in the window, returns the region the user clicked on, if any.", "type": "object", diff --git a/modeling-cmds/src/def_enum.rs b/modeling-cmds/src/def_enum.rs index 86e77ddc..7191053b 100644 --- a/modeling-cmds/src/def_enum.rs +++ b/modeling-cmds/src/def_enum.rs @@ -2393,6 +2393,34 @@ define_modeling_cmd_enum! { pub curve_clockwise: bool, } + /// Create a region with a query point. + /// The region should have an ID taken from the ID of the + /// 'CreateRegionFromQueryPoint' modeling command. + #[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 CreateRegionFromQueryPoint { + /// Which sketch object to create the region from. + pub object_id: Uuid, + + /// The query point (in the same coordinates as the sketch itself) + /// if a possible sketch region contains this point, then that region will be created + pub query_point: Point2d, + } + + /// Finds a suitable point inside the region for calling such that CreateRegionFromQueryPoint will generate an identical region. + #[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 RegionGetQueryPoint { + /// Which region to search within + pub region_id: Uuid, + } + /// The user clicked on a point in the window, /// returns the region the user clicked on, if any. #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant, Builder)] diff --git a/modeling-cmds/src/ok_response.rs b/modeling-cmds/src/ok_response.rs index f6ad69de..a25965ad 100644 --- a/modeling-cmds/src/ok_response.rs +++ b/modeling-cmds/src/ok_response.rs @@ -1215,6 +1215,22 @@ define_ok_modeling_cmd_response_enum! { pub struct CreateRegion { } + /// The response from the 'CreateRegionFromQueryPoint'. + /// The region should have an ID taken from the ID of the + /// 'CreateRegionFromQueryPoint' modeling command. + #[derive(Debug, Serialize, Deserialize, Clone, JsonSchema, ModelingCmdOutput)] + #[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)] + pub struct CreateRegionFromQueryPoint { + } + + /// The response from 'RegionGetQueryPoint' modeling command. + #[derive(Debug, Serialize, Deserialize, Clone, JsonSchema, ModelingCmdOutput)] + #[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)] + pub struct RegionGetQueryPoint { + ///A point that is inside of the queried region, in the same coordinate frame as the sketch itself + pub query_point: Point2d, + } + /// The response from the 'SelectRegionFromPoint'. /// If there are multiple ways to construct this region, this chooses arbitrarily. #[derive(Debug, Serialize, Deserialize, Clone, JsonSchema, ModelingCmdOutput)]