Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 51 additions & 0 deletions modeling-cmds/openapi/api.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
28 changes: 28 additions & 0 deletions modeling-cmds/src/def_enum.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<LengthUnit>,
}

/// 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)]
Expand Down
16 changes: 16 additions & 0 deletions modeling-cmds/src/ok_response.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<LengthUnit>,
}

/// The response from the 'SelectRegionFromPoint'.
/// If there are multiple ways to construct this region, this chooses arbitrarily.
#[derive(Debug, Serialize, Deserialize, Clone, JsonSchema, ModelingCmdOutput)]
Expand Down
Loading