diff --git a/src/app/commands/draw.rs b/src/app/commands/draw.rs index 835e50284..4a914079c 100644 --- a/src/app/commands/draw.rs +++ b/src/app/commands/draw.rs @@ -838,11 +838,17 @@ impl OpenCADStudio { } // PYRAMID [sides] — create an n-sided pyramid mesh. - cmd if cmd == "PYRAMID" - || cmd.starts_with("PYRAMID ") - || cmd == "PYR" - || cmd.starts_with("PYR ") => - { + "PYRAMID" | "PYR" => { + use crate::command::TwoValuePromptCommand; + let c = TwoValuePromptCommand::new( + "PYRAMID", + "PYRAMID base radius:", + "PYRAMID height (add sides by typing a 3rd number):", + ); + self.command_line.push_info(&c.prompt()); + self.tabs[i].active_cmd = Some(Box::new(c)); + } + cmd if cmd.starts_with("PYRAMID ") || cmd.starts_with("PYR ") => { let nums: Vec = cmd .split_whitespace() .skip(1) @@ -857,7 +863,23 @@ impl OpenCADStudio { } // SECTION [X|Y|Z] — draw the cross-section outline of the solid. - cmd if cmd == "SECTION" || cmd.starts_with("SECTION ") => { + "SECTION" => { + use crate::command::SelectThenKeywordCommand; + let has_sel = !self.tabs[i].scene.selected_entities().is_empty(); + let c = SelectThenKeywordCommand::new( + "SECTION", + "SECTION cutting-plane axis [X / Y / Z]:", + vec![ + ("X", "X", Some("SECTION offset along X:")), + ("Y", "Y", Some("SECTION offset along Y:")), + ("Z", "Z", Some("SECTION offset along Z:")), + ], + has_sel, + ); + self.command_line.push_info(&c.prompt()); + self.tabs[i].active_cmd = Some(Box::new(c)); + } + cmd if cmd.starts_with("SECTION ") => { let parts: Vec = cmd .split_whitespace() .skip(1) @@ -903,11 +925,19 @@ impl OpenCADStudio { } // 3DMIRROR [X|Y|Z] — add a mirror of the selected solid across a plane. - cmd if cmd == "3DMIRROR" - || cmd == "MIRROR3D" - || cmd.starts_with("3DMIRROR ") - || cmd.starts_with("MIRROR3D ") => - { + "3DMIRROR" | "MIRROR3D" => { + use crate::command::SelectThenKeywordCommand; + let has_sel = !self.tabs[i].scene.selected_entities().is_empty(); + let c = SelectThenKeywordCommand::new( + "3DMIRROR", + "3DMIRROR mirror plane [X / Y / Z]:", + vec![("X", "X", None), ("Y", "Y", None), ("Z", "Z", None)], + has_sel, + ); + self.command_line.push_info(&c.prompt()); + self.tabs[i].active_cmd = Some(Box::new(c)); + } + cmd if cmd.starts_with("3DMIRROR ") || cmd.starts_with("MIRROR3D ") => { let parts: Vec = cmd .split_whitespace() .skip(1) @@ -928,11 +958,23 @@ impl OpenCADStudio { } // 3DROTATE [X|Y|Z] — rotate the selected solid about an axis. - cmd if cmd == "3DROTATE" - || cmd == "ROTATE3D" - || cmd.starts_with("3DROTATE ") - || cmd.starts_with("ROTATE3D ") => - { + "3DROTATE" | "ROTATE3D" => { + use crate::command::SelectThenKeywordCommand; + let has_sel = !self.tabs[i].scene.selected_entities().is_empty(); + let c = SelectThenKeywordCommand::new( + "3DROTATE", + "3DROTATE rotation axis [X / Y / Z]:", + vec![ + ("X", "X", Some("3DROTATE angle in degrees:")), + ("Y", "Y", Some("3DROTATE angle in degrees:")), + ("Z", "Z", Some("3DROTATE angle in degrees:")), + ], + has_sel, + ); + self.command_line.push_info(&c.prompt()); + self.tabs[i].active_cmd = Some(Box::new(c)); + } + cmd if cmd.starts_with("3DROTATE ") || cmd.starts_with("ROTATE3D ") => { let parts: Vec = cmd .split_whitespace() .skip(1) @@ -954,11 +996,23 @@ impl OpenCADStudio { // SLICE [X|Y|Z] [TOP|BOTTOM] — cut the selected solid with an // axis-aligned plane, keeping the lower half by default. - cmd if cmd == "SLICE" - || cmd == "SL" - || cmd.starts_with("SLICE ") - || cmd.starts_with("SL ") => - { + "SLICE" | "SL" => { + use crate::command::SelectThenKeywordCommand; + let has_sel = !self.tabs[i].scene.selected_entities().is_empty(); + let c = SelectThenKeywordCommand::new( + "SLICE", + "SLICE cutting-plane axis [X / Y / Z] (add TOP/BOTTOM by typing):", + vec![ + ("X", "X", Some("SLICE offset along X:")), + ("Y", "Y", Some("SLICE offset along Y:")), + ("Z", "Z", Some("SLICE offset along Z:")), + ], + has_sel, + ); + self.command_line.push_info(&c.prompt()); + self.tabs[i].active_cmd = Some(Box::new(c)); + } + cmd if cmd.starts_with("SLICE ") || cmd.starts_with("SL ") => { let parts: Vec = cmd .split_whitespace() .skip(1) diff --git a/src/app/commands/inquiry.rs b/src/app/commands/inquiry.rs index 1ecaaee4f..07532c75b 100644 --- a/src/app/commands/inquiry.rs +++ b/src/app/commands/inquiry.rs @@ -55,10 +55,13 @@ impl OpenCADStudio { // CAL / QUICKCALC — evaluate an arithmetic expression // (+ - * /, parentheses, unary minus, decimals). - cmd if cmd == "CAL" - || cmd == "QUICKCALC" - || cmd == "QC" - || cmd.starts_with("CAL ") + "CAL" | "QUICKCALC" | "QC" => { + use crate::command::ValuePromptCommand; + let c = ValuePromptCommand::new("CAL", "CAL expression (e.g. (2+3)*4):"); + self.command_line.push_info(&c.prompt()); + self.tabs[self.active_tab].active_cmd = Some(Box::new(c)); + } + cmd if cmd.starts_with("CAL ") || cmd.starts_with("QUICKCALC ") || cmd.starts_with("QC ") => { @@ -922,11 +925,25 @@ impl OpenCADStudio { // FIND — list all Text/MText/Dimension containing // FIND REPLACE — replace first occurrence (case-insensitive) // FINDALL REPLACE — replace all occurrences - cmd if cmd == "FIND" - || cmd.starts_with("FIND ") - || cmd == "FINDALL" - || cmd.starts_with("FINDALL ") => - { + "FIND" => { + use crate::command::ValuePromptCommand; + let c = ValuePromptCommand::new( + "FIND", + "FIND text to find (add REPLACE by typing):", + ); + self.command_line.push_info(&c.prompt()); + self.tabs[self.active_tab].active_cmd = Some(Box::new(c)); + } + "FINDALL" => { + use crate::command::ValuePromptCommand; + let c = ValuePromptCommand::new( + "FINDALL", + "FINDALL text to find (add REPLACE by typing):", + ); + self.command_line.push_info(&c.prompt()); + self.tabs[self.active_tab].active_cmd = Some(Box::new(c)); + } + cmd if cmd.starts_with("FIND ") || cmd.starts_with("FINDALL ") => { let all_mode = cmd.starts_with("FINDALL"); let rest = cmd.split_once(' ').map(|(_, r)| r.trim()).unwrap_or("");