Skip to main content

Crate cadmpeg_codec_f3d

Crate cadmpeg_codec_f3d 

Source
Expand description

Read and write Autodesk Fusion .f3d archives.

F3dCodec implements Codec and Encoder. Decoding produces a CadIr document with B-rep topology, analytic and cached NURBS geometry, body transforms, design and sketch records, construction history, and appearances. Encoding replays an unchanged decoded archive byte for byte, applies supported semantic edits to retained source data, or creates an archive from the supported source-less profile.

Support level: L4 on the cadmpeg support ladder.

§Decode

use cadmpeg_codec_f3d::F3dCodec;
use cadmpeg_ir::{Codec, CodecEntry, DecodeOptions};
use std::fs::File;

let mut input = File::open("part.f3d")?;
let result = F3dCodec.decode(&mut input, &DecodeOptions::default())?;
for loss in &result.report.losses {
    eprintln!("{:?}: {}", loss.severity, loss.message);
}

CodecEntry::inspect classifies the ZIP entries and reads ASM B-rep headers without building geometry. DecodeOptions::container_only provides the corresponding metadata-only CadIr.

§Encode

use cadmpeg_codec_f3d::F3dCodec;
use cadmpeg_ir::{Codec, CodecEntry, DecodeOptions, Encoder};
use std::fs::File;

let mut input = File::open("part.f3d")?;
let mut result = F3dCodec.decode(&mut input, &DecodeOptions::default())?;
// Edit supported fields in result.ir.
let mut output = File::create("part-edited.f3d")?;
F3dCodec.encode(&result.ir, &mut output)?;

§Data flow

container selects the .smbh history stream, or the first .smb when no .smbh exists. sab frames its active record slice. The Design body map selects every B-rep blob contributing bodies to the document model; brep builds each topology chain from bodies through vertices and points, while nurbs decodes cached spline carriers. design, history, and materials populate source-native records and appearance bindings.

ASM model-space lengths become millimetres. Directions, ratios, angles, knots, weights, and UV parameters retain their native scale.

Inspect cadmpeg_ir::report::DecodeReport::losses before consuming a decode. A stream that cannot produce geometry returns container metadata, retained source data, and blocking geometry and topology losses. Referenced carrier bytes needed for passthrough remain available as cadmpeg_ir::unknown::UnknownRecord values.

Modules§

asm_header
Parse ASM BinaryFile4 and BinaryFile8 headers and locate history data.
brep
Build B-rep topology and geometry from a framed SAB record table.
container
Scan and classify the ZIP container inside a .f3d file.
decode
Assemble a .f3d archive into a CadIr document and DecodeReport.
design
Decode Fusion Design object, sketch, identity, and construction records.
f3z
Decode a multi-document .f3z archive (spec §1.5).
history
Decode the ASM construction-history partition after the active model slice.
materials
Decode Fusion .protein appearance assets and bind them to B-rep bodies.
nurbs
Decode cached B-spline blocks from spline and procedural SAB records.
records
Fusion parametric-design records and links to the solved B-rep.
sab
Frame SAB (ACIS binary) token streams.
validate
Semantic validation of the Fusion f3d native namespace.
xref
External-reference (XRef) and document-type entries of a .f3d container (spec §1.2, §1.4).

Structs§

F3dCodec
The Autodesk Fusion .f3d container codec.