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 beyond what a three-point arc means (arc), which every reader of a profile shares, and the nearest point of a segment or a triangle (nearest), which every pick and snap shares, where a ray crosses a triangle (ray), a polygon’s area and what it holds (polygon), and the box around a mesh moved by a placement (Aabb). 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 aabb::Aabb;
pub use arc::ThreePointArc;
pub use naming::TopoName;
pub use pmi::PmiDatum;
pub use pmi::PmiDimension;
pub use pmi::PmiTolerance;
pub use pmi::SemanticPmi;

Modules§

aabb
An axis-aligned box in single precision: what a mesh spans, moved by a placement or a matrix as a box around its moved corners, so every caller that moves a box gets the same answer.
arc
What a ProfileSegment::Arc’s three points mean, so the sketcher’s regions, its drawing tools and the kernel adapter agree on which triples make an arc and where it runs.
naming
Names for the faces and edges of a built solid that survive a rebuild.
nearest
The point of a segment or a triangle nearest a given point: one implementation over plain coordinates, in single or double precision, a segment in any number of dimensions and a triangle in three.
pmi
Semantic annotations exchanged without kernel topology. Probes name the controlled faces; the caller specifies their coordinate frame.
polygon
A closed polygon in a plane, its corners in order and the last joined back to the first: the area it encloses and whether it holds a point. One implementation over plain coordinates, in single or double precision.
ray
Where a ray crosses a triangle, in single or double precision, one test for every caller so that neighbouring triangles agree on the edge they share.

Structs§

BodyHandleDeprecated
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.
ChainFit
How a chain of points is fitted with lines and arcs.
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.
ConstructionItem
A named item of construction geometry.
DistanceRequest
Points to measure to a reference surface, and how.
Drawing2d
The curves and texts 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).
DrawingText
A line of text on a drawing.
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.
EdgeRefusal
The edges of a fillet or chamfer the kernel refused.
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.
FailingEdge
An edge a fillet or chamfer could not round or bevel: refused alone, or in a group of the op’s edges meeting at a vertex.
FeaturePreview
What a feature being edited does to its body, beside the body without it: the view while it is edited.
FitAnswer
A least-squares fit and what it rests on.
FitRequest
Points to fit a shape to, and how.
FreeMotion
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.
GrowAnswer
A grown region and its fit.
GrowRequest
A region to grow over a mesh from points near it, and how.
IgesExport
Construction geometry written as IGES, with any omitted geometry or names reported.
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.
MeshChainAnswer
A mesh history built: the mesh at its end, what each step did, and the step that failed, when one did (the mesh is then the one before it).
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.
MeshStep
What one step of a mesh history did.
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.
OpWarning
A warning on one op of a chain that built (or, in SolidBuildResult::probe_warnings and projection_warnings, on one probe or projection, op_index then being its place in their list).
Orientation
A scan’s proposed upright frame, expressed in its own coordinates.
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.
RebuildRequestDeprecated
Request describing which features or bodies must be recomputed.
RebuildResponseDeprecated
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.
RegisterRequest
Points to bring onto a reference surface by a rigid motion, and how.
Registration
A rigid motion that brings points onto a reference, and how well.
RepairResult
A shape run through the kernel’s repair: the mended snapshot, its mesh, what the repair did, and what the checker finds afterwards.
RoundDistances
A round meeting its faces at two distances: the fillet’s radius on the reference face, other on the face across the edge.
RoundSide
One face beside a rounded edge.
RoundSides
The two faces beside the first edge of a round of distances, as a drag reads them: the face its first distance is on, then the other.
SectionChain
One connected polyline of a mesh’s section by a plane, in the mesh’s own frame.
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.
ShadowAnswer
What a mesh’s shadow is: its loops as traced (outer boundaries counter-clockwise, holes clockwise) and the outline of lines, arcs and circles fitted around them.
ShadowRequest
The shadow a mesh casts on a plane, and an outline fitted around it.
ShapeHealth
What the kernel’s checker found in a shape.
SizeLimit
The largest size a fillet or chamfer builds at on the solid before it.
SolidBuildResult
Result of executing a body’s solid-op chain.
SymmetryPlane
A scan’s mirror plane, expressed in its own coordinates.
TessellationSettings
Parameters controlling tessellation quality for viewport rendering.
ThicknessRequest
Points on a part whose wall thickness is read, and how.
TriMesh
Triangular mesh generated from kernel bodies for viewports and export.
TrimAnswer
A trimmed solid and how it meets the scan.
TrimRequest
A solid trimmed where a scan breaks off: the scan’s triangles lying deeper than depth inside the solid are the break, which is extended past the solid, thickened by gap to each side and cut away. Both in the solid’s frame.
VariableRadius
A round whose radius runs along its edges, taken as one run end to end: the fillet’s radius at the run’s start, end at its end, and any radii between at shares of the run’s length, smoothly between them and never past them.
VolumeRegion
A connected volume where a scan and a solid differ the same way, in the solid’s frame.

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.
ChamferCorner
How a chamfer closes a vertex where three or more of its bevels meet.
ChamferSpec
Chamfer sizing, mirroring the three standard input styles.
ConstructionShape
Reference geometry with no topology: what STEP and IGES files carry as construction geometry beside (or instead of) a part’s solid.
Continuity
How a surface meets the faces beside it across a shared edge.
CurveSource
A curve a surface is built from.
DistanceTarget
What distances are measured to.
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.
FilletCorner
How a fillet closes a vertex where its rounds meet.
FitKind
What shape a set of measured points is fitted to.
FitMethod
How a shape is fitted to measured points.
FittedShape
A fitted shape, in the request’s frame. Directions are unit length.
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.
MeshFairing
How a hole’s added vertices settle.
MeshOp
One step of a mesh’s history, in the mesh’s own frame.
MeshOperand
A bounded solid a mesh boolean takes, as it stood when the step was made.
MeshRegion
Part of a mesh, by where its points are: a face is in it when all three of its corners are.
MeshSide
Which side of an open sheet a shell thickens: inward is against the way its triangles face.
MeshStepReport
Measurements made by a mesh step, in millimetres.
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.
PointMatch
When two mesh points are one point.
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.
RoundProfile
The section of a round set back a different distance on each face.
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.

Constants§

JOIN_MM
How near two ends of curves are one point, in millimetres, wherever curves cross between the kernel and its callers: consecutive segments of a ProfileWire meet within it, the kernel chains a section’s curves (SectionRun) within it, and ends read off a solid’s edges (sectioned, borrowed or projected) that lie within it are one point. A solid’s edges meet at a vertex only within its tolerance, which an imported or fuzzily joined solid widens, and points read off its mesh are single precision. A caller deciding what connects on its own terms, as the sketcher’s regions do, joins no wider than this, so whatever it closes the kernel closes too.

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.