Merge pull request #1324 from ghost/extrude-typed-height

This commit is contained in:
Hakan Seven committed 2026-09-17 07:16:49 +03:00
commit 95cf265aaa
1 file changed
+30
+30
View File
@@ -472,6 +472,9 @@ impl CadCommand for ExtrudeCommand {
fn dyn_live_value(&self, cursor: DVec3) -> Option<f64> {
Some((cursor - self.anchor).dot(self.profile_direction?))
}
fn dyn_commit_as_text(&self) -> bool {
self.step == ExtrudeStep::Height
}
fn is_selection_gathering(&self) -> bool {
self.step == ExtrudeStep::Pick
}
@@ -2839,6 +2842,33 @@ inventory::submit!(crate::command::CommandRegistration {
inventory::submit!(crate::command::CommandRegistration { names: &["LOFT"] });
inventory::submit!(crate::command::CommandRegistration { names: &["REVOLVE"] });
#[cfg(test)]
mod extrude_command_tests {
use super::*;
#[test]
fn typed_height_commits_through_the_text_path() {
let mut command = ExtrudeCommand::new_named("EXTRUDE", [1.0; 4]);
assert!(!command.dyn_commit_as_text());
command.set_preselection(
vec![(
Handle::new(1),
EntityType::Circle(acadrust::entities::Circle::new()),
)],
DVec3::ZERO,
Some(DVec3::Z),
);
assert!(command.dyn_commit_as_text());
assert!(matches!(
command.on_text_input("5"),
Some(CmdResult::ExtrudeEntities {
extent: ExtrudeExtent::Height(5.0),
..
})
));
}
}
#[cfg(test)]
mod revolve_tests {
use super::*;