Restore editable extrusion surface grips

This commit is contained in:
ramox81 committed 2026-09-10 13:44:10 +03:00
1 parent b19992cbcb
commit c0b254950f
3 files changed
+52 -5

No files matched your search

+30 -4
View File
@@ -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
+18
View File
@@ -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,
+4 -1
View File
@@ -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)) {