# 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`:
```toml
[dependencies]
catia = "0.1.1"
```
Create an app and call APIs:
```rust
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:
```bash
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`.