From c0b254950f93b35baff05a6327b4ea7085bff673 Mon Sep 17 00:00:00 2001 From: ramox81 <184937705+ramox81@users.noreply.github.com> Date: Thu, 10 Sep 2026 13:44:10 +0300 Subject: [PATCH] Restore editable extrusion surface grips --- src/app/command_driver.rs | 34 ++++++++++++++++++++++++++++---- src/app/model_ops.rs | 18 +++++++++++++++++ src/scene/model/solid_history.rs | 5 ++++- 3 files changed, 52 insertions(+), 5 deletions(-) diff --git a/src/app/command_driver.rs b/src/app/command_driver.rs index 11b618695..1f1156798 100644 --- a/src/app/command_driver.rs +++ b/src/app/command_driver.rs @@ -3756,10 +3756,36 @@ impl OpenCADStudio { let direction = direction .or(path_direction) .unwrap_or(glam::DVec3::ZERO); - self.add_surface_model( - empty_extruded_surface(direction, taper_angle), - body, - ) + let history = path + .is_none() + .then(|| { + sweep_model::extrusion_history( + &entity, + None, + direction.to_array(), + taper_angle, + profile.plane.origin, + ) + }) + .flatten(); + let mut surface = empty_extruded_surface(direction, taper_angle); + if let ( + Some(acadrust::objects::SolidHistoryOperation::Extrusion(value)), + acadrust::EntityType::Surface(entity), + ) = (&history, &mut surface) + { + if let Some(data) = + crate::scene::model::solid_history::extrusion_surface_data(value) + { + entity.surface_data = data; + } + } + match history { + Some(history) => { + self.add_surface_model_with_history(surface, body, history) + } + None => self.add_surface_model(surface, body), + } } else { let direction = direction.unwrap_or(glam::DVec3::ZERO); let history = path diff --git a/src/app/model_ops.rs b/src/app/model_ops.rs index 4bb5d2041..3d8b57541 100644 --- a/src/app/model_ops.rs +++ b/src/app/model_ops.rs @@ -402,6 +402,24 @@ impl super::OpenCADStudio { self.add_surface_model_inner(entity, surface, true) } + pub(super) fn add_surface_model_with_history( + &mut self, + entity: EntityType, + surface: Body, + history: SolidHistoryOperation, + ) -> Handle { + let i = self.active_tab; + let handle = self.add_surface_model_inner(entity, surface, true); + if handle.is_null() { + return handle; + } + if !self.tabs[i].scene.create_solid_history(handle, history) { + self.tabs[i].scene.rollback_new_entities(&[handle]); + return Handle::NULL; + } + handle + } + fn add_surface_model_preserving_style( &mut self, entity: EntityType, diff --git a/src/scene/model/solid_history.rs b/src/scene/model/solid_history.rs index f9cc88bb6..a11274ea4 100644 --- a/src/scene/model/solid_history.rs +++ b/src/scene/model/solid_history.rs @@ -3307,6 +3307,7 @@ pub fn primitive_grips( if let SolidHistoryOperation::Chamfer(value) = operation { return chamfer_distance_grips(document, handle, value); } + let is_surface = matches!(document.get_entity(handle), Some(EntityType::Surface(_))); let mut grips = Vec::new(); let mut add = |id, transform, point, shape, axis: Option<[f64; 3]>| { if let Some(world) = world_point(transform, point) { @@ -3528,7 +3529,9 @@ pub fn primitive_grips( } SolidHistoryOperation::Extrusion(value) => { let (profile_grips, profile_center) = extrusion_profile_grips(value); - grips.extend(profile_grips); + if !is_surface { + grips.extend(profile_grips); + } let direction = [value.direction.x, value.direction.y, value.direction.z]; if value.path_entity.is_none() { if let (Some(center), Some(base)) = (profile_center, matrix(value.base.transform)) {