Keep primitive properties editable after fillet

This commit is contained in:
ramox81 committed 2026-09-08 17:35:51 +03:00
1 parent ed8cddc556
commit f16423ef8e
5 files changed
+57 -12

No files matched your search

+5
View File
@@ -652,6 +652,11 @@ impl super::OpenCADStudio {
.push_error(crate::t!("The fillet history could not be recorded.").as_ref());
return false;
}
let _ = self.tabs[i].scene.apply_solid_history_choice(
handle,
solid_history::PROP_HISTORY,
"Record",
);
let Some(EntityType::Solid3D(mut entity)) =
self.tabs[i].scene.document.get_entity(handle).cloned()
else {
+16 -3
View File
@@ -198,7 +198,7 @@ pub fn has_specialized_primitive_properties(
handle: acadrust::Handle,
) -> bool {
matches!(
document.solid_history_operation(handle),
primitive_property_operation(document, handle).as_ref(),
Some(
SolidHistoryOperation::Box(_)
| SolidHistoryOperation::Wedge(_)
@@ -215,6 +215,19 @@ pub fn has_specialized_primitive_properties(
)
}
/// Return the primitive that owns the public Geometry rows. Later edge
/// operations refine that primitive without replacing its editable type,
/// position, or dimensions.
pub fn primitive_property_operation(
document: &acadrust::CadDocument,
handle: acadrust::Handle,
) -> Option<SolidHistoryOperation> {
document
.solid_history_operations(handle)
.and_then(|operations| operations.into_iter().next())
.or_else(|| document.solid_history_operation(handle).cloned())
}
/// Solid history results whose public Properties palette is fully described by
/// the common entity rows plus [`primitive_properties`]. A generic B-rep has
/// no stable primitive dimensions to expose, but it still uses the compact
@@ -1439,10 +1452,10 @@ pub fn primitive_properties(
document: &acadrust::CadDocument,
handle: acadrust::Handle,
) -> Vec<PropSection> {
let Some(operation) = document.solid_history_operation(handle) else {
let Some(operation) = primitive_property_operation(document, handle) else {
return brep_properties(document, handle);
};
match operation {
match &operation {
SolidHistoryOperation::Box(value) => {
rectangular_properties(document, handle, value, "Box")
}
+32 -5
View File
@@ -828,8 +828,13 @@ impl Scene {
pub(crate) fn sync_solid_reference_point(&mut self, handle: Handle) {
let reference = self
.document
.solid_history_operation(handle)
.and_then(crate::scene::model::solid_history::reference_point);
.solid_history_operations(handle)
.and_then(|operations| {
operations
.iter()
.rev()
.find_map(crate::scene::model::solid_history::reference_point)
});
let Some(reference) = reference else {
return;
};
@@ -883,7 +888,24 @@ impl Scene {
}
(EntityType::Solid3D(_), _) => {
let mut operations = self.document.solid_history_operations(handle)?;
*operations.last_mut()? = operation.clone();
let replacement_id = operation.base().map(|base| {
if base.eval.node_id > 0 {
base.eval.node_id
} else {
base.step_id
}
})?;
let target = operations.iter_mut().find(|candidate| {
candidate.base().is_some_and(|base| {
let node_id = if base.eval.node_id > 0 {
base.eval.node_id
} else {
base.step_id
};
node_id == replacement_id
})
})?;
*target = operation.clone();
cadkernel::acis::rebuild_history(&operations).ok()
}
_ => None,
@@ -938,7 +960,7 @@ impl Scene {
self.record_solid_history_before(handle);
if self
.document
.update_solid_history(handle, operation)
.update_solid_history_step(handle, operation)
.is_none()
{
return false;
@@ -1199,7 +1221,12 @@ impl Scene {
field: &str,
value: &str,
) -> bool {
let Some(mut operation) = self.document.solid_history_operation(handle).cloned() else {
let Some(mut operation) =
crate::scene::model::solid_history::primitive_property_operation(
&self.document,
handle,
)
else {
return false;
};
if !crate::scene::model::solid_history::apply_primitive_property(