Skip to main content

Crate cadmpeg_ir

Crate cadmpeg_ir 

Source
Expand description

Format-neutral CAD documents and the codec interfaces that produce them.

CadIr stores units, tolerances, and flat entity arenas connected by typed IDs. Its B-rep topology follows body → region → shell → face → loop → coedge → edge → vertex; topology references geometry carriers instead of nesting them. The document also carries neutral construction features, tessellation, appearance, source attributes, source-native namespaces, and uninterpreted UnknownRecords.

Start a hand-built document with CadIr::empty, populate its arenas, call CadIr::finalize to establish canonical identity order, then call validate() to check structural and numeric invariants. Use CadIr::to_canonical_json and CadIr::from_json for the versioned JSON form, and diff() for identity-based structural comparison.

Format crates implement Codec. Detection selects a codec from a byte prefix, inspection enumerates a container, and decoding returns a DecodeResult. Operation failures use CodecError. A successful decode reports partial transfer through DecodeReport and LossNote.

Annotations records source locations and fidelity by globally unique entity ID. An omitted exactness entry means byte-exact; explicit entries distinguish derived, inferred, and unknown values. Native namespaces and unknown records retain source-specific data outside the neutral model.

Product components, occurrence instancing, and assembly joints have neutral arenas. Product prototypes and occurrence trees retain assembly identity and placement. Joint and mate constraints are reserved.

Re-exports§

pub use annotations::AnnotationBuilder;
pub use annotations::Annotations;
pub use annotations::ExactnessNote;
pub use annotations::Provenance;
pub use codec::CadirEncoder;
pub use codec::Codec;
pub use codec::CodecEntry;
pub use codec::CodecError;
pub use codec::Confidence;
pub use codec::ContainerEntry;
pub use codec::ContainerSummary;
pub use codec::DecodeOptions;
pub use codec::DecodeResult;
pub use codec::Encoder;
pub use codec::ReadSeek;
pub use diff::diff;
pub use diff::ArenaDiff;
pub use diff::IrDiff;
pub use diff::ModifiedEntity;
pub use document::CadIr;
pub use document::SourceMeta;
pub use document::IR_VERSION;
pub use features::BodyRetentionMode;
pub use features::BodySelection;
pub use features::BodyTrimSide;
pub use features::CoilConstruction;
pub use features::CoilExtent;
pub use features::CoilPlacement;
pub use features::CoilResult;
pub use features::CoilSection;
pub use features::CoilSectionPlacement;
pub use features::ConfigurationBodies;
pub use features::ConfigurationId;
pub use features::CurveProjectionDirection;
pub use features::CurveProjectionDirectionState;
pub use features::DesignConfiguration;
pub use features::DesignParameter;
pub use features::FaceMotion;
pub use features::Feature;
pub use features::FeatureDefinition;
pub use features::FeatureId;
pub use features::ParameterId;
pub use features::ParameterPmi;
pub use features::ParameterValue;
pub use features::PmiDimensionSubtype;
pub use features::ScaleCenter;
pub use features::ScaleFactors;
pub use features::SketchSpace;
pub use native::LossCount;
pub use native::Native;
pub use native::NativeConvertError;
pub use native::NativeNamespace;
pub use native::NativeRecord;
pub use pmi::DatumReference;
pub use pmi::DimensionKind;
pub use pmi::GeometricToleranceKind;
pub use pmi::PmiAnnotation;
pub use pmi::PmiDefinition;
pub use pmi::PmiQuantity;
pub use pmi::PmiTarget;
pub use pmi::PmiValue;
pub use presentation::CameraState;
pub use presentation::PresentationDocument;
pub use presentation::PresentationId;
pub use presentation::PresentationState;
pub use presentation::ViewPresentation;
pub use presentation::PresentationItem;
pub use presentation::PresentationLayer;
pub use product::OccurrenceParent;
pub use product::Product;
pub use product::ProductOccurrence;
pub use products::AssemblyJoint;
pub use products::Component;
pub use products::ComponentId;
pub use products::ComponentKind;
pub use products::ComponentReference;
pub use products::CopyOnChangePolicy;
pub use products::ExternalDocumentReference;
pub use products::ExternalResolution;
pub use products::JointId;
pub use products::JointKind;
pub use products::JointLimits;
pub use products::JointOperand;
pub use products::Occurrence;
pub use products::OccurrenceId;
pub use report::Check;
pub use report::DecodeReport;
pub use report::ExportReport;
pub use report::Finding;
pub use report::LossCategory;
pub use report::LossCode;
pub use report::LossNote;
pub use report::Severity;
pub use report::StrictConsequence;
pub use report::ValidationReport;
pub use sketches::Sketch;
pub use sketches::SketchAxis;
pub use sketches::SketchConstraint;
pub use sketches::SketchConstraintDefinition;
pub use sketches::SketchConstraintId;
pub use sketches::SketchCoordinateAxis;
pub use sketches::SketchDistanceMeasurement;
pub use sketches::SketchEntity;
pub use sketches::SketchEntityId;
pub use sketches::SketchEntityUse;
pub use sketches::SketchGeometry;
pub use sketches::SketchId;
pub use sketches::SketchNativeOperand;
pub use sketches::SketchPlacement;
pub use sketches::SpatialSketch;
pub use sketches::SpatialSketchEntity;
pub use sketches::SpatialSketchEntityId;
pub use sketches::SpatialSketchEntityUse;
pub use sketches::SpatialSketchGeometry;
pub use sketches::SpatialSketchId;
pub use sketches::SpatialSketchProfile;
pub use source_fidelity::RetainedSourceRecord;
pub use source_fidelity::SourceFidelity;
pub use source_fidelity::SOURCE_FIDELITY_VERSION;
pub use spreadsheets::Spreadsheet;
pub use spreadsheets::SpreadsheetDimension;
pub use spreadsheets::SpreadsheetId;
pub use spreadsheets::SpreadsheetRange;
pub use subd::SubdEdge;
pub use subd::SubdEdgeTag;
pub use subd::SubdEdgeUse;
pub use subd::SubdFace;
pub use subd::SubdScheme;
pub use subd::SubdSurface;
pub use subd::SubdVertex;
pub use subd::SubdVertexTag;
pub use unknown::NativeUnknownRecord;
pub use unknown::UnknownRecord;
pub use validate::validate;
pub use validate::validate_with_source_fidelity;

Modules§

annotations
Sparse document-wide provenance and exactness annotations.
appearance
Material and visual-appearance assets plus topology bindings.
attributes
Source-native attributes attached to IR entities.
be
Checked big-endian primitive readers shared by binary codecs.
bytes
Serde adapter for byte vectors represented as base64 strings.
codec
Interfaces for detecting, inspecting, decoding, and encoding CAD formats.
compression
Compression helpers shared by container codecs.
cursor
Bounded byte cursor shared by binary codecs.
decode
Bounded ownership and decompression limits for untrusted decode input.
diff
Structural comparison of IR documents.
document
Versioned document structure and canonical arena ordering.
drawings
Format-neutral drawing sheets, resources, views, and annotations.
eval
Point evaluation of geometry carriers.
examples
Hand-built documents for examples and tests.
features
Neutral construction-feature taxonomy.
geometry
Geometry carriers: analytic surfaces, analytic curves, NURBS, and pcurves.
hash
Content hashing helpers shared by codecs.
ids
Typed string identifiers for the ID-referenced IR graph.
le
Checked little-endian primitive readers shared by binary codecs.
math
Small geometric value types shared by geometry and topology.
native
Source-format namespaces retained outside the format-neutral model.
pmi
Product-manufacturing information independent of design history.
presentation
Neutral persisted document and view presentation state.
product
Product prototypes and placed occurrence trees.
products
Neutral product structure and occurrence instancing.
read
Checked byte-slice readers shared by endian-specific modules.
report
Decode loss and validation findings.
semantic_annotations
Format-neutral semantic dimensions, notes, symbols, and callouts.
sketches
Neutral planar sketches, solved entities, and geometric constraints.
source_fidelity
Source annotations and retained native records produced during decode.
spreadsheets
Neutral spreadsheet structure and layout.
subd
Subdivision-surface control cages.
tessellation
Source tessellation retained alongside exact boundary representation.
topology
Boundary-representation topology.
transform
Rigid transforms.
units
Canonical units and tolerances.
unknown
Retained source records without a typed IR interpretation.
validate
Structural and numeric validation for CadIr.

Structs§

LossProvenance
Source location attached to a LossNote. Source location for an entity’s bytes.
SourceObjectAssociation
Native object identity and effective display metadata for a free carrier.

Enums§

Exactness
How an entity or field value was established from its source.

Functions§

cadir_json_schema
Generate the JSON Schema for the current CadIr representation.