From 390e12169a5e67fdd8818bfba2ffc505dbabb53e Mon Sep 17 00:00:00 2001 From: Hakan Seven Date: Mon, 12 Oct 2026 23:24:22 +0300 Subject: [PATCH] fix(dwg): keep OCS-saved drawings readable by strict readers Re-authored constraint-group geometry dependencies carried an empty persistent subentity id, which crashed strict readers loading the file; they now name the whole curve with a single-edge id. Bump codec bc350f2 (declare classes of objects added to pre-R2004 drawings), kernel e692b97, graph 37d38eb. Co-Authored-By: Claude Opus 5.5 --- Cargo.lock | 8 ++++---- Cargo.toml | 8 ++++---- crates/ocs_plugin_api/Cargo.toml | 4 ++-- crates/ocs_save/Cargo.toml | 2 +- crates/ocs_web_worker/Cargo.toml | 2 +- plugins/opencad-python/Cargo.lock | 2 +- src/scene/dwg_native_constraints.rs | 14 ++++++++++++-- 7 files changed, 25 insertions(+), 15 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index ee61a5746..27863da1a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4216,7 +4216,7 @@ dependencies = [ [[package]] name = "opencadcodec" version = "0.6.0" -source = "git+https://github.com/HakanSeven12/opencadcodec.git?rev=3ec70a2#3ec70a2a0134f60a9f3036f1974fea86ad96e439" +source = "git+https://github.com/HakanSeven12/opencadcodec.git?rev=bc350f2#bc350f266344444c8ec77bfdaee13a6216ced69c" dependencies = [ "anyhow", "bitflags 2.13.1", @@ -4239,7 +4239,7 @@ dependencies = [ [[package]] name = "opencadgraph" version = "0.1.0" -source = "git+https://github.com/HakanSeven12/opencadgraph.git?rev=338a973#338a973202d56c1df7ddf7ce8d40d385af16d406" +source = "git+https://github.com/HakanSeven12/opencadgraph.git?rev=37d38eb#37d38eb5dfa10d2bfc9887cb6ef3945d933f0071" dependencies = [ "opencadkernel", "serde_json", @@ -4248,7 +4248,7 @@ dependencies = [ [[package]] name = "opencadkernel" version = "0.1.0" -source = "git+https://github.com/HakanSeven12/opencadkernel.git?rev=e710727#e71072779377116269f822e01a2df97b8fa3420b" +source = "git+https://github.com/HakanSeven12/opencadkernel.git?rev=e692b97#e692b970086e23e11bc39c2b5e70e2dee7140a54" dependencies = [ "cavalier_contours", "opencadcodec", @@ -4259,7 +4259,7 @@ dependencies = [ [[package]] name = "opencadkernel-constraints" version = "0.1.0" -source = "git+https://github.com/HakanSeven12/opencadkernel.git?rev=e710727#e71072779377116269f822e01a2df97b8fa3420b" +source = "git+https://github.com/HakanSeven12/opencadkernel.git?rev=e692b97#e692b970086e23e11bc39c2b5e70e2dee7140a54" dependencies = [ "nalgebra", ] diff --git a/Cargo.toml b/Cargo.toml index 7fe8273a2..4361bf4d7 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -35,10 +35,10 @@ rfd = "0.17" clap = { version = "4", features = ["derive", "string"] } env_logger = "0.11" log = "0.4" -codec = { package = "opencadcodec", git = "https://github.com/HakanSeven12/opencadcodec.git", rev = "3ec70a2", features = ["serde"] } -kernel = { package = "opencadkernel", git = "https://github.com/HakanSeven12/opencadkernel.git", rev = "e710727", features = ["acis", "offset"] } -kernel-constraints = { package = "opencadkernel-constraints", git = "https://github.com/HakanSeven12/opencadkernel.git", rev = "e710727" } -graph = { package = "opencadgraph", git = "https://github.com/HakanSeven12/opencadgraph.git", rev = "338a973" } +codec = { package = "opencadcodec", git = "https://github.com/HakanSeven12/opencadcodec.git", rev = "bc350f2", features = ["serde"] } +kernel = { package = "opencadkernel", git = "https://github.com/HakanSeven12/opencadkernel.git", rev = "e692b97", features = ["acis", "offset"] } +kernel-constraints = { package = "opencadkernel-constraints", git = "https://github.com/HakanSeven12/opencadkernel.git", rev = "e692b97" } +graph = { package = "opencadgraph", git = "https://github.com/HakanSeven12/opencadgraph.git", rev = "37d38eb" } dwg-thumbnailer = { path = "crates/dwg-thumbnailer" } # Shared SAVE serialization dispatch + web-worker wire format: one # implementation for the inline (fallback/native) path and the worker path. diff --git a/crates/ocs_plugin_api/Cargo.toml b/crates/ocs_plugin_api/Cargo.toml index a3252cf25..9787b13e2 100644 --- a/crates/ocs_plugin_api/Cargo.toml +++ b/crates/ocs_plugin_api/Cargo.toml @@ -15,7 +15,7 @@ serde_json = { version = "1", optional = true } # Pulled in only by the `host` feature, which adds the `opencadcodec`-typed # `HostApi` runtime surface. The default crate stays dependency-free so engine # crates and external tooling can depend on the manifest/ribbon contract cheaply. -codec = { package = "opencadcodec", git = "https://github.com/HakanSeven12/opencadcodec.git", rev = "3ec70a2", optional = true, features = ["serde"] } +codec = { package = "opencadcodec", git = "https://github.com/HakanSeven12/opencadcodec.git", rev = "bc350f2", optional = true, features = ["serde"] } # Runtime IPC and serialization (host feature only). interprocess = { version = "2", optional = true } @@ -39,7 +39,7 @@ serde_json = "1" serde = { version = "1", features = ["derive"] } cargo-lock = "11" # opencadcodec is scanned at build time to generate the embedded type registry. -codec = { package = "opencadcodec", git = "https://github.com/HakanSeven12/opencadcodec.git", rev = "3ec70a2", features = ["serde"] } +codec = { package = "opencadcodec", git = "https://github.com/HakanSeven12/opencadcodec.git", rev = "bc350f2", features = ["serde"] } [dev-dependencies] serde_json = "1" diff --git a/crates/ocs_save/Cargo.toml b/crates/ocs_save/Cargo.toml index 76a45ddb5..98719705f 100644 --- a/crates/ocs_save/Cargo.toml +++ b/crates/ocs_save/Cargo.toml @@ -10,6 +10,6 @@ publish = false # exactly one implementation. No UI/app dependencies — only the codec + serde. [dependencies] -codec = { package = "opencadcodec", git = "https://github.com/HakanSeven12/opencadcodec.git", rev = "3ec70a2", features = ["serde"] } +codec = { package = "opencadcodec", git = "https://github.com/HakanSeven12/opencadcodec.git", rev = "bc350f2", features = ["serde"] } bincode = "1.3" serde = { version = "1", features = ["derive"] } diff --git a/crates/ocs_web_worker/Cargo.toml b/crates/ocs_web_worker/Cargo.toml index 54819e69b..07397abff 100644 --- a/crates/ocs_web_worker/Cargo.toml +++ b/crates/ocs_web_worker/Cargo.toml @@ -8,7 +8,7 @@ publish = false crate-type = ["cdylib"] [dependencies] -codec = { package = "opencadcodec", git = "https://github.com/HakanSeven12/opencadcodec.git", rev = "3ec70a2", features = ["serde"] } +codec = { package = "opencadcodec", git = "https://github.com/HakanSeven12/opencadcodec.git", rev = "bc350f2", features = ["serde"] } bincode = "1.3" serde = { version = "1", features = ["derive"] } console_error_panic_hook = "0.1" diff --git a/plugins/opencad-python/Cargo.lock b/plugins/opencad-python/Cargo.lock index d3e57e7f6..ea5b8355b 100644 --- a/plugins/opencad-python/Cargo.lock +++ b/plugins/opencad-python/Cargo.lock @@ -1264,7 +1264,7 @@ dependencies = [ [[package]] name = "opencadcodec" version = "0.6.0" -source = "git+https://github.com/HakanSeven12/opencadcodec.git?rev=3ec70a2#3ec70a2a0134f60a9f3036f1974fea86ad96e439" +source = "git+https://github.com/HakanSeven12/opencadcodec.git?rev=bc350f2#bc350f266344444c8ec77bfdaee13a6216ced69c" dependencies = [ "anyhow", "bitflags", diff --git a/src/scene/dwg_native_constraints.rs b/src/scene/dwg_native_constraints.rs index d28c28c6e..22efdc24f 100644 --- a/src/scene/dwg_native_constraints.rs +++ b/src/scene/dwg_native_constraints.rs @@ -1200,8 +1200,18 @@ impl Allocator<'_> { }, class_version: 0, enabled: true, - // Point and curve addressing lives on constraint-node data. - persistent_subent: AssocPersistentSubentId::default(), + // Point and curve addressing lives on constraint-node data; + // the dependency names the whole curve, as single-edge + // subentities do in authored constraint groups. An empty id + // (no class) crashes strict readers loading the drawing. + // ponytail: polyline segments get the single-edge id too; + // authored files address them with an index subentity (class + // code 3) whose fields are not decoded yet. + persistent_subent: AssocPersistentSubentId { + class_name: "AcDbAssocSingleEdgePersSubentId".to_string(), + class_code: 1, + ..Default::default() + }, }), ) }