refactor(cad): use direct stack dependencies

This commit is contained in:
Hakan Seven committed 2026-08-10 15:03:31 +03:00
1 parent 3b4fbabdba
commit ac8183ec91
36 files changed
+87 -101

No files matched your search

+5 -23
View File
@@ -1,30 +1,12 @@
//! Export a B-rep [`Body`] to an exact ACIS `SatDocument`.
//! Export a kernel [`Body`] to an exact ACIS `SatDocument`.
//!
//! A solid built by the Model tab, by EXTRUDE / REVOLVE, or by a boolean
//! carries no ACIS geometry of its own, so other CAD applications drop it on
//! open. Writing the body out as real modeller geometry is what stops that.
//!
//! # Exact, not facetted
//!
//! The kernel keeps analytic surfaces — a cylinder is a `cylinder` record and
//! a sphere a `sphere` — so what lands in the document is the shape itself
//! rather than a triangulation of it. That is the whole reason the Model tab
//! builds bodies at all: a facetted export is a one-way door, and the next
//! application to open the file would have no way back to the circle.
//!
//! The writing is [`acis::append`], which lives with the codec because it has
//! to know both sides. What is left here is the small matter of putting one
//! body into a fresh document.
//! Analytic surfaces remain analytic instead of becoming facets.
use acadrust::acis::append;
use cadkernel::acis::append;
use acadrust::entities::acis::SatDocument;
use acadrust::kernel::brep::Body;
use cadkernel::brep::Body;
/// An exact ACIS document holding `body`, or `None` when the kernel has no
/// record form for something in it — a spline curve, at present.
///
/// Refusing is the point: a document missing a face is one that parses into a
/// different solid, and nothing downstream could tell.
/// Returns `None` when the body contains an unsupported record form.
pub fn planar_solid_to_sat(body: &Body) -> Option<SatDocument> {
let mut document = SatDocument::new();
append(body, &mut document).ok()?;
+4 -4
View File
@@ -8,9 +8,9 @@
//!
//! Lift and tessellation failures are reported as an incomplete result.
use acadrust::acis::lift;
use cadkernel::acis::lift;
use acadrust::entities::acis::SatDocument;
use acadrust::kernel::brep;
use cadkernel::brep;
use crate::scene::convert::solid3d_tess::{body_transform, finalize_mesh};
use crate::scene::model::mesh_model::{CurvedGen, MeshLodSet};
@@ -53,7 +53,7 @@ pub fn tessellate_sat(
} else {
1.0
};
let max_angle = acadrust::kernel::tessellation::DEFAULT_ANGLE / resolution;
let max_angle = cadkernel::tessellation::DEFAULT_ANGLE / resolution;
// Positions stay f64 until `finalize_mesh` splits them into the coarse
// and fine pair, so a solid at survey coordinates keeps its millimetres.
@@ -240,7 +240,7 @@ mod tests {
#[test]
fn a_round_surface_gets_the_same_sides_whatever_its_size() {
let angle = acadrust::kernel::tessellation::DEFAULT_ANGLE;
let angle = cadkernel::tessellation::DEFAULT_ANGLE;
assert!(sides(angle) > 24.0, "{}", sides(angle));
assert!(sides(angle) < 96.0, "{}", sides(angle));
}