fix(solids): a 3D drawing with bad pcurves opens instead of hanging

Two causes behind the load stalling at the scene-cache step:

- Solids were fitted to the ACIS header's first tolerance-line value,
  which is the millimetres-per-unit scale (25.4 in this inch drawing,
  1 in most), not a tolerance. It is now resabs, the second value.
- The kernel (37b6902) drops pcurves that miss their edge and caps the pcurve
  walk, so a solid carrying a bad pcurve no longer refines an edge
  hundreds of thousands of times. Graph b741bd6.

The attached drawing now meshes all 76 solids in 3.4 s (release) and
opens in 19 s in a debug build.

Fixes #1538

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
Hakan SevenandClaude Opus 5.5 committed 2026-09-30 15:55:28 +03:00
1 parent 1952b4b0cb
commit 47f3e2e8ef
3 files changed
+14 -10

No files matched your search

Generated
+3 -3
View File
@@ -4228,7 +4228,7 @@ dependencies = [
[[package]]
name = "opencadgraph"
version = "0.1.0"
source = "git+https://github.com/HakanSeven12/opencadgraph.git?rev=455c878#455c8789052a227a7a7f9249ece9c1ec7163d166"
source = "git+https://github.com/HakanSeven12/opencadgraph.git?rev=b741bd6#b741bd6aeb3b19222f8fa489b7a556552359df8f"
dependencies = [
"opencadkernel",
"serde_json",
@@ -4237,7 +4237,7 @@ dependencies = [
[[package]]
name = "opencadkernel"
version = "0.1.0"
source = "git+https://github.com/HakanSeven12/opencadkernel.git?rev=019d3b1#019d3b17ad1842a1aebfffeb50bbc0bdac64899c"
source = "git+https://github.com/HakanSeven12/opencadkernel.git?rev=37b6902#37b690219af25ae21a9952bc36c6d82cc9dc40eb"
dependencies = [
"cavalier_contours",
"opencadcodec",
@@ -4248,7 +4248,7 @@ dependencies = [
[[package]]
name = "opencadkernel-constraints"
version = "0.1.0"
source = "git+https://github.com/HakanSeven12/opencadkernel.git?rev=019d3b1#019d3b17ad1842a1aebfffeb50bbc0bdac64899c"
source = "git+https://github.com/HakanSeven12/opencadkernel.git?rev=37b6902#37b690219af25ae21a9952bc36c6d82cc9dc40eb"
dependencies = [
"nalgebra",
]
+3 -3
View File
@@ -34,9 +34,9 @@ clap = { version = "4", features = ["derive", "string"] }
env_logger = "0.11"
log = "0.4"
codec = { package = "opencadcodec", git = "https://github.com/HakanSeven12/opencadcodec.git", rev = "54e6fa1", features = ["serde"] }
kernel = { package = "opencadkernel", git = "https://github.com/HakanSeven12/opencadkernel.git", rev = "019d3b1", features = ["acis", "offset"] }
kernel-constraints = { package = "opencadkernel-constraints", git = "https://github.com/HakanSeven12/opencadkernel.git", rev = "019d3b1" }
graph = { package = "opencadgraph", git = "https://github.com/HakanSeven12/opencadgraph.git", rev = "455c878" }
kernel = { package = "opencadkernel", git = "https://github.com/HakanSeven12/opencadkernel.git", rev = "37b6902", features = ["acis", "offset"] }
kernel-constraints = { package = "opencadkernel-constraints", git = "https://github.com/HakanSeven12/opencadkernel.git", rev = "37b6902" }
graph = { package = "opencadgraph", git = "https://github.com/HakanSeven12/opencadgraph.git", rev = "b741bd6" }
dwg-thumbnailer = { path = "crates/dwg-thumbnailer" }
flate2 = "1"
image = { version = "0.25", default-features = false, features = ["png", "jpeg", "bmp", "tiff"] }
+8 -4
View File
@@ -103,10 +103,14 @@ pub fn tessellate_sat(
// parameters leaves a hole, the same as one that never lifted — so both
// are counted before calling the mesh whole.
let mut undrawn = 0usize;
let source_fit = if document.header.spatial_resolution.is_finite()
&& document.header.spatial_resolution > 0.0
{
document.header.spatial_resolution
// The header's tolerance line is `<mm per unit> <resabs> <resnor>`: the
// codec's `spatial_resolution` is the unit scale (1, or 25.4 for inches)
// and its `normal_tolerance` is resabs, the file's absolute tolerance.
// Fitting to the unit scale let every edge wander a whole unit, and on a
// bad pcurve that meant minutes of refinement (#1538).
let resabs = document.header.normal_tolerance;
let source_fit = if resabs.is_finite() && resabs > 0.0 && resabs < 1e-2 {
resabs
} else {
DEFAULT_FIT_TOLERANCE
};