Skip to main content

geop_core_part/
lib.rs

1//! A complete CAD part: a [`geop_core_topology::Model`], the sketches and
2//! datums used to build it, and a stable name for every entity in it.
3//!
4//! [`Part`] only ever changes through its own methods, each of which forwards
5//! to the identically named `Model` operation and takes the name of every
6//! entity it creates. Its fields are private, so a part can't gain an entity
7//! without a name, or keep the name of one that no longer exists.
8//!
9//! # Topological naming
10//!
11//! A name says *how an entity came to be*, never *when*: it is built only
12//! from inputs that stay the same when a part is rebuilt after an edit
13//! upstream — operation ids, sketch element ids, the names of the entities an
14//! operation consumed, and positions counted along those. Never from an
15//! internal id or the order in which an algorithm happened to create things.
16//! So a program that refers to `extrude(box,end)` keeps meaning the same face
17//! when the box gets taller, and names are stable text that diffs well.
18//!
19//! Every name has the form `kind(operation,arg,...)` (see [`Namer`]):
20//! `kind` is the operation that created the entity, `operation` the id of the
21//! program step that ran it, and the arguments identify the entity within
22//! that step. The operations document their own arguments; for example:
23//!
24//! - `extrude(E)` is the solid extrude step `E` built, `extrude(E,start)` and
25//!   `extrude(E,end)` its caps, `extrude(E,K,c3)` the side face swept by line
26//!   `c3` of sketch `K`, `extrude(E,K,c3,end)` that face's edge on the end cap,
27//!   and `extrude(E,K,p1)` the edge swept by sketch point `p1`.
28//! - `boolean(B,E1,E2,i,n)` is the `i`-th of the `n` points where edges `E1`
29//!   and `E2` (by their names before step `B`) cross, counted along `E1`.
30//!
31//! Operation ids are restricted to [`validate_operation_id`]'s alphabet, so
32//! the arguments of a name — which may themselves be names — can always be
33//! told apart.
34
35mod datum;
36mod describe;
37mod edit;
38mod euler;
39mod ids;
40mod names;
41mod part;
42mod resolve;
43mod sketch;
44
45pub use datum::{Datum, DatumKind};
46pub use describe::{EdgeDescription, FaceDescription, PartDescription};
47pub use ids::{DatumId, RefId, SketchId};
48pub use names::{NameRegistry, Namer, validate_operation_id};
49pub use part::Part;
50pub use sketch::PlacedSketch;