Skip to main content

Crate cadmpeg_step

Crate cadmpeg_step 

Source
Expand description

Reads and writes cadmpeg_ir::CadIr documents as ISO 10303-21 STEP Part 21 exchange structures for AP203, AP214, and AP242.

write_step emits the application protocol selected by StepWriteOptions::schema. It writes product and representation context, connected exact shape, product occurrences, tessellation, presentation, and PMI when the target schema carries those domains.

§Export workflow

Construct or decode a cadmpeg_ir::CadIr, choose the header metadata in StepWriteOptions, then write to any std::io::Write sink:

use cadmpeg_ir::examples::unit_cube;
use cadmpeg_step::{write_step, StepWriteOptions};

let ir = unit_cube();
let mut bytes = Vec::new();
let report = write_step(&ir, &mut bytes, &StepWriteOptions::default())?;

assert!(bytes.starts_with(b"ISO-10303-21;"));
assert!(report.total_entities > 0);

Review cadmpeg_ir::ExportReport::losses before retaining report-mode output. StepUnsupportedPolicy::Reject rejects all such losses before any output byte is written. Opaque records, source attributes, unsupported procedural definitions, and target-schema incompatibilities are reported or rejected rather than silently discarded. Body and face colors become per-face STYLED_ITEM presentation; direct geometry and tessellation bindings retain their native presentation targets.

Coordinates are emitted unchanged under a millimetre length-unit context. Callers must convert non-millimetre geometry before export. Analytic curves and surfaces map to their corresponding STEP carriers. Rational and non-rational NURBS use the *_WITH_KNOTS entities.

StepError represents output-sink failures. Since the writer streams the header and DATA section, such a failure can leave partial output.

Modules§

lex
Byte-oriented ISO 10303-21 lexical analysis.
parse
Generic Part 21 record-graph parser.
strings
ISO 10303-21 string escape decoding and canonical encoding.

Structs§

StepCodec
STEP encoder with per-export header options.
StepWriteOptions
Metadata written to the STEP FILE_NAME header record.

Enums§

StepError
Failure returned while streaming STEP output.
StepSchema
STEP application-protocol targets supported by the Part 21 writer.
StepUnsupportedPolicy
Policy for semantic content not representable by the selected STEP target.

Functions§

write_step
Serializes an IR document as an ISO 10303-21 STEP AP214 file.