forked from 1b-agent/opencadstudio-upstream
Complete EXTRUDE behavior and editable properties (#965)
Complete EXTRUDE behavior and editable properties
This commit is contained in:
13 files changed
+1615
-114
No files matched your search
+21
-12
@@ -736,21 +736,30 @@ 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, entity)| (*handle, (*entity).clone()))
|
||||
.collect(),
|
||||
anchor,
|
||||
direction,
|
||||
);
|
||||
self.command_line.push_info(&cmd.prompt());
|
||||
self.tabs[i].active_cmd = Some(Box::new(cmd));
|
||||
} else {
|
||||
|
||||
Reference in new issue
Block a user