Skip to main content

Crate cadmpeg_step

Crate cadmpeg_step 

Source
Expand description

Writes cadmpeg_ir::CadIr documents as ISO 10303-21 STEP AP214 exchange files.

write_step emits a Part 21 AUTOMOTIVE_DESIGN file containing an ADVANCED_BREP_SHAPE_REPRESENTATION. It writes the product-definition and representation-context records needed to connect the file metadata to the boundary representation. Each reachable IR region becomes a MANIFOLD_SOLID_BREP or, when the region has inner shells, a BREP_WITH_VOIDS.

§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 StepReport::losses before retaining the output. Export continues when an IR fact has no representation in this writer. Unknown-surface faces and edges without typed 3D curves are omitted; pcurves, presentation data, source attributes, passthrough records, and parametric history are also reported rather than emitted. Body transforms remain unapplied, leaving affected coordinates in body-local space.

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.

Structs§

StepReport
Summary of a completed STEP export.
StepWriteOptions
Metadata written to the STEP FILE_NAME header record.

Enums§

StepError
Failure returned while streaming STEP output.

Functions§

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