Skip to content

Commit d32d2f5

Browse files
Ben/solid info (#877)
* SolidInfo * spelling * Update ok_response.rs --------- Co-authored-by: benjamaan476 <ben@zoo.dev>
1 parent 56c4927 commit d32d2f5

File tree

2 files changed

+45
-0
lines changed

2 files changed

+45
-0
lines changed

modeling-cmds/src/def_enum.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1541,6 +1541,16 @@ define_modeling_cmd_enum! {
15411541
pub edge_id: Uuid,
15421542
}
15431543

1544+
/// Get a concise description of all of solids edges.
1545+
#[derive(Clone, Debug, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant)]
1546+
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1547+
#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1548+
pub struct Solid3dGetInfo {
1549+
/// The Solid3d object whose info is being queried.
1550+
pub object_id: Uuid,
1551+
}
1552+
1553+
15441554
/// Clear the selection
15451555
#[derive(Clone, Debug, Default, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant)]
15461556
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]

modeling-cmds/src/ok_response.rs

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ 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;
910

1011
use kittycad_modeling_cmds_macros::ModelingCmdOutput;
1112
use schemars::JsonSchema;
@@ -879,6 +880,40 @@ define_ok_modeling_cmd_response_enum! {
879880
pub cap: ExtrusionFaceCapType,
880881
}
881882

883+
/// Struct to contain the edge information of a wall of an extrude/rotate/loft/sweep.
884+
#[derive(Debug, Serialize, Deserialize, Clone, JsonSchema, ModelingCmdOutput)]
885+
pub struct ComplementaryEdges {
886+
/// The opposite edge has no common vertices with the original edge. A wall may not
887+
/// have an opposite edge (i.e. a revolve that touches the axis of rotation).
888+
pub opposite_id: Option<Uuid>,
889+
/// Every edge that shared one common vertex with the original edge.
890+
pub adjacent_ids: Vec<Uuid>,
891+
}
892+
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+
}
899+
900+
/// Solid info struct (useful for maintaining mappings between edges and faces and
901+
/// adjacent/opposite edges).
902+
#[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>,
915+
}
916+
882917
/// The response from the 'SetGridReferencePlane'.
883918
#[derive(Debug, Serialize, Deserialize, Clone, JsonSchema, ModelingCmdOutput)]
884919
pub struct SetGridReferencePlane {}

0 commit comments

Comments
 (0)