Add DWG/DXF-native constraint persistence alongside the XRecord format

Implements docs/dwg_constraint_compatibility_design.md's staged plan in
full: materializes the sketch-constraint set as acadrust's real
AssocNetwork/Assoc2dConstraintGroup object graph on save, additive to
the existing OCS_SKETCH_CONSTRAINTS XRecord, so files also carry
constraints AutoCAD/BricsCAD recognize as their own native objects
(per Hakan's request on the upstream project). Covers every
ConstraintKind, including AssocVariable wiring for named-parameter
driving values, and clears+rebuilds on each save.

DWG round-trips the full dependency chain; DXF only keeps the
constraint-group shell since acadrust's own DXF writer deliberately
omits AssocDependency-family objects. Both behaviors are covered by
tests and documented in the design doc's progress section, along with
two other implementation-time findings (skipping the NOD-anchored
top-level network, and the DWG writer's root-node/connections wire
format).

Co-Authored-By: Claude Sonnet 5 <[email protected]>
This commit is contained in:
Felix RiestraandClaude Sonnet 5 committed 2026-09-09 17:26:53 +02:00
1 parent 5d93476c01
commit cf33a1d019
4 files changed
+1084 -8

No files matched your search

+5
View File
@@ -1668,6 +1668,10 @@ pub(super) fn on_open_file(&mut self) -> Task<Message> {
// named_parameters_design.md stage 2: same save-time hook, for the
// document-wide parameter table.
self.tabs[i].scene.materialize_named_parameters_for_save();
// docs/dwg_constraint_compatibility_design.md: additive DWG/DXF-
// native constraint graph, alongside (not instead of) the XRecord
// above — same save-time hook.
self.tabs[i].scene.materialize_dwg_native_constraints_for_save();
}
#[cfg(not(target_arch = "wasm32"))]
@@ -2620,6 +2624,7 @@ pub(super) fn on_open_file(&mut self) -> Task<Message> {
self.sync_solid_models_for_save(i);
self.tabs[i].scene.materialize_sketch_constraints_for_save();
self.tabs[i].scene.materialize_named_parameters_for_save();
self.tabs[i].scene.materialize_dwg_native_constraints_for_save();
let tab_id = self.tabs[i].id;
let bounds = crate::ui::wrap_bar::dropdown_bounds(
crate::app::view::VIEWPORT_CAPTURE_BOUNDS_ID,