Merge PR #1051: complete SUBTRACT behavior

This commit is contained in:
Hakan Seven committed 2026-09-07 18:36:04 +03:00
commit 7c2a4d63ff
11 files changed
+605 -71

No files matched your search

+5 -7
View File
@@ -222,11 +222,9 @@ pub fn has_compact_solid_properties(
document: &acadrust::CadDocument,
handle: acadrust::Handle,
) -> bool {
has_specialized_primitive_properties(document, handle)
|| matches!(
document.solid_history_operation(handle),
Some(SolidHistoryOperation::Brep(_))
)
document
.get_entity(handle)
.is_some_and(|entity| matches!(entity, acadrust::EntityType::Solid3D(_)))
}
pub fn reference_point(operation: &SolidHistoryOperation) -> Option<glam::DVec3> {
@@ -1441,7 +1439,7 @@ pub fn primitive_properties(
handle: acadrust::Handle,
) -> Vec<PropSection> {
let Some(operation) = document.solid_history_operation(handle) else {
return Vec::new();
return brep_properties(document, handle);
};
match operation {
SolidHistoryOperation::Box(value) => {
@@ -1462,7 +1460,7 @@ pub fn primitive_properties(
}
SolidHistoryOperation::Revolve(value) => revolve_properties(document, handle, value),
SolidHistoryOperation::Brep(_) => brep_properties(document, handle),
_ => Vec::new(),
_ => brep_properties(document, handle),
}
}
+57 -2
View File
@@ -1046,16 +1046,71 @@ impl Scene {
value: &str,
) -> bool {
self.record_solid_history_before(handle);
let mut created = false;
if self.document.solid_history_graph(handle).is_none() {
let create = match field {
crate::scene::model::solid_history::PROP_HISTORY => {
if value.eq_ignore_ascii_case("Record") {
true
} else if value.eq_ignore_ascii_case("None") {
return false;
} else {
return false;
}
}
crate::scene::model::solid_history::PROP_SHOW_HISTORY
if self.document.header.show_solid_history.clamp(0, 2) == 1 =>
{
if value.eq_ignore_ascii_case("Yes") {
true
} else if value.eq_ignore_ascii_case("No") {
return false;
} else {
return false;
}
}
_ => return false,
};
if create {
if !matches!(self.document.get_entity(handle), Some(EntityType::Solid3D(_))) {
return false;
}
self.restore_solid_models(&[handle]);
let Some(body) = self.solid_models.get(&handle).cloned() else {
return false;
};
if self.is_recording_undo() {
let before = self.document.get_entity_arc(handle);
self.record_undo_before(handle, before);
}
if !self.create_solid_history(
handle,
crate::scene::model::solid_history::brep_op(&body),
) {
return false;
}
// A solid without a graph was displayed as History=None.
// Preserve that object state before applying the requested
// choice, independent of the drawing-wide SOLIDHIST setting.
crate::scene::model::solid_history::apply_history_choice(
&mut self.document,
handle,
crate::scene::model::solid_history::PROP_HISTORY,
"None",
);
created = true;
}
}
let applied = crate::scene::model::solid_history::apply_history_choice(
&mut self.document,
handle,
field,
value,
);
if applied {
if created || applied {
self.bump_entities(&[(handle, ChangeKind::Modified)]);
}
applied
created || applied
}
fn apply_solid_history_grip(