diff --git a/Cargo.lock b/Cargo.lock index f5fe8e2e9..77819d2d0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -88,7 +88,7 @@ checksum = "366ffbaa4442f4684d91e2cd7c5ea7c4ed8add41959a31447066e279e432b618" [[package]] name = "acadrust" version = "0.5.5" -source = "git+https://github.com/HakanSeven12/cadcodec.git?rev=d290dbe#d290dbe1712666d83dfd0fc63341ee3246f8de76" +source = "git+https://github.com/HakanSeven12/cadcodec.git?rev=1c3be0c#1c3be0ca296c99f2f126ba1a03c2be1998d7c64e" dependencies = [ "ahash 0.8.12", "anyhow", @@ -924,7 +924,7 @@ checksum = "fc652a48c352aef3ea3aed32080501cf3ef6ed5da78602a020c991775b0aff04" [[package]] name = "cadkernel" version = "0.1.0" -source = "git+https://github.com/HakanSeven12/cadkernel.git?rev=4134ae3#4134ae386153a76998c2fbf03e81a5c4a23928cc" +source = "git+https://github.com/HakanSeven12/cadkernel.git?rev=deb529b#deb529b34e677c1fedc4e316ce3f49b88f0c1361" dependencies = [ "acadrust", "cavalier_contours", @@ -935,7 +935,7 @@ dependencies = [ [[package]] name = "cadkernel-constraints" version = "0.1.0" -source = "git+https://github.com/HakanSeven12/cadkernel.git?rev=4134ae3#4134ae386153a76998c2fbf03e81a5c4a23928cc" +source = "git+https://github.com/HakanSeven12/cadkernel.git?rev=deb529b#deb529b34e677c1fedc4e316ce3f49b88f0c1361" dependencies = [ "nalgebra", ] diff --git a/Cargo.toml b/Cargo.toml index a58daffc2..b4d831d24 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -33,9 +33,9 @@ rfd = "0.17" clap = { version = "4", features = ["derive", "string"] } env_logger = "0.11" log = "0.4" -acadrust = { git = "https://github.com/HakanSeven12/cadcodec.git", rev = "d290dbe", features = ["serde"] } -cadkernel = { git = "https://github.com/HakanSeven12/cadkernel.git", rev = "4134ae3", features = ["acis", "offset"] } -cadkernel-constraints = { git = "https://github.com/HakanSeven12/cadkernel.git", rev = "4134ae3" } +acadrust = { git = "https://github.com/HakanSeven12/cadcodec.git", rev = "1c3be0c", features = ["serde"] } +cadkernel = { git = "https://github.com/HakanSeven12/cadkernel.git", rev = "deb529b", features = ["acis", "offset"] } +cadkernel-constraints = { git = "https://github.com/HakanSeven12/cadkernel.git", rev = "deb529b" } dwg-thumbnailer = { path = "crates/dwg-thumbnailer" } flate2 = "1" image = { version = "0.25", default-features = false, features = ["png", "jpeg", "bmp", "tiff"] } diff --git a/crates/ocs_plugin_api/Cargo.toml b/crates/ocs_plugin_api/Cargo.toml index c459fb630..b8d4361a8 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 `acadrust`-typed # `HostApi` runtime surface. The default crate stays dependency-free so engine # crates and external tooling can depend on the manifest/ribbon contract cheaply. -acadrust = { git = "https://github.com/HakanSeven12/cadcodec.git", rev = "d290dbe", optional = true, features = ["serde"] } +acadrust = { git = "https://github.com/HakanSeven12/cadcodec.git", rev = "1c3be0c", 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" # acadrust is scanned at build time to generate the embedded type registry. -acadrust = { git = "https://github.com/HakanSeven12/cadcodec.git", rev = "d290dbe", features = ["serde"] } +acadrust = { git = "https://github.com/HakanSeven12/cadcodec.git", rev = "1c3be0c", features = ["serde"] } [dev-dependencies] serde_json = "1" diff --git a/crates/ocs_web_worker/Cargo.toml b/crates/ocs_web_worker/Cargo.toml index 345f12ba3..666bc4714 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] -acadrust = { git = "https://github.com/HakanSeven12/cadcodec.git", rev = "d290dbe", features = ["serde"] } +acadrust = { git = "https://github.com/HakanSeven12/cadcodec.git", rev = "1c3be0c", features = ["serde"] } bincode = "1.3" serde = { version = "1", features = ["derive"] } console_error_panic_hook = "0.1" diff --git a/docs/cadcodec-reader-gaps.md b/docs/cadcodec-reader-gaps.md index 27795f840..19895ff63 100644 --- a/docs/cadcodec-reader-gaps.md +++ b/docs/cadcodec-reader-gaps.md @@ -7,7 +7,7 @@ reloading it, and comparing entity fields. **Status (23 September 2026):** the fixes landed in cadcodec as [#48](https://github.com/HakanSeven12/cadcodec/pull/48) (issues 1-6) and [#51](https://github.com/HakanSeven12/cadcodec/pull/51) (the first three style findings), and -the block description with commit `dd1d7bf` (cadcodec issue #49). OCS pins `d290dbe`, which +the block description with commit `dd1d7bf` (cadcodec issue #49). OCS pins `1c3be0c`, which includes it; the canaries below were flipped against `dd1d7bf`. What is still open: - **ATTDEF `lock_position`** (issue 1): the reader is complete, but the DXF writer emits no diff --git a/plugins/opencad-python/Cargo.lock b/plugins/opencad-python/Cargo.lock index 7e293c5c1..2d7f6767b 100644 --- a/plugins/opencad-python/Cargo.lock +++ b/plugins/opencad-python/Cargo.lock @@ -5,7 +5,7 @@ version = 4 [[package]] name = "acadrust" version = "0.5.5" -source = "git+https://github.com/HakanSeven12/cadcodec.git?rev=d290dbe#d290dbe1712666d83dfd0fc63341ee3246f8de76" +source = "git+https://github.com/HakanSeven12/cadcodec.git?rev=1c3be0c#1c3be0ca296c99f2f126ba1a03c2be1998d7c64e" dependencies = [ "ahash 0.8.12", "anyhow", diff --git a/src/modules/insert/xclip.rs b/src/modules/insert/xclip.rs index ef69548ad..540074bb1 100644 --- a/src/modules/insert/xclip.rs +++ b/src/modules/insert/xclip.rs @@ -394,10 +394,9 @@ impl CadCommand for XclipCommand { } _ => return None, }; - let mut points: Vec<[f32; 3]> = - ring.iter().map(|p| [p.x as f32, p.y as f32, p.z as f32]).collect(); + let mut points: Vec<[f64; 3]> = ring.iter().map(|p| p.to_array()).collect(); points.push(points[0]); - Some(WireModel::solid("xclip_boundary".into(), points, WireModel::CYAN, false)) + Some(WireModel::solid_f64("xclip_boundary".into(), points, WireModel::CYAN, false)) } } diff --git a/src/scene/pick/xclip.rs b/src/scene/pick/xclip.rs index 984ffc7be..a199b7ae1 100644 --- a/src/scene/pick/xclip.rs +++ b/src/scene/pick/xclip.rs @@ -64,14 +64,7 @@ const INVERTED_COMPARE: &str = "ACAD_INVERTEDCLIP_ROUNDTRIP_COMPARE"; /// The boundary an inverted clip was drawn with (WCS), kept beside the /// filter's ring in an ACAD_XREC_ROUNDTRIP record as the reference keeps it. pub fn inverted_boundary(doc: &CadDocument, filter: &SpatialFilter) -> Option> { - let xdict = match doc.objects.get(&filter.handle)? { - ObjectType::SpatialFilter(_) => filter_xdictionary(doc, filter.handle)?, - _ => return None, - }; - let record = dict_entry(doc, xdict, ROUNDTRIP)?; - let Some(ObjectType::XRecord(x)) = doc.objects.get(&record) else { - return None; - }; + let x = doc.xrecord(filter.handle, ROUNDTRIP)?; let mut points = Vec::new(); let mut inside = false; for entry in &x.entries { @@ -88,15 +81,6 @@ pub fn inverted_boundary(doc: &CadDocument, filter: &SpatialFilter) -> Option= 2).then_some(points) } -/// Filters keep their extension dictionary in the document's owner map: the -/// dictionary owned by the filter. -fn filter_xdictionary(doc: &CadDocument, filter: Handle) -> Option { - doc.objects.iter().find_map(|(h, o)| match o { - ObjectType::Dictionary(d) if d.owner == filter => Some(*h), - _ => None, - }) -} - /// The inverted boundary drawn as the XCLIP frame and generated polyline, /// else the stored one; rectangles as four corners (WCS through the stored /// transforms). @@ -154,7 +138,7 @@ pub fn remove_insert_clip(doc: &mut CadDocument, insert: Handle) -> bool { let Some(spatial) = filter_handle(doc, insert) else { return false; }; - if let Some(xdict) = filter_xdictionary(doc, spatial) { + if let Some(xdict) = doc.extension_dictionary_handle(spatial) { let children: Vec = match doc.objects.get(&xdict) { Some(ObjectType::Dictionary(d)) => d.entries.iter().map(|(_, h)| *h).collect(), _ => Vec::new(), @@ -279,12 +263,11 @@ pub fn set_insert_clip( parent.add_entry("SPATIAL", spatial); } if inverted { - let fdict = doc.allocate_handle(); + let fdict = doc.ensure_extension_dictionary(spatial); let record = doc.allocate_handle(); - let mut d = Dictionary::new(); - (d.handle, d.owner, d.hard_owner) = (fdict, spatial, true); - d.add_entry(ROUNDTRIP, record); - doc.objects.insert(fdict, ObjectType::Dictionary(d)); + if let Some(ObjectType::Dictionary(d)) = doc.objects.get_mut(&fdict) { + d.add_entry(ROUNDTRIP, record); + } let mut x = XRecord::new(); (x.handle, x.owner) = (record, fdict); x.cloning_flags = acadrust::objects::DictionaryCloningFlags::KeepExisting;