geop_ops_extrude_revolve/lib.rs
1//! Extrude, revolve, sweep and loft as operations of a program: a sketch's
2//! areas swept into a solid — along its plane's normal, around an axis,
3//! along another sketch's curves, or through other sketches' profiles —
4//! kept as a new body or combined with one the model has; or its curves
5//! swept into a sheet, faces standing on their own. Which of these, each
6//! says by an [`Output`].
7//!
8//! Extrude and revolve say how far they go the same way, by an [`Extents`]:
9//! one side, both sides alike, or each side its own way — a length (an
10//! angle), up to the next face of the solid they are combined with, or
11//! through all of it.
12//!
13//! The operations resolve what their arguments refer to — the sketch, the
14//! axis, the path — into geometry, and sweep it with `geop_lib_sweep`.
15//!
16//! [`examples`] are the programs an editor offers that exercise them.
17//!
18//! With the `testing` feature — which only other crates' tests turn on —
19//! `testing` draws the sketches and pushes the steps their programs start
20//! from.
21
22#[cfg(test)]
23mod editor_tests;
24#[cfg(test)]
25mod example_tests;
26#[cfg(any(test, feature = "examples"))]
27pub mod examples;
28mod extrude;
29mod icons;
30mod loft;
31#[cfg(test)]
32mod parameters_tests;
33#[cfg(test)]
34mod program_tests;
35#[cfg(test)]
36mod regression_tests;
37mod revolve;
38#[cfg(test)]
39mod sketch3d_program_tests;
40mod sweep;
41mod sweeping;
42#[cfg(any(test, feature = "testing"))]
43pub mod testing;
44
45pub use extrude::{Extrude, ExtrudeArgs};
46pub use geop_ops_model::Extent;
47pub use loft::{Loft, LoftArgs};
48pub use revolve::{Revolve, RevolveArgs, RevolveAxis};
49pub use sweep::{Sweep, SweepArgs};
50pub use sweeping::{Extents, Output, PathRef};
51
52use geop_core_editor::registry::Registry;
53use geop_core_math::geop_error::GeopResult;
54
55/// Adds what this crate offers an editor to `r`: extrusions, revolutions,
56/// sweeps and lofts, and the examples of them.
57pub fn register(r: Registry) -> GeopResult<Registry> {
58 let r = r
59 .operation(Extrude)?
60 .operation(Revolve)?
61 .operation(Sweep)?
62 .operation(Loft)?;
63 #[cfg(any(test, feature = "examples"))]
64 let r = r.examples(examples::set())?;
65 Ok(r)
66}