Expand description
Read Siemens NX .prt files into cadmpeg_ir::document::CadIr.
The codec recognizes the SPLMSSTR container signature, extracts compressed
Parasolid neutral-binary streams from the canonical part payload, and decodes
supported geometry and topology. Detection uses file content because NX and
Creo share the .prt extension.
Support level: L4
for single-body, RMFastLoad-selected, and terminal-lineage-resolved body
images; L2 for unresolved multi-partition history.
§Decode a part
use std::fs::File;
use cadmpeg_codec_nx::NxCodec;
use cadmpeg_ir::{Codec, CodecEntry, DecodeOptions};
let mut input = File::open("part.prt")?;
let result = NxCodec.decode(&mut input, &DecodeOptions::default())?;
println!("{} bodies", result.ir.model.bodies.len());
for loss in &result.report.losses {
println!("{:?}: {}", loss.severity, loss.message);
}CodecEntry::inspect returns the SPLMSSTR directory and embedded-stream
classifications without decoding entities. DecodeOptions::container_only
produces metadata IR and skips entity decode.
§Model and loss boundaries
NX stores part geometry in zlib-compressed Parasolid partition, deltas, or plain streams. The decoder converts Parasolid metre values to millimetres and emits points; analytic curves and surfaces; NURBS curves and surfaces; selected trimmed curves; and resolvable body, region, shell, face, loop, coedge, edge, and vertex topology. Each inflated Parasolid stream is also retained as an unknown record.
Read cadmpeg_ir::report::DecodeReport before using the model as a complete
representation. Deltas streams pair with the preceding equal-schema partition
in validated UG_PART segment order and apply
supported non-topology full records and exact-key tombstones using the last
event for each key. Valid partition topology remains authoritative. Unmatched
tombstone relations remain unresolved. Segment body aliases, primary-body
writers, and Boolean tool operands select terminal partition images when the
complete body lineage is unambiguous. Assembly files may contain only
references to external child parts.
Ordered feature-operation records, body dependencies, Boolean operations,
sketch record lanes, and numeric expressions transfer from the NX object
model. Operation suppression remains unresolved instead of being asserted
active. Embedded JT coordinates and triangle connectivity transfer as canonical
tessellations. Complete design history, assembly occurrence placement, material
and appearance assignment, class-specific entity attribute fields, and .prt
writing are not supported.
Part attributes transfer as document attributes. The public submodules
expose the lower-level container, stream, geometry, NURBS, intersection, and
topology decoders. The object-model extraction and attachment tier (record
families, feature semantics, and IR writing) is crate-internal and reached
only through the decode entry point. Applications that need a complete IR
entry point should use NxCodec.
Modules§
- container
- Parse the SPLMSSTR header and its
HEADERandFOOTERdirectories. - decode
- Build IR and diagnostics from an NX SPLMSSTR container.
- deltas
- Walk status-byte-framed Parasolid deltas topology records.
- geometry
- Decode point and analytic geometry records from Parasolid neutral-binary data.
- intersection
- Decode chart-backed Parasolid surface-intersection constructions.
- nurbs
- Decode NURBS curves and surfaces from Parasolid neutral-binary records.
- om
- Frame NX object-model entities using external boundary and identity arrays.
- om_
tokens - Literals used by the NX object-model decoder.
- parasolid
- Extract and classify compressed streams in an NX part payload.
- topology
- Parse supported fixed-record Parasolid topology.
Structs§
- NxCodec
- Decoder and inspector for Siemens NX
.prtfiles.