1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
//! ISO-10303-21 (STEP Part 21) importer — the read side of `step.rs`.
//!
//! Strategy is ROUND-TRIP-FIRST: this reads back exactly what `export_step`
//! writes (an all-NURBS ADVANCED_BREP: B_SPLINE_CURVE/SURFACE_WITH_KNOTS and
//! their rational complex forms, VERTEX_POINT / EDGE_CURVE / ORIENTED_EDGE /
//! EDGE_LOOP / FACE_(OUTER_)BOUND / ADVANCED_FACE / CLOSED_SHELL /
//! MANIFOLD_SOLID_BREP), reconstructs a `BrepSolid`, and validates it.
//!
//! This module DERIVES pcurves rather than reading them: every 3D edge curve is
//! projected onto its carrier surface (`build_pcurve_on_surface_range`), seam
//! edges are placed on opposite domain boundaries, and any pole boundary that
//! is not written as a `VERTEX_LOOP` is re-synthesised as a degenerate edge so
//! faces close their parameter domain and integrate to the correct mass
//! properties.
//!
//! That is now a CHOICE, not a necessity: since `step.rs` grew curve-on-surface
//! emission, our own files carry `SURFACE_CURVE`/`SEAM_CURVE` bundles with
//! verified `PCURVE`s, and `VERTEX_LOOP` for collapsed bounds — and this reader
//! still unwraps the bundle to its 3D curve and discards the pcurve list
//! (`parse.rs`). Consuming them instead (a trust-but-verify read path) is a
//! documented follow-up in kernel-plans/step-export-pcurves.md; deriving is
//! correct meanwhile, and is what vendor files without pcurves need anyway.
//!
//! Analytic-surface recognition on import (PLANE/CYLINDRICAL/…) is a documented
//! follow-up: the exporter emits only NURBS, so faithful NURBS round-trip is the
//! milestone. Unsupported entities produce a clear `Err`, never a panic.
use crate;
use crate::;
use ;
use VecDeque;
const TAU: f64 = TAU;
use crate;
use *;
use *;
use *;
use *;
use *;
pub use ;
// ---------------------------------------------------------------------------
// Topology assembly
// ---------------------------------------------------------------------------
/// Public entry: parse a STEP Part 21 document and return one `BrepSolid` per
/// MANIFOLD_SOLID_BREP, FACETED_BREP, or certified BREP_WITH_VOIDS. Every
/// returned solid passes `validate()`.
/// [`import_step`] plus the file's PRESENTATION colours: one
/// [`BodyAppearance`] per returned solid, in the same order.
///
/// This is the lane the IMPORT3D feature uses, because colour is stamped as
/// scene metadata on the names IT chooses — see
/// `feature_pipeline::features::import3d` and `io/appearance.rs` for the record
/// shape. A file with no presentation entities returns default (empty)
/// appearances, never a short vector, so callers can `zip` unconditionally.
/// Like [`import_step`] but reports how many bodies failed and the first error,
/// so callers can distinguish a fully- from a partially-imported assembly.