Restore primitive properties after edge operations

This commit is contained in:
ramox81 committed 2026-09-08 17:11:23 +03:00
1 parent 43f97a3bcb
commit 261ab66afd
5 files changed
+62 -12

No files matched your search

+16 -3
View File
@@ -201,7 +201,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(_)
@@ -218,6 +218,19 @@ pub fn has_specialized_primitive_properties(
)
}
/// Return the primitive that owns the public Geometry rows. Later operations
/// such as edge fillets and chamfers refine that primitive but do not replace
/// 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
@@ -1442,10 +1455,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")
}