forked from 1b-agent/opencadstudio-upstream
feat(model): build and read solids with the geometry kernel
Every 3-D solid OCS makes or opens now goes through cadkernel, which holds analytic surfaces — a cylinder is a cylinder record, not a spline that looks like one. That is what lets a solid built here be written back out as exact ACIS instead of a triangulation, and a facetted export is a one-way door: the next application to open the file would have no way back to the circle. The Model tab's seven primitives, the Design-group booleans, 3DROTATE, 3DMIRROR, 3DALIGN, SLICE, SECTION, POLYSOLID and PYRAMID all come from the kernel now, and `scene.solid_models` holds a `Body`. A mirrored solid needed its own care before; the kernel reverses the loops on the way through, so it comes back the right way out rather than lighting black. EXTRUDE and REVOLVE sweep the profile `entities::curve` already defines, so a circle, an arc-bulged polyline and a closed spline arrive as the same thing. A circle extrudes into four cylinder patches rather than a run of chords, and a profile turned about an axis becomes a cone, a sphere or a torus. A spline profile has no analytic side wall and is refused rather than approximated. ACIS goes both ways through the codec's own bridge: `lift` to read and `append` to write. That drops the 679-line truck conversion and the planar- only exporter, and the tessellator keeps its bespoke sampler as a fallback for whatever the kernel cannot yet express — reported rather than passed off as whole, since a mesh missing a wall looks finished. truck-shapeops is no longer used and is gone from the manifest. truck-modeling stays for now: fourteen files use it as a 3-D NURBS evaluator, which the kernel has no answer for yet, and SWEEP and LOFT have no kernel operation behind them either. The two `automation` test failures are unchanged from before this and are not caused by it. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
8016b79ddf
commit
1f642bb40a
15 files changed
+905
-1627
No files matched your search
@@ -46,7 +46,6 @@ pub(crate) const EDGE_CHORD_FRAC: f64 = 0.002;
|
||||
/// a hexagonal prism whose flats sink far inside the true radius, tearing the
|
||||
/// wall away from the planar faces and caps that meet it.
|
||||
#[cfg(feature = "solid3d")]
|
||||
pub(crate) const TRUCK_CHORD_FRAC: f64 = 0.005;
|
||||
/// Boundary-loop sampling for parameter-range classification (which arc of a
|
||||
/// sphere/torus a face covers): a fine fraction so the classification is
|
||||
/// accurate; the points are not rendered.
|
||||
@@ -276,9 +275,10 @@ fn tessellate_sat(
|
||||
))
|
||||
}
|
||||
|
||||
/// Tessellate an ACIS document, preferring the truck B-rep kernel and falling
|
||||
/// back to the bespoke per-surface sampler when truck can't rebuild the shell
|
||||
/// (e.g. an unhandled surface type).
|
||||
/// Tessellate an ACIS document, preferring the geometry kernel and falling
|
||||
/// back to the bespoke per-surface sampler when the kernel cannot rebuild the
|
||||
/// whole shell (a surface kind it does not model, a face whose boundary it
|
||||
/// cannot express in that surface's own parameters).
|
||||
fn tessellate_acis(
|
||||
sat: &SatDocument,
|
||||
name: String,
|
||||
@@ -286,7 +286,7 @@ fn tessellate_acis(
|
||||
facet_res: f64,
|
||||
isolines: usize,
|
||||
) -> Option<MeshLodSet> {
|
||||
let truck = crate::scene::convert::acis_to_truck::tessellate_sat_truck(
|
||||
let truck = crate::scene::convert::acis_kernel::tessellate_sat(
|
||||
sat,
|
||||
name.clone(),
|
||||
color,
|
||||
@@ -2049,7 +2049,7 @@ pub(crate) fn tess_plane_face(
|
||||
}
|
||||
|
||||
// Fan triangulation from vertex 0 (outer loop only; holes are handled by
|
||||
// the truck B-rep path in `acis_to_truck`).
|
||||
// the kernel B-rep path in `acis_kernel`).
|
||||
let n = poly.len() as u32;
|
||||
for i in 1..(n - 1) {
|
||||
indices.extend_from_slice(&[base, base + i, base + i + 1]);
|
||||
|
||||
Reference in new issue
Block a user