From becbe6ec6163ad8797a3a2aa898782d28f986003 Mon Sep 17 00:00:00 2001 From: benjamaan476 Date: Fri, 11 Oct 2024 13:27:03 +0100 Subject: [PATCH 1/6] Added ProjectEntityToPlane endpoint --- modeling-cmds/src/def_enum.rs | 12 ++++++++++++ modeling-cmds/src/ok_response.rs | 7 +++++++ 2 files changed, 19 insertions(+) diff --git a/modeling-cmds/src/def_enum.rs b/modeling-cmds/src/def_enum.rs index 69e449f8..8f095710 100644 --- a/modeling-cmds/src/def_enum.rs +++ b/modeling-cmds/src/def_enum.rs @@ -809,6 +809,18 @@ define_modeling_cmd_enum! { pub curve_id: Uuid, } + /// Project an entity on to a plane. + #[derive(Debug, Clone, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)] + pub struct ProjectEntityToPlane { + /// Which entity to project (vertex or edge). + pub entity_id: Uuid, + /// Which plane to project entity_id onto. + pub plane_id: Uuid, + /// If true: the projected points are returned in the plane_id's coordinate system. + pub use_plane_coords: bool, + + } + /// Enum containing the variety of image formats snapshots may be exported to. #[derive(Debug, Clone, Serialize, Deserialize, JsonSchema, FromStr, Display)] #[serde(rename_all = "snake_case")] diff --git a/modeling-cmds/src/ok_response.rs b/modeling-cmds/src/ok_response.rs index 08c36a2f..fea6156c 100644 --- a/modeling-cmds/src/ok_response.rs +++ b/modeling-cmds/src/ok_response.rs @@ -473,6 +473,13 @@ define_ok_modeling_cmd_response_enum! { pub control_points: Vec>, } + /// The response from the `ProjectEntityToPlane` command. + #[derive(Debug, Serialize, Deserialze, Clone, JsonSchema, ModelingCmdOutput)] + pub struct ProjectEntityToPlane { + /// Projected points. + pub projected_points: Vec>, + } + /// The response from the `CurveGetType` command. #[derive(Debug, Serialize, Deserialize, Clone, JsonSchema, Eq, PartialEq, ModelingCmdOutput)] pub struct CurveGetType { From 7b75f12f58e8b72fffe41739e2de813ecfe75773 Mon Sep 17 00:00:00 2001 From: benjamaan476 Date: Fri, 11 Oct 2024 16:01:39 +0100 Subject: [PATCH 2/6] typo --- modeling-cmds/src/ok_response.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modeling-cmds/src/ok_response.rs b/modeling-cmds/src/ok_response.rs index fea6156c..2c156cdb 100644 --- a/modeling-cmds/src/ok_response.rs +++ b/modeling-cmds/src/ok_response.rs @@ -474,7 +474,7 @@ define_ok_modeling_cmd_response_enum! { } /// The response from the `ProjectEntityToPlane` command. - #[derive(Debug, Serialize, Deserialze, Clone, JsonSchema, ModelingCmdOutput)] + #[derive(Debug, Serialize, Deserialize, Clone, JsonSchema, ModelingCmdOutput)] pub struct ProjectEntityToPlane { /// Projected points. pub projected_points: Vec>, From ca797b491f13715b296d1391b1a5d0a9d8ba6b3c Mon Sep 17 00:00:00 2001 From: benjamaan476 Date: Fri, 11 Oct 2024 17:25:48 +0100 Subject: [PATCH 3/6] better comment --- modeling-cmds/src/def_enum.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/modeling-cmds/src/def_enum.rs b/modeling-cmds/src/def_enum.rs index 8f095710..1859e8c6 100644 --- a/modeling-cmds/src/def_enum.rs +++ b/modeling-cmds/src/def_enum.rs @@ -816,7 +816,8 @@ define_modeling_cmd_enum! { pub entity_id: Uuid, /// Which plane to project entity_id onto. pub plane_id: Uuid, - /// If true: the projected points are returned in the plane_id's coordinate system. + /// If true: the projected points are returned in the plane_id's coordinate system, + /// else: the projected points are returned in the world coordinate system. pub use_plane_coords: bool, } From 2c488e06172a8b3b50fa1408613c1a49934b9b5d Mon Sep 17 00:00:00 2001 From: benjamaan476 Date: Fri, 17 Jan 2025 15:15:22 +0000 Subject: [PATCH 4/6] Add PartialEq and ts derives --- modeling-cmds/src/def_enum.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/modeling-cmds/src/def_enum.rs b/modeling-cmds/src/def_enum.rs index 6d18e473..be57eb54 100644 --- a/modeling-cmds/src/def_enum.rs +++ b/modeling-cmds/src/def_enum.rs @@ -1046,7 +1046,9 @@ define_modeling_cmd_enum! { } /// Project an entity on to a plane. - #[derive(Debug, Clone, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)] + #[derive(Debug, Clone, Serialize, Deserialize, JsonSchema, ModelingCmdVariant, PartialEq)] + #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))] + #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))] pub struct ProjectEntityToPlane { /// Which entity to project (vertex or edge). pub entity_id: Uuid, From 4ded8b59a9ae3d05335b5cdfa0bad0eaedb943b8 Mon Sep 17 00:00:00 2001 From: benjamaan476 Date: Mon, 20 Jan 2025 14:24:27 +0000 Subject: [PATCH 5/6] Add ProjectPointsToPlane --- modeling-cmds/src/def_enum.rs | 15 ++++++++++++++- modeling-cmds/src/ok_response.rs | 7 +++++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/modeling-cmds/src/def_enum.rs b/modeling-cmds/src/def_enum.rs index be57eb54..e856b86c 100644 --- a/modeling-cmds/src/def_enum.rs +++ b/modeling-cmds/src/def_enum.rs @@ -1046,7 +1046,7 @@ define_modeling_cmd_enum! { } /// Project an entity on to a plane. - #[derive(Debug, Clone, Serialize, Deserialize, JsonSchema, ModelingCmdVariant, PartialEq)] + #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)] #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))] #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))] pub struct ProjectEntityToPlane { @@ -1057,7 +1057,20 @@ define_modeling_cmd_enum! { /// If true: the projected points are returned in the plane_id's coordinate system, /// else: the projected points are returned in the world coordinate system. pub use_plane_coords: bool, + } + /// Project a list of points on to a plane. + #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)] + #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))] + #[cfg_attr(feature = "ts-rs", th(export_to = "ModelingCmd.ts"))] + pub struct ProjectPointsToPlane { + /// The id of the plane used for the projection. + pub plane_id: Uuid, + /// The list of points that will be projected. + pub points: Vec>, + /// If true: the projected points are returned in the plane_id's coordinate sysetm. + /// else: the projected points are returned in the world coordinate system. + pub use_plane_coords: bool, } /// Enum containing the variety of image formats snapshots may be exported to. diff --git a/modeling-cmds/src/ok_response.rs b/modeling-cmds/src/ok_response.rs index 977ce520..b51d1096 100644 --- a/modeling-cmds/src/ok_response.rs +++ b/modeling-cmds/src/ok_response.rs @@ -507,6 +507,13 @@ define_ok_modeling_cmd_response_enum! { pub projected_points: Vec>, } + /// The response from the `ProjectPointsToPlane` command. + #[derive(Debug, Serialize, Deserialize, Clone, JsonSchema, ModelingCmdOutput)] + pub struct ProjectPointsToPlane { + /// Projected points. + pub projected_points: Vec>, + } + /// The response from the `CurveGetType` command. #[derive(Debug, Serialize, Deserialize, Clone, JsonSchema, Eq, PartialEq, ModelingCmdOutput)] pub struct CurveGetType { From 82f65510a8d35261c0dd673e21fc8e549cd2108d Mon Sep 17 00:00:00 2001 From: benjamaan476 Date: Fri, 24 Jan 2025 14:35:22 +0000 Subject: [PATCH 6/6] Fix typo --- modeling-cmds/src/def_enum.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modeling-cmds/src/def_enum.rs b/modeling-cmds/src/def_enum.rs index e856b86c..bcad8fef 100644 --- a/modeling-cmds/src/def_enum.rs +++ b/modeling-cmds/src/def_enum.rs @@ -1062,7 +1062,7 @@ define_modeling_cmd_enum! { /// Project a list of points on to a plane. #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)] #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))] - #[cfg_attr(feature = "ts-rs", th(export_to = "ModelingCmd.ts"))] + #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))] pub struct ProjectPointsToPlane { /// The id of the plane used for the projection. pub plane_id: Uuid,