Skip to main content

Crate cadmpeg_codec_nx

Crate cadmpeg_codec_nx 

Source
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: L2 on the cadmpeg support ladder.

§Decode a part

use std::fs::File;

use cadmpeg_codec_nx::NxCodec;
use cadmpeg_ir::{Codec, 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);
}

NxCodec::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. Partition and deltas streams are decoded together without applying the tombstone relation that selects surviving faces. Multiple partitions are not combined through NX feature-history Booleans. Assembly files may contain only references to external child parts.

Procedural blend surfaces, design history, assembly occurrence placement, materials, appearances, attributes, tessellation, and .prt writing are not supported. The public submodules expose the lower-level container, stream, geometry, NURBS, and topology decoders; applications that need a complete IR entry point should use NxCodec.

Modules§

container
Parse the SPLMSSTR header and its HEADER and FOOTER directories.
decode
Build IR and diagnostics from an NX SPLMSSTR container.
geometry
Decode point and analytic geometry records from Parasolid neutral-binary data.
nurbs
Decode NURBS curves and surfaces from Parasolid neutral-binary records.
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 .prt files.