Complete EXTRUDE behavior and properties

This commit is contained in:
ramox81 committed 2026-09-02 10:25:00 +03:00
1 parent bde9cc2715
commit 847d218c35
13 files changed
+912 -108

No files matched your search

+18 -12
View File
@@ -736,21 +736,27 @@ impl OpenCADStudio {
// ── EXTRUDE ────────────────────────────────────────────────────
"EXTRUDE" | "THICKEN" => {
use crate::modules::insert::solid3d_cmds::ExtrudeCommand;
// If a single entity is already selected, skip the pick step.
// A preselection becomes the complete source set; otherwise
// the interactive command gathers any number of profiles.
let selected: Vec<_> = self.tabs[i].scene.selected_entities().into_iter().collect();
let color = self.tabs[i].scene.layer_color(&self.tabs[i].active_layer);
if selected.len() == 1 {
let handle = selected[0].0;
if !selected.is_empty() {
let mut cmd = ExtrudeCommand::new_named(cmd, color);
if let Some(curve) = crate::entities::curve::entity_curve(selected[0].1) {
cmd.set_entity_pick_direction(
curve.plane.normal().map(glam::DVec3::from_array),
);
cmd.on_entity_pick(
handle,
glam::DVec3::from_array(curve.plane.origin),
);
}
let first_curve = selected
.iter()
.find_map(|(_, entity)| crate::entities::curve::entity_curve(entity));
let anchor = first_curve
.as_ref()
.map(|curve| glam::DVec3::from_array(curve.plane.origin))
.unwrap_or(glam::DVec3::ZERO);
let direction = first_curve
.and_then(|curve| curve.plane.normal())
.map(glam::DVec3::from_array);
cmd.set_preselection(
selected.iter().map(|(handle, _)| *handle).collect(),
anchor,
direction,
);
self.command_line.push_info(&cmd.prompt());
self.tabs[i].active_cmd = Some(Box::new(cmd));
} else {