Skip to content

Commit 729d888

Browse files
committed
revert back to enum
1 parent 3c512e9 commit 729d888

1 file changed

Lines changed: 15 additions & 61 deletions

File tree

modeling-cmds/src/shared.rs

Lines changed: 15 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -11,80 +11,34 @@ use crate::{length_unit::LengthUnit, output::ExtrusionFaceInfo, units::UnitAngle
1111

1212
mod point;
1313

14-
/// Params required to perform a fillet cut of an edge.
15-
#[derive(Debug, Clone, Copy, PartialEq, Serialize, Deserialize, JsonSchema)]
16-
#[serde(rename_all = "snake_case")]
17-
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
18-
#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
19-
pub struct FilletParams {
20-
/// The second length affects the edge length of the second face of the cut. This will
21-
/// cause the fillet to take on the shape of a conic section, instead of an arc.
22-
pub second_length: Option<LengthUnit>,
23-
}
24-
25-
impl Default for FilletParams {
26-
fn default() -> FilletParams {
27-
FilletParams { second_length: None }
28-
}
29-
}
30-
31-
/// Params required to perform a chamfer cut of an edge.
32-
#[derive(Debug, Clone, Copy, PartialEq, Serialize, Deserialize, JsonSchema)]
33-
#[serde(rename_all = "snake_case")]
34-
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
35-
#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
36-
pub struct ChamferParams {
37-
/// The second length affects the edge length of the second face of the cut.
38-
pub second_length: Option<LengthUnit>,
39-
/// The angle of the chamfer, default is 45deg.
40-
pub angle: Option<Angle>,
41-
/// If true, the second length or angle is applied to the other face of the cut.
42-
pub swap: bool,
43-
}
44-
45-
impl Default for ChamferParams {
46-
fn default() -> ChamferParams {
47-
ChamferParams {
48-
second_length: None,
49-
angle: None,
50-
swap: false,
51-
}
52-
}
53-
}
54-
55-
/// Params required to perform a custom profile cut of an edge.
56-
#[derive(Debug, Clone, Copy, PartialEq, Serialize, Deserialize, JsonSchema)]
57-
#[serde(rename_all = "snake_case")]
58-
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
59-
#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
60-
pub struct CustomParams {
61-
/// The path that will be used for the custom profile.
62-
pub path: Uuid,
63-
}
64-
65-
impl Default for CustomParams {
66-
fn default() -> CustomParams {
67-
CustomParams { path: Uuid::nil() }
68-
}
69-
}
70-
7114
/// What kind of cut to perform when cutting an edge.
7215
#[derive(Debug, Clone, Copy, PartialEq, Serialize, Deserialize, JsonSchema)]
7316
#[serde(rename_all = "snake_case")]
7417
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
7518
#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
7619
pub enum CutType {
7720
/// Round off an edge.
78-
Fillet(FilletParams),
21+
Fillet,
7922
/// Cut away an edge.
80-
Chamfer(ChamferParams),
23+
Chamfer {
24+
/// The second length affects the edge length of the second face of the cut.
25+
second_length: Option<LengthUnit>,
26+
/// The angle of the chamfer, default is 45deg.
27+
angle: Option<Angle>,
28+
/// If true, the second length or angle is applied to the other face of the cut.
29+
swap: bool,
30+
31+
},
8132
/// A custom cut profile.
82-
Custom(CustomParams),
33+
Custom {
34+
/// The path that will be used for the custom profile.
35+
path: Uuid,
36+
},
8337
}
8438

8539
impl Default for CutType {
8640
fn default() -> Self {
87-
crate::shared::CutType::Fillet(FilletParams::default())
41+
crate::shared::CutType::Fillet
8842
}
8943
}
9044

0 commit comments

Comments
 (0)