Skip to main content

Crate geop_core_part

Crate geop_core_part 

Source
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 step E built, extrude(E,start) and extrude(E,end) its caps, extrude(E,K,c3) the side face swept by line c3 of sketch K, extrude(E,K,c3,end) that face’s edge on the end cap, and extrude(E,K,p1) the edge swept by sketch point p1.
  • boolean(B,E1,E2,i,n) is the i-th of the n points where edges E1 and E2 (by their names before step B) cross, counted along E1.

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.
EdgeDescription
FaceDescription
A face’s boundary loops, each as the coedges it runs through: +E / -E for edge E traversed forwards / backwards, @V for a degenerate coedge sitting at vertex V (a pole).
NameRegistry
A two-way RefId <-> String mapping. Every entity a crate::Part exposes — 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.
PartDescription
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.
PlacedSketch
A sketch together with the plane it lies on: plane.u/plane.v are the sketch’s x/y (unit, orthogonal), plane.w = u x v its unit normal.
SketchId
A crate::Part’s own id for one of its sketches.

Enums§

DatumKind
What a datum stands for.
RefId
Every kind of entity a crate::Part names: 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 id can 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.