Skip to main content

geop_ops_boolean/
lib.rs

1//! The [`Boolean`], [`Split`], [`Imprint`], [`SplitFace`] and [`Section`]
2//! operations of a program: combining two solids of the part, cutting one
3//! into pieces with a face standing on its own, dividing two bodies where
4//! they cross, dividing a face along a sketch's curves, and the curves where
5//! two bodies cross as a wire. The algorithms are
6//! `geop_lib_booleans`'; this crate resolves the bodies, faces and planes a
7//! step names and offers the forms that pick them.
8
9#[cfg(test)]
10mod editor_tests;
11#[cfg(test)]
12mod example_tests;
13#[cfg(any(test, feature = "examples"))]
14pub mod examples;
15mod icons;
16mod operation;
17#[cfg(test)]
18mod program_tests;
19#[cfg(test)]
20mod regression_tests;
21mod split_face;
22#[cfg(test)]
23mod tutorial_regression_tests;
24
25pub use operation::{
26    Boolean, BooleanArgs, Imprint, ImprintArgs, Section, SectionArgs, SectionWith, Split, SplitArgs,
27};
28pub use split_face::{Along, SplitFace, SplitFaceArgs};
29
30use geop_core_editor::registry::Registry;
31use geop_core_math::geop_error::GeopResult;
32
33/// Adds what this crate offers an editor to `r`: combining, splitting,
34/// imprinting and sectioning bodies, splitting faces, and the examples of
35/// them.
36pub fn register(r: Registry) -> GeopResult<Registry> {
37    let r = (r.operation(Boolean)?.operation(Split)?)
38        .operation(Imprint)?
39        .operation(SplitFace)?
40        .operation(Section)?;
41    #[cfg(any(test, feature = "examples"))]
42    let r = r.examples(examples::set())?;
43    Ok(r)
44}