Expand description
A complete CAD part: a geop_core_topology::Model, the sketches and
datums used to build it, and a stable name for every entity in it.
Part only ever changes through its own methods, each of which forwards
to the identically named Model operation and takes the name of every
entity it creates. Its fields are private, so a part can’t gain an entity
without a name, or keep the name of one that no longer exists.
§Topological naming
A name says how an entity came to be, never when: it is built only
from inputs that stay the same when a part is rebuilt after an edit
upstream — operation ids, sketch element ids, the names of the entities an
operation consumed, and positions counted along those. Never from an
internal id or the order in which an algorithm happened to create things.
So a program that refers to extrude(box,end) keeps meaning the same face
when the box gets taller, and names are stable text that diffs well.
Every name has the form kind(operation,arg,...) (see Namer):
kind is the operation that created the entity, operation the id of the
program step that ran it, and the arguments identify the entity within
that step. The operations document their own arguments; for example:
extrude(E)is the solid extrude stepEbuilt,extrude(E,start)andextrude(E,end)its caps,extrude(E,K,c3)the side face swept by linec3of sketchK,extrude(E,K,c3,end)that face’s edge on the end cap, andextrude(E,K,p1)the edge swept by sketch pointp1.boolean(B,E1,E2,i,n)is thei-th of thenpoints where edgesE1andE2(by their names before stepB) cross, counted alongE1.
Operation ids are restricted to validate_operation_id’s alphabet, so
the arguments of a name — which may themselves be names — can always be
told apart.
Structs§
- Datum
- One datum: a right-handed orthonormal frame, and which part of it the datum stands for. Every datum has a whole frame, whatever its kind, so anything built on it — a sketch on a plane, a datum offset from a point — has axes to be built along.
- DatumId
- A
crate::Part’s own id for one of its datums. - Edge
Description - Face
Description - A face’s boundary loops, each as the coedges it runs through:
+E/-Efor edgeEtraversed forwards / backwards,@Vfor a degenerate coedge sitting at vertexV(a pole). - Name
Registry - A two-way
RefId <-> Stringmapping. Every entity acrate::Partexposes — a vertex, edge, face, solid or sketch — has exactly one live entry here for as long as it exists. - Namer
- Builds the names one run of one operation gives to what it creates:
kind(operation,arg,...), see the crate docs. - Part
- A complete, editable CAD part: its boundary-representation topology, the sketches and datums used to build it, and a name for every one of those entities.
- Part
Description - Everything about a part’s topology that its names can express, and the positions of its vertices — with no internal id anywhere, so two parts built by the same program describe identically however their ids came out, and a description diffs well as text. Loops start at their smallest entry and holes are sorted, since neither has a first element of its own.
- Placed
Sketch - A sketch together with the plane it lies on:
plane.u/plane.vare the sketch’sx/y(unit, orthogonal),plane.w = u x vits unit normal. - Sketch
Id - A
crate::Part’s own id for one of its sketches.
Enums§
- Datum
Kind - What a datum stands for.
- RefId
- Every kind of entity a
crate::Partnames: the topology entities a user can pick in isolation (a coedge or shell never is), its sketches and its datums.
Functions§
- validate_
operation_ id - Checks that
idcan be an operation id: non-empty, and only ASCII letters, digits,_,-and.. Nothing that could be mistaken for the(,)and,that structure a name, so the names built from it stay unambiguous.