forked from 1b-agent/opencadstudio-upstream
Support first-point reset and same-point breaks
This commit is contained in:
1 parent
7d0c059b30
commit
a3eee372e4
1 file changed
+23
-1
@@ -382,7 +382,7 @@ impl CadCommand for BreakInteractiveCommand {
|
||||
} else if self.p1.is_none() {
|
||||
crate::t!("BREAK Specify first break point:").into_owned()
|
||||
} else {
|
||||
crate::t!("BREAK Specify second break point:").into_owned()
|
||||
crate::t!("BREAK Specify second break point or [First point]:").into_owned()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -390,6 +390,28 @@ impl CadCommand for BreakInteractiveCommand {
|
||||
self.target.is_none()
|
||||
}
|
||||
|
||||
fn options(&self) -> Vec<crate::command::CmdOption> {
|
||||
if self.target.is_some() && self.p1.is_some() {
|
||||
vec![crate::command::CmdOption::new("First point", "F")]
|
||||
} else {
|
||||
Vec::new()
|
||||
}
|
||||
}
|
||||
|
||||
fn on_text_input(&mut self, text: &str) -> Option<CmdResult> {
|
||||
let handle = self.target?;
|
||||
match text.trim().to_ascii_uppercase().as_str() {
|
||||
"F" | "FIRST" => {
|
||||
self.p1 = None;
|
||||
Some(CmdResult::NeedPoint)
|
||||
}
|
||||
"@" => self.p1.map(|point| CmdResult::BreakEntity {
|
||||
handle, p1: point, p2: point,
|
||||
}),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
|
||||
fn on_entity_pick(&mut self, handle: Handle, pt: DVec3) -> CmdResult {
|
||||
if handle.is_null() {
|
||||
return CmdResult::NeedPoint;
|
||||
|
||||
Reference in new issue
Block a user