SolidCraft: an open-source parametric 3D CAD application built in pure Rust. Desktop, web, and automation through MCP.
Wave 132/509: solidcraft-smlib: SMLib's "no change" as Error::NoEffect, the fork pinned at its integration head (and 1 more)
jyvikoe4a9870353b3
diff --git a/crates/kernel/src/blend_smlib.rs b/crates/kernel/src/blend_smlib.rsindex c456f11616..b3863f7c2d 100644--- a/crates/kernel/src/blend_smlib.rs+++ b/crates/kernel/src/blend_smlib.rs@@ -199,6 +199,7 @@ mod imp {let tagged = sb.tagged(0).map_err(|e| failed(what, "tag", e))?;let r = op(&tagged).map_err(|e| match e {SmError::Unsupported => super::unsupported(&format!("this {what}, which SMLib cannot build exactly")),+ SmError::NoEffect => KernelError::Failed(format!("SMLib made no change: the {what} reported success but built no face")),e => failed(what, "operation", e),})?;let check = r.check(CheckLevel::All).map_err(|e| failed(what, "check", e))?;diff --git a/crates/kernel/src/lib.rs b/crates/kernel/src/lib.rsindex fadf3a75e7..677a3e4734 100644--- a/crates/kernel/src/lib.rs+++ b/crates/kernel/src/lib.rs@@ -113,7 +113,6 @@ mod polybool;mod polyhedron;mod prism;mod prism_curve;-mod prism_local;mod prism_measure;pub mod profile;pub mod provenance;@@ -206,7 +205,7 @@ pub use ops::{place_matrix, split_by_plane, transform, transform_matrix, union_apart, with_attempt_budget,};pub use point_path::{PathPiece, PointPath, sweep_point_path_with};-pub use polybool::{faceted_boolean, planar_boolean};+pub use polybool::faceted_boolean;pub use polyhedron::{HalfSpace, convex_polyhedron, draft, offset_faces, shell};pub use prism::{PLANAR_FIT_TOL, extrude_planar_regions, planar_regions_boolean};pub use prism_measure::certified_prism_equivalent;diff --git a/crates/kernel/src/offset_backend.rs b/crates/kernel/src/offset_backend.rsindex 56d056a2be..b3dcf2a3c0 100644--- a/crates/kernel/src/offset_backend.rs+++ b/crates/kernel/src/offset_backend.rs@@ -35,6 +35,7 @@ fn refused(op: &str, e: SmError) -> KernelError {SmError::NoMatch { point } => KernelError::Invalid(format!("{op}: no face at selection point {}", point + 1)),SmError::Ambiguous { point } => KernelError::Invalid(format!("{op}: selection point {} is as near to two faces", point + 1)),SmError::Unsupported => KernelError::Failed(format!("not supported yet: SMLib {op} for this geometry")),+ SmError::NoEffect => KernelError::Failed(format!("SMLib made no change: the {op} reported success but moved no face onto its new surface")),e => failed(op, "operation", e),}}diff --git a/crates/smlib/SMLIB_REV b/crates/smlib/SMLIB_REVindex 0b7fc3e8cd..b88bda2590 100644--- a/crates/smlib/SMLIB_REV+++ b/crates/smlib/SMLIB_REV@@ -1 +1 @@-a6a0c024fd455adc9f98c6076806db7ea7164e2d+e7522f4e7917fe817643ff691f2860c310038c27diff --git a/crates/smlib/src/ffi/ops.rs b/crates/smlib/src/ffi/ops.rsindex 2134e96cc8..b4d5e984cf 100644--- a/crates/smlib/src/ffi/ops.rs+++ b/crates/smlib/src/ffi/ops.rs@@ -18,6 +18,7 @@ pub const ERR_PICK_AMBIGUOUS: i32 = -1102;pub const ERR_NO_ROOM: i32 = -1103;pub const ERR_NO_CUT: i32 = -1104;pub const ERR_UNSUPPORTED: i32 = -1105;+pub const ERR_NO_EFFECT: i32 = -1107;pub const BOOLEAN_UNION: i32 = 0;pub const BOOLEAN_SUBTRACT: i32 = 1;diff --git a/crates/smlib/src/lib.rs b/crates/smlib/src/lib.rsindex fcb41dc990..521bda27c4 100644--- a/crates/smlib/src/lib.rs+++ b/crates/smlib/src/lib.rs@@ -49,6 +49,9 @@ pub enum Error {NoRoom,/// SMLib cannot build this exactly yet (a variable radius whose law has a corner).Unsupported,+ /// SMLib reported success but the operation did nothing: a blend that made no face, a face+ /// move or draft that moved no face.+ NoEffect,/// A C++ exception (most likely out of memory) was caught at the boundary.Exception,/// The C API is a different version from the one this crate was written against.@@ -71,6 +74,7 @@ impl std::fmt::Display for Error {Error::Ambiguous { point } => write!(f, "selection point {} is equally near to two edges or faces", point + 1),Error::NoRoom => write!(f, "the offset leaves no room inside the body"),Error::Unsupported => write!(f, "not supported yet: SMLib cannot build this exactly"),+ Error::NoEffect => write!(f, "SMLib made no change: it reported success, but the operation did nothing"),Error::Exception => write!(f, "SMLib raised an internal exception"),Error::Version(v) => write!(f, "SMLib C API version {v}, expected {}", ffi::ABI_VERSION),Error::NotBuilt => write!(f, "not supported yet: this build has no SMLib"),@@ -90,6 +94,7 @@ fn error(s: i32) -> Error {ffi::ops::ERR_NOT_SOLID => Error::NotSolid,ffi::ops::ERR_NO_ROOM => Error::NoRoom,ffi::ops::ERR_UNSUPPORTED => Error::Unsupported,+ ffi::ops::ERR_NO_EFFECT => Error::NoEffect,ffi::ERR_EXCEPTION => Error::Exception,ffi::NOT_BUILT => Error::NotBuilt,s => Error::Status(s),