catia

Crates.iocatia
lib.rscatia
version0.1.1
created_at2025-10-14 03:59:24.737443+00
updated_at2025-10-14 06:12:45.334234+00
descriptionRust COM bindings and helpers for CATIA V5
homepagehttps://gitee.com/luzhihaoTestingLab/rscatia
repositoryhttps://gitee.com/luzhihaoTestingLab/rscatia.git
max_upload_size
id1881627
size87,899
luzhihaoTestingLab (luzhihaoTestingLab)

documentation

https://gitee.com/luzhihaoTestingLab/rscatia

README

catia

Rust COM bindings and helpers for CATIA V5 on Windows.

Features

  • COM bootstrap helpers (ComApartment) for safe COM initialization.
  • High-level CatiaApp wrapper around CATIA V5 COM automation.
  • CatiaApi trait with mock and real implementations for testing.
  • Examples covering documents, selection, export, and dialogs.

Requirements

  • Windows only (windows crate, Win32 COM APIs).
  • For real automation: CATIA V5 installed and registered ProgID (e.g. CATIA.Application).
  • For unit/demo: use --mock to run examples without CATIA.

Quick Start

Add to Cargo.toml:

[dependencies]
catia = "0.1.1"

Create an app and call APIs:

use catia::{ComApartment, CatiaApp};
use catia::catia::{CatiaApi, CatiaMock};

fn main() -> windows::core::Result<()> {
    let _apt = ComApartment::new()?;
    // Use real CATIA if ProgID is registered, otherwise mock
    let app: Box<dyn CatiaApi> = if catia::com::is_progid_registered("CATIA.Application")? {
        Box::new(CatiaApp::new("CATIA.Application")?)
    } else {
        Box::new(CatiaMock)
    };

    println!("CATIA visible? {}", app.visible()?);
    Ok(())
}

Run examples:

cargo run --example selection_search -- --mock --query "CATGmoSearch.Point,all"
cargo run --example export_document -- --mock --path "C:/Temp/Export.stp" --fmt stp

Notes

  • COM calls mirror CATIA V5 automation (Documents, Selection, ActiveDocument, etc.).
  • Mock mode prints simulated COM calls for local testing.
  • Export options may vary by document type; adapt as needed.

License

MIT. See LICENSE.txt.

Commit count: 0

cargo fmt