acadrust
A pure Rust crate for reading, writing, and inspecting CAD files.
acadrust handles ASCII and binary DXF plus native binary DWG without requiring an installed CAD application. File support spans DXF and DWG R12 through R2018+.
Quick Start
[]
= "0.6.2"
use ;
DxfReader detects ASCII and binary input automatically. To produce binary
DXF, use DxfWriter::new_binary(&doc).
Cargo features
| Feature | Default | Adds |
|---|---|---|
serde |
No | Serialize and Deserialize implementations for document types |
import |
No | STL, COLLADA, OBJ, glTF/GLB, and FBX importers |
Enable optional features as needed:
[]
= { = "0.6.2", = ["serde", "import"] }
Features
- DXF I/O — ASCII and binary formats, R12 through R2018+
- DWG I/O — Native binary formats, R12 through R2018+
- Broad entity coverage — 48 top-level
EntityTypevariants covering 2D geometry, annotations, dimensions, meshes, underlays, viewports, 3D solids, regions, bodies, and native surfaces - ACIS modeling data — SAT/SAB parsing and writing, B-rep topology, solid history, and primitive builders
- Tables and objects — Layers, linetypes, styles, dictionaries, layouts, materials, fields, dynamic blocks, and associative data
- Resilient reads — Optional failsafe recovery with bounded, structured diagnostics and read statistics
- Encoding support — Automatic handling of roughly 40 code pages for pre-2007 drawings
- Optional serialization — Serde support for document data
- Optional 3D imports — STL, COLLADA, OBJ, glTF/GLB, and FBX converted to acadrust documents
File Version Support
| File code | Release era | DXF | DWG |
|---|---|---|---|
| AC1009 | R12 | R/W | R/W |
| AC1012 | R13 | R/W | R/W |
| AC1014 | R14 | R/W | R/W |
| AC1015 | 2000 | R/W | R/W |
| AC1018 | 2004 | R/W | R/W |
| AC1021 | 2007 | R/W | R/W |
| AC1024 | 2010 | R/W | R/W |
| AC1027 | 2013 | R/W | R/W |
| AC1032 | 2018+ | R/W | R/W |
R/W means read and write support. Entity availability varies by file version.
Examples
use ;
use ;
use ;
use Vector3;
use ;
Requires features = ["import"].
use ;
use ;
Documentation
Development
cargo test
cargo test --all-features
cargo check --all-targets --all-features
Used By
- Open CAD Studio An open-source (GPLv3) CAD application that uses acadrust as its core native DWG/DXF engine for read/write operations and 3D modeling.
- CADCraft An open-source, AutoCAD-style drafting application written in Rust that uses acadrust for DWG read/write operations.
Support & Sponsorship
If you find this project useful and want to support ongoing maintenance and new features, consider buying me a coffee or becoming a patron!
Every contribution helps keep this project active and well-maintained. Thank you!
License
MPL-2.0 — see LICENSE.