From fb460227fa656dcedebd175cbc057eb20c37bb0c Mon Sep 17 00:00:00 2001 From: Adam Chalmers Date: Tue, 13 May 2025 15:40:51 -0500 Subject: [PATCH 1/2] Add coordinate flag for sweeps Part of https://github.com/KittyCAD/engine/issues/3115 --- modeling-cmds/src/def_enum.rs | 4 ++++ modeling-cmds/src/shared.rs | 13 +++++++++++++ 2 files changed, 17 insertions(+) diff --git a/modeling-cmds/src/def_enum.rs b/modeling-cmds/src/def_enum.rs index f0e76dc5..47510156 100644 --- a/modeling-cmds/src/def_enum.rs +++ b/modeling-cmds/src/def_enum.rs @@ -24,6 +24,7 @@ define_modeling_cmd_enum! { shared::{ Angle, ComponentTransform, + RelativeTo, CutType, CutStrategy, CameraMovement, @@ -140,6 +141,9 @@ define_modeling_cmd_enum! { pub sectional: bool, /// The maximum acceptable surface gap computed between the revolution surface joints. Must be positive (i.e. greater than zero). pub tolerance: LengthUnit, + /// What is this sweep relative to? + #[serde(default)] + pub relative_to: RelativeTo, } /// Command for revolving a solid 2d. diff --git a/modeling-cmds/src/shared.rs b/modeling-cmds/src/shared.rs index 14dd1484..9f83b268 100644 --- a/modeling-cmds/src/shared.rs +++ b/modeling-cmds/src/shared.rs @@ -1152,3 +1152,16 @@ pub enum CutStrategy { #[default] Automatic, } + +/// What is the given geometry relative to? +#[derive(Debug, Clone, Copy, PartialEq, Serialize, Deserialize, JsonSchema, Default)] +#[serde(rename_all = "snake_case")] +#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))] +#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))] +pub enum RelativeTo { + /// Local/relative to a position centered within the XY plane + #[default] + XYPlane, + /// Local/relative to the trajectory curve + TrajectoryCurve, +} From 1c7579205dae162347d3d658de28c7def1c3bca5 Mon Sep 17 00:00:00 2001 From: Adam Chalmers Date: Wed, 14 May 2025 08:21:35 -0500 Subject: [PATCH 2/2] Rename XYPlane to SketchPlane --- modeling-cmds/src/shared.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modeling-cmds/src/shared.rs b/modeling-cmds/src/shared.rs index 9f83b268..ba82f5ff 100644 --- a/modeling-cmds/src/shared.rs +++ b/modeling-cmds/src/shared.rs @@ -1159,9 +1159,9 @@ pub enum CutStrategy { #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))] #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))] pub enum RelativeTo { - /// Local/relative to a position centered within the XY plane + /// Local/relative to a position centered within the plane being sketched on #[default] - XYPlane, + SketchPlane, /// Local/relative to the trajectory curve TrajectoryCurve, }