forked from 1b-agent/opencadstudio-upstream
Restore editable extrusion surface grips
This commit is contained in:
1 parent
b19992cbcb
commit
c0b254950f
3 files changed
+52
-5
No files matched your search
@@ -3756,10 +3756,36 @@ impl OpenCADStudio {
|
|||||||
let direction = direction
|
let direction = direction
|
||||||
.or(path_direction)
|
.or(path_direction)
|
||||||
.unwrap_or(glam::DVec3::ZERO);
|
.unwrap_or(glam::DVec3::ZERO);
|
||||||
self.add_surface_model(
|
let history = path
|
||||||
empty_extruded_surface(direction, taper_angle),
|
.is_none()
|
||||||
body,
|
.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 {
|
} else {
|
||||||
let direction = direction.unwrap_or(glam::DVec3::ZERO);
|
let direction = direction.unwrap_or(glam::DVec3::ZERO);
|
||||||
let history = path
|
let history = path
|
||||||
|
|||||||
@@ -402,6 +402,24 @@ impl super::OpenCADStudio {
|
|||||||
self.add_surface_model_inner(entity, surface, true)
|
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(
|
fn add_surface_model_preserving_style(
|
||||||
&mut self,
|
&mut self,
|
||||||
entity: EntityType,
|
entity: EntityType,
|
||||||
|
|||||||
@@ -3307,6 +3307,7 @@ pub fn primitive_grips(
|
|||||||
if let SolidHistoryOperation::Chamfer(value) = operation {
|
if let SolidHistoryOperation::Chamfer(value) = operation {
|
||||||
return chamfer_distance_grips(document, handle, value);
|
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 grips = Vec::new();
|
||||||
let mut add = |id, transform, point, shape, axis: Option<[f64; 3]>| {
|
let mut add = |id, transform, point, shape, axis: Option<[f64; 3]>| {
|
||||||
if let Some(world) = world_point(transform, point) {
|
if let Some(world) = world_point(transform, point) {
|
||||||
@@ -3528,7 +3529,9 @@ pub fn primitive_grips(
|
|||||||
}
|
}
|
||||||
SolidHistoryOperation::Extrusion(value) => {
|
SolidHistoryOperation::Extrusion(value) => {
|
||||||
let (profile_grips, profile_center) = extrusion_profile_grips(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];
|
let direction = [value.direction.x, value.direction.y, value.direction.z];
|
||||||
if value.path_entity.is_none() {
|
if value.path_entity.is_none() {
|
||||||
if let (Some(center), Some(base)) = (profile_center, matrix(value.base.transform)) {
|
if let (Some(center), Some(base)) = (profile_center, matrix(value.base.transform)) {
|
||||||
|
|||||||
Reference in new issue
Block a user