Skip to content

Commit 8f0f54c

Browse files
Ben/solid info 2 (#879)
* add edge_id to Solid3dGetInfo * change response * add faces to response * updates Signed-off-by: Jess Frazelle <github@jessfraz.com> * updates Signed-off-by: Jess Frazelle <github@jessfraz.com> * spelling --------- Signed-off-by: Jess Frazelle <github@jessfraz.com> Co-authored-by: benjamaan476 <ben@zoo.dev>
1 parent 1751e27 commit 8f0f54c

File tree

2 files changed

+30
-22
lines changed

2 files changed

+30
-22
lines changed

modeling-cmds/src/def_enum.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1545,9 +1545,11 @@ define_modeling_cmd_enum! {
15451545
#[derive(Clone, Debug, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant)]
15461546
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
15471547
#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1548-
pub struct Solid3dGetInfo {
1548+
pub struct Solid3dGetAdjacencyInfo {
15491549
/// The Solid3d object whose info is being queried.
15501550
pub object_id: Uuid,
1551+
/// Any edge that lies on the extrusion base path.
1552+
pub edge_id: Uuid,
15511553
}
15521554

15531555

modeling-cmds/src/ok_response.rs

Lines changed: 27 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@ impl crate::ModelingCmdOutput for () {}
66
define_ok_modeling_cmd_response_enum! {
77
/// Output from Modeling API commands.
88
pub mod output {
9-
use std::collections::HashMap;
10-
119
use kittycad_modeling_cmds_macros::ModelingCmdOutput;
1210
use schemars::JsonSchema;
1311
use serde::{Deserialize, Serialize};
@@ -480,6 +478,14 @@ define_ok_modeling_cmd_response_enum! {
480478
pub entity_ids: Vec<Uuid>,
481479
}
482480

481+
/// Extrusion face info struct (useful for maintaining mappings between source path segment ids and extrusion faces)
482+
/// This includes the opposite and adjacent faces and edges.
483+
#[derive(Debug, Serialize, Deserialize, Clone, JsonSchema, ModelingCmdOutput)]
484+
pub struct Solid3dGetAdjacencyInfo {
485+
/// Details of each edge.
486+
pub edges: Vec<AdjacencyInfo>,
487+
}
488+
483489
/// The response from the `Solid3dGetAllEdgeFaces` command.
484490
#[derive(Debug, Serialize, Deserialize, Clone, JsonSchema, ModelingCmdOutput)]
485491
pub struct Solid3dGetAllEdgeFaces {
@@ -778,6 +784,15 @@ define_ok_modeling_cmd_response_enum! {
778784
pub edges: Vec<Uuid>,
779785
}
780786

787+
/// A list of faces for a specific edge.
788+
#[derive(Debug, Serialize, Deserialize, Clone, JsonSchema, ModelingCmdOutput)]
789+
pub struct EdgeInfo {
790+
/// The UUID of the id.
791+
pub edge_id: Uuid,
792+
/// The faces of each edge.
793+
pub faces: Vec<Uuid>,
794+
}
795+
781796
/// The response from the `EntityClone` command.
782797
#[derive(Debug, Serialize, Deserialize, Clone, JsonSchema, ModelingCmdOutput)]
783798
pub struct EntityClone {
@@ -890,28 +905,19 @@ define_ok_modeling_cmd_response_enum! {
890905
pub adjacent_ids: Vec<Uuid>,
891906
}
892907

893-
/// Extrusion face info struct (useful for maintaining mappings between source path segment ids and extrusion faces)
894-
#[derive(Debug, Serialize, Deserialize, Clone, JsonSchema, ModelingCmdOutput)]
895-
pub struct Solid3dGetInfo {
896-
/// Details of each face.
897-
pub info: SolidInfo,
898-
}
899908

900-
/// Solid info struct (useful for maintaining mappings between edges and faces and
909+
/// Edge info struct (useful for maintaining mappings between edges and faces and
901910
/// adjacent/opposite edges).
902911
#[derive(Debug, Serialize, Deserialize, Clone, JsonSchema, ModelingCmdOutput)]
903-
pub struct SolidInfo {
904-
/// UUID for top cap.
905-
pub top_cap_id: Option<Uuid>,
906-
907-
/// UUID for bottom cap.
908-
pub bottom_cap_id: Option<Uuid>,
909-
910-
/// A map containing the common faces for all edges.
911-
pub common_edges: HashMap<Uuid, Vec<Uuid>>,
912-
913-
/// A map containing the adjacent and opposite edge ids of each wall face.
914-
pub complementary_edges: HashMap<Uuid, ComplementaryEdges>,
912+
pub struct AdjacencyInfo {
913+
/// Edge id.
914+
pub edge_id: Uuid,
915+
/// Opposite edge and face info.
916+
#[serde(default, skip_serializing_if = "Option::is_none")]
917+
pub opposite_info: Option<EdgeInfo>,
918+
/// Adjacent edge and face info.
919+
#[serde(default, skip_serializing_if = "Option::is_none")]
920+
pub adjacent_info: Option<EdgeInfo>,
915921
}
916922

917923
/// The response from the 'SetGridReferencePlane'.

0 commit comments

Comments
 (0)