Skip to main content

Crate kernel_api

Crate kernel_api 

Source
Expand description

printCAD’s geometry interface: meshes, profiles and solid operations as plain data, with no geometry code. The app’s kernel adapter answers it, and workbench packages build their solids as SolidOp plans through printcad-bench-api.

Versions follow printcad-bench-api‘s: 0.1.x speaks the workbench contract printcad:workbench@0.1, and a patch release only adds. FaceSurface and ProfileSegment, which the app sends a package, are #[non_exhaustive] unless the exhaustive feature (printCAD’s own) is on; SolidOp and the enums inside it keep their variants’ fields within a minor version.

Re-exports§

pub use naming::TopoName;

Modules§

naming
Names for the faces and edges of a built solid that survive a rebuild.

Structs§

BodyHandle
Handle to a body managed by the kernel.
CentreLine
The centre line of a pipe-like solid between two of its faces.
ChainError
Error from executing a body’s solid-op chain, attributed to the failing step so the caller can mark the matching feature.
ChainProbe
A probe asked part way through a solid-op chain: of the solid the first after_op ops make.
ChainProjection
A projection asked part way through a solid-op chain: of the solid the first after_op ops make.
Drawing2d
The curves of a 2D drawing file, in the drawing’s own coordinates.
DrawingCurve
One curve of a drawing, and whether the drawing marks it hidden (a hidden layer, or a dashed line type).
EdgeContinuity
Geometry questions a workbench may ask while it runs, answered by the kernel at once. Shapes arrive as the snapshot bytes the document keeps. How two faces of a shape meet across an edge they share: a point halfway along it, in the shape’s own frame, the largest gap between the edge and the faces, the largest angle between the faces’ normals along it (zero where they meet tangent), and the largest difference in how sharply they bend square to it (1/mm; zero where they meet curvature continuous, None where it could not be read).
EdgeProbe
A picked edge, as a point beside it and the way it runs there, and the names of the two faces it runs between. A rebuild finds the edge between faces of those names, the point choosing among several; without names, the nearest edge. A zero direction leaves the way open.
FaceProbe
A picked face: its name, and a point on it with its outward normal. A rebuild finds the face by its name, the point choosing among the pieces of a face that split; without a name (or when no face bears it any more), the face nearest the point.
FacesOf
Faces of another shape: the faces of shape (a native-format snapshot, moved by transform, a rigid row-major 4×4 matrix, into the body’s frame) nearest each of points.
FeaturePreview
What a feature being edited does to its body, beside the body without it: the view while it is edited.
Gap
How near two shapes come: the distance between their boundaries and a nearest point on each, in the first shape’s frame. Zero where the boundaries touch or cross.
ImportReport
What the reader had to say about a file.
ImportWarningKind
One kind of imperfect import, counted rather than repeated.
ImportedAnnotation
One annotation an imported file carries (a dimension, a tolerance, a datum or a note), with what it draws.
ImportedBody
A single body produced by an external import (e.g. STEP).
ImportedModel
Result of importing an external CAD file.
ImportedNode
One hierarchy node from the imported file’s product structure.
Inertia
A solid’s inertia at unit density, in mm⁵ (times a density in mass per mm³ gives mass times mm²), in the solid’s frame.
LoopEdge
One edge of a face’s boundary loop.
MedialPath
A stretch of a region’s medial axis, in the profile plane’s own 2D coordinates: points along one branch with the clearance at each, the radius of the largest disc centred there that stays inside the region.
MedialRegion
The medial axis of one region of a profile: an outer wire and its holes.
MeshSolidResult
A mesh body turned into a B-rep by the kernel: the shape, its mesh, the checker’s verdict, and what the conversion found.
Narrowest
Where a region is narrowest, and how narrow: the smallest clearance on its medial axis away from the branch ends at its corners (where the clearance runs down to nothing without the region getting any thinner). The wall there is twice the clearance.
Overlap
The solid two shapes share: its volume, its centre and its mesh, in the first shape’s frame.
PathFrame
A point on a path and the way the path runs there.
PathFrames
Stations along a path, by arc length: what is repeated along a curve stands at them.
PathLayout
Occurrences at stations along a path by arc length, the original at the first: occurrence k is moved from where the first station stands to where the k-th does, turned as the path turns between them when align.
PhysicalProperties
A body’s measure: its volume, surface area and centre of mass, exact where the kernel has a closed form for its faces.
Placement
A right-handed placement frame in world coordinates (millimetres).
ProbedCircle
The circle an edge runs round.
Profile
A set of closed wires on one plane. The largest-area wire is the outer boundary, the rest become holes.
ProfilePlane
The plane a profile lives on, in world coordinates (millimetres).
ProfileWire
A closed loop of profile segments. Consecutive segments share endpoints; a single Circle segment is a wire by itself.
ProjectionProbe
A solid’s edge projected onto a plane, or the curves where one of its faces crosses the plane: what a sketch takes from the solid it stands on, asked again of the solid a rebuild makes.
RebuildRequest
Request describing which features or bodies must be recomputed.
RebuildResponse
Response returned for every rebuild invocation.
RecognizedHole
A round hole found in a solid: a full bore, open at one end (blind) or both (through), closed by a flat bottom or a drill point.
RepairResult
A shape run through the kernel’s repair: the mended snapshot, its mesh, what the repair did, and what the checker finds afterwards.
SectionCurve
One curve where a plane crosses a shape.
SectionRun
Curves where a plane crosses a shape, end to end: a closed loop round a solid’s cut, or an open run where a sheet’s edge stops it.
ShapeHealth
What the kernel’s checker found in a shape.
SolidBuildResult
Result of executing a body’s solid-op chain.
TessellationSettings
Parameters controlling tessellation quality for viewport rendering.
TriMesh
Triangular mesh generated from kernel bodies for viewports and export.

Enums§

AnnotationKind
What an imported annotation states.
BoolKind
Boolean between the running solid and an external tool solid.
BooleanOp
How an extrusion combines with the body’s existing solid.
ChamferSpec
Chamfer sizing, mirroring the three standard input styles.
Continuity
How a surface meets the faces beside it across a shared edge.
CurveSource
A curve a surface is built from.
DrawingShape
The kinds of curve a drawing carries. Angles are radians, arcs run counter-clockwise.
EdgeSelection
Which edges of the current solid a dress-up applies to. Edges are identified geometrically: by a face they border (sample point on the face) or by a point near the edge itself.
ExtrudeTermination
Where a one-directional extrusion stops.
FaceSurface
The kind and placement of a kernel face’s surface, in the mesh’s frame.
ImportedNodeKind
Node type emitted by STEP import hierarchy reconstruction.
KernelError
Standardized error type for kernel interactions.
LengthUnit
Length unit declared by an imported source file.
LinearDeflectionMode
How linear (chord) deflection is chosen for kernel meshing.
LoftSection
One section of a SolidOp::LoftThrough.
PatternPath
The path a PathLayout runs along, in the chain’s frame.
PatternStep
One step of a SolidOp::Pattern: each applies to every occurrence of the steps before it, the original among them, which stands first.
PipeCorner
How a pipe’s section turns a sharp corner of its path.
PipeFrame
How a pipe’s section turns as it runs down its path.
PipePath
What a SolidOp::PipeThrough runs along.
PrimitiveKind
Parametric primitive shapes (dimensions in millimetres, angles degrees).
ProbeAnswer
What a solid answers to a ShapeProbe, in the solid’s own frame.
ProfileSegment
One segment of a closed 2D profile wire, in sketch-plane coordinates (millimetres). Arcs are encoded as three on-curve points so consumers never have to agree on a winding convention.
ProjectMode
What a SolidOp::Project makes of the faces a sketch lands on.
ProjectedEdge
An edge of a solid projected onto a plane, in the plane’s own 2D coordinates (along its x_axis and y_axis).
RevolveTermination
Where a revolution stops turning.
ShapeProbe
A question about a solid a reference stands on, named geometrically so it can be asked again of the solid a rebuild makes.
SolidOp
One step in a body’s build history. Shape-producing steps (Sweep, Loft, Pipe, Primitive) carry a BooleanOp; the remaining steps modify or combine the running solid directly.
SurfaceOp
The steps of surface modelling. A constructive step (every one but Sew, TrimByPlane and Mirror) adds its sheet to the body beside what is there; the rest act on all of the body’s shape.
SweepKind
How a profile is swept into a solid.
ThicknessJoin
How a thickness’s walls meet across an edge of the solid.

Traits§

Kernel
Trait implemented by any geometry kernel that can serve the application.
KernelQueries

Functions§

deserialize_pipe_frame
Reads a PipeFrame or the frenet flag it stands in for.

Type Aliases§

FacePoints
A face of a shape, named by a point inside it, and points on it, each with the normal its curvature is signed against.
KernelResult
Convenience alias for kernel fallible operations.