fix(constraints): keep constraint groups the rebuild cannot write

Saving `starttekening.dwg` unchanged lost 275 associative objects: the
constraint network rebuilt before saving cannot write a dimensional
constraint that drives a dynamic block's constraint parameter instead of
a dimension, nor separate dependencies on single edges of one polyline.
The block parameters ended up pointing at erased objects. A group with
either link is now kept as read, through the existing preserved-group
path; ODA counts the same 1948 associative proxies before and after.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
Hakan SevenandClaude Opus 5.5 committed 2026-10-15 20:36:36 +03:00
1 parent 72c762e944
commit 44c6ddc513
1 file changed
+20 -1
+20 -1
View File
@@ -1727,7 +1727,26 @@ fn dependency_entity(
}
fn group_requires_preservation(document: &CadDocument, group: &Assoc2dConstraintGroup) -> bool {
group.nodes.iter().any(|node| {
// Links the rebuild does not write: a dimensional constraint driving a
// dynamic block's constraint parameter rather than a dimension, and
// single edges of one polyline each held by a dependency of its own.
let mut curves = Vec::new();
let unmodelled = group.actions.iter().any(|handle| match document.objects.get(handle) {
Some(ObjectType::Associative(AssociativeObject { data, .. })) => match data {
AssociativeData::Dependency(dependency) => {
document.objects.contains_key(&dependency.dependent_on)
}
AssociativeData::GeomDependency(geometry) => {
let curve = geometry.dependency.dependent_on;
let repeated = curves.contains(&curve);
curves.push(curve);
repeated
}
_ => false,
},
_ => false,
});
unmodelled || group.nodes.iter().any(|node| {
if matches!(node.data, AssocConstraintNodeData::RigidSet { .. }) {
return true;
}