Skip to main content

Module pmi

Module pmi 

Source
Expand description

PMI — Product and Manufacturing Information: the document’s pmi block (views that own annotations), the annotation type table with its schemas and selection predicates, and the history tail that resolves every annotation against the just-built scene into a typed PmiReport.

§The pmi block

{ views: [{ id, name, camera?, display, annotations: [...] }], idCounter } on the history request, round-tripped through the saved document and ABSENT on every document without PMI (so those files re-serialize byte-identically). A view is a named camera snapshot plus display state (text size, wireframe, section; what it hides is its hide steps) plus an ordered list of annotations; a saved view maps to an AP242 DRAUGHTING_MODEL + CAMERA_MODEL_D3 on export and is the unit a future drawing sheet places. What a view hides is its hide steps (hide annotations naming solids / components, tracked like explode steps; the solids hidden at capture are its baseline step): PmiView::hides is the one rule every consumer reads, and the report lists the outcome per view.

An annotation is { type, enabled, inputParams, labelWorld? }: its params follow a kernel schema exactly like a feature’s or an assembly constraint’s (inputParams.id is its id, {SHORT}{n} minted from the block’s counter), so the app’s dialog engine draws every annotation form from pmi_schema_catalogue and nothing is hand-written. Geometry is referenced by kernel entity NAME (faces / edges, {solid}@x,y,z vertices in WORLD coordinates, D/P frame names) — plain and component-owned geometry alike — so a rebuilt model re-resolves every value and a renamed or deleted entity puts the annotation into an error status without ever aborting the view or the run.

Every drawn annotation has an annotation plane: its optional plane reference names a planar face or a reference plane the annotation lies IN (label projected onto it, drags stay in it, the dimension / extension lines and frames drawn in it, the AP242 ANNOTATION_PLANE placed on it); left empty, the annotation aligns to the view camera. A picked plane must be parallel to what it carries — a linear dimension’s direction, an angle’s or a circle’s plane — or the annotation reports an error rather than a foreshortened value. Drawing sheets will show, per sheet view, the annotations whose plane is parallel to the view.

§The tail

finish_history_run runs after the wire-harness tail on every run and resolves EVERY view’s annotations (a few name lookups each) into a PmiReport: per annotation the status, the display text (value + tolerance block, kernel-formatted so the viewport and the STEP file agree), the measured value, the resolved analytic geometry the presentation is laid out from (layout) and the label position (stored, or a default derived from the geometry). The report rides HistoryResult.pmi (never the JSON ABI) and the render crate’s scene report across the runner seam. Nothing here touches the incremental feature cache: PMI is annotation state, not history, and a label drag never re-executes a feature.

§Measurement contracts (kernel queries only)

Every value is read from the exact BREP through crate::assembly_resolve (planes, carrier lines, circles, axes, points) — never from tessellation. Linear: point–point, point–line (perpendicular), line–line (carrier lines: parallel spacing or closest points), point–plane, parallel plane spacing, single straight edge length, optional X/Y/Z component. Radial: cylinder / sphere / circular edge radius from the face metadata. Angle: the two elements’ directions folded to acute / obtuse / reflex, optionally reversed. Hole callout: the owning Hole feature’s parameters. Datum letters are unique per part; a feature control frame’s datum references must name defined datums.

Re-exports§

pub use anchor::balloon_head;
pub use anchor::nearest_displayed_point;
pub use anchor::nearest_displayed_point_on_edge;
pub use anchor::nearest_point_on_edge;
pub use anchor::nearest_point_on_solid;
pub use anchor::pose_apply;
pub use anchor::pose_unapply;
pub use anchor::BalloonAnchor;
pub use anchor::BalloonAnchorMode;
pub use anchor::HalfSpace;
pub use anchor::HeadScope;
pub use anchor::PmiPose;
pub use anchor::SolidPoses;
pub use annotations::pmi_schema_catalogue;
pub use annotations::pmi_type;
pub use annotations::PmiTypeDef;
pub use annotations::PMI_TYPES;

Modules§

anchor
Balloon leader anchoring: where a Find-number balloon’s arrow head lands.
annotations
The PMI annotation type table — eleven types, each a module exposing its PmiTypeDef (DEF), its schema() and its resolver. The table is the third applicability family beside the feature catalogue and the assembly constraint types: an annotation predicate accepts plain AND component geometry.
font
The stroke font of the PMI polyline presentation — single-line glyphs (cap height 10, baseline 0, body x ∈ [0, 6], monospace advance 7.5 = 0.75 × cap height, the same constant the layout’s FCF / datum cells are sized by). Digits, upper-case letters (lower case maps to upper case), punctuation, and the PMI symbols the resolvers emit: ⌀ ± ° × ⌴ ⌵ ↧ △, Ⓜ Ⓛ and the fourteen characteristic symbols. An unknown character is drawn as a box so nothing vanishes silently. Proofed from a rasterized sheet before being emitted as this table.
layout
PMI presentation layout — the polylines an annotation is DRAWN with, laid out from its resolved geometry and its label position. ONE implementation serves the viewport overlay (screen-constant sizes, from the camera’s world-per-pixel) and the AP242 polyline presentation (fixed model-unit sizes from the view’s text size), so the file shows what the screen shows.
resolve
PMI reference resolution and the measurement helpers every annotation resolver shares.

Structs§

FcfFrame
The cells of a feature control frame.
PluginAnnotationOutput
Provider output. Only geometry with a host-owned layout adapter is accepted.
PluginAnnotationReplay
Serializable transition input needed to reproduce an accepted callback result. No geometry/output presentation is cached: callbacks always run and validate.
PmiAnnotation
One annotation: schema-driven params keyed by its type.
PmiAnnotationReport
One resolved annotation.
PmiCamera
The camera snapshot: eye / target / up / projection / viewport size — the render crate’s ViewCamera minus near/far, which are a per-frame depth window and never persisted. Applying a snapshot under another viewport aspect refits the frustum, preserving the apparent size at the target.
PmiContext
What the annotation resolvers read: the live scene, the request (hole features for callouts, the datum registry) and the expression sheet.
PmiDisplay
Per-view display state.
PmiPlane
A resolved annotation plane: the plane the annotation lies in (its plane reference — a planar face or a reference plane), normal oriented toward the view’s captured camera, x_axis the in-plane text direction (the camera’s right projected into the plane). The viewport overlay and the AP242 ANNOTATION_PLANE both lay the annotation out in this frame.
PmiReport
The tail’s resolution of every view’s annotations.
PmiSection
A display-only half-space through origin plus an offset along the normal.
PmiSectionPlane
One further plane of a PmiSection: X, Y, Z or View (the captured camera’s direction, frozen in normal when set), offset along it from the section’s origin, flip keeping the other side.
PmiState
The document’s pmi block. Loading it folds every view’s legacy display.hidden list into that view’s baseline hide step (see PmiDisplay), so every reader — the run, the parts library, STEP export, plugins, the 3D PDF — sees one representation.
PmiView
A PMI view: a camera snapshot, display state and the annotations it owns.
PmiViewReport
Resolved
The outcome of one annotation’s resolver.
ToleranceBlock
The tolerance block of a dimension: tolMode none / symmetric / deviation / limits with tolUpper / tolLower.

Enums§

PmiGeometry
The analytic geometry an annotation resolved to — what the presentation (layout) and the STEP semantic export are built from.
PmiProjection
PmiStatus
ToleranceMode

Constants§

HIDE_BASELINE_PARAM
The hide step param marking a view’s baseline step: the solids hidden when the view was captured (or a generated instructions step’s not-yet-placed parts, or a pre-2026-11-05 display.hidden list). A name in it that no longer exists is skipped, not an error.

Functions§

baseline_hide_id
The id a view’s baseline hide step is given: HID-{view id}, unique (one baseline per view) and derived, so making one never advances the document’s id counter and every id minted after it stays what it was.
clamp_text_size
The text size clamp: [1, 288] points.
entry_names_solid
Whether a SOLID / COMPONENT list entry names solid: the solid itself, or a component it belongs to (ACOMP1 covers ACOMP1:Part and a nested ACOMP1:ACOMP2:Part; a prefix of a longer name, ACOMP1 for ACOMP10:Part, is not the name). The rule a section’s Not cut list and a view’s hide steps share.
format_dimension
The dimension text: prefix (⌀ / R / "") + the nominal (+ the tolerance block) + suffix (° / ""); a reference dimension is parenthesized and shows no tolerance.
format_number
value with decimals places (0..=8), no exponent.
resolve_annotation
Resolve one annotation through its type’s resolver into a report row: the type’s measurement, then its annotation plane (camera orients the plane toward the view; None for a view without a camera).
resolve_state
Resolve state (the tail’s body, callable on any scene).