cadmpeg-codec-catia 0.2.0

Read geometry and topology from .CATPart files.
Documentation

cadmpeg-codec-catia

cadmpeg-codec-catia reads CATIA V5 .CATPart files into CadIr. It recognizes the V5_CFV2 container layouts used by CATPart files and decodes supported analytic surfaces, NURBS surfaces, curves, vertices, and B-rep topology.

Support level: L2 on the cadmpeg support ladder for the standard-nested layout; other layouts are L1.

Add the codec and IR crates:

cargo add cadmpeg-codec-catia cadmpeg-ir

Decode a part with the shared codec interface:

use std::fs::File;

use cadmpeg_codec_catia::CatiaCodec;
use cadmpeg_ir::{Codec, DecodeOptions};

fn main() -> Result<(), Box<dyn std::error::Error>> {
    let mut input = File::open("part.CATPart")?;
    let decoded = CatiaCodec.decode(&mut input, &DecodeOptions::default())?;

    println!(
        "{} bodies, {} surfaces",
        decoded.ir.model.bodies.len(),
        decoded.ir.model.surfaces.len()
    );
    for loss in &decoded.report.losses {
        eprintln!("{:?}: {}", loss.severity, loss.message);
    }
    Ok(())
}

The decode report is part of the result. Check it before assuming that every native relationship or attribute has an IR representation.

Storage and model coverage

A CATPart starts with an outer V5_CFV2 container. Most files also contain a nested V5_CFV2 directory whose physical extents reconstruct logical streams such as MainDataStream and SurfacicReps. The codec identifies the storage variant before selecting a record decoder.

Standard nested parts have the broadest model coverage. The decoder emits analytic carrier surfaces and vertices, binds faces when stored senses resolve, and emits loops, coedges, edges, and endpoint assignments when the trim, support, and vertex tables form a complete unambiguous graph. FBB-only, zero-entity, E5, and object-stream layouts can yield analytic or NURBS carriers and selected edge bindings. Unresolved native bytes remain attached to the IR as unknown records, and the report describes missing geometry, topology, or attributes.

Use CatiaCodec::inspect to identify the storage variant and list catalogued logical streams without decoding entities. Set DecodeOptions::container_only when only source metadata and container diagnostics are needed.

The crate reads parts only. It does not write .CATPart files or decode assemblies, design history, tessellation, appearances, materials, persistent object tags, or general document metadata. The format support matrix tracks coverage by model layer.

Reference

Requires Rust 1.88 or later. Licensed under Apache-2.0.

CATIA V5 and other product names are trademarks of their respective owners. cadmpeg uses them only to identify the file formats this codec targets and is not affiliated with, endorsed by, or sponsored by any CAD vendor. See the clean-room and legal policy.