cadkit: a CAD file toolkit in Rust
I built cadkit, an open-source toolkit for reading CAD drawings and CityGML in Rust. It reads DWG, DGN V7 and V8, DXF, and CityGML 2.0, with a core that runs without a vendor SDK.
The same core is available as a Rust library, a command-line tool, Python and WebAssembly bindings, and a C interface with a C++ wrapper.
From files to useful data
Reading a drawing is only the first step. Software working with it needs access to geometry, layers, units, blocks, and attributes in a form it can inspect and use.
cadkit maps supported CAD records into a shared document model. An application can work with that model while the individual readers handle the details of each file format. Decoded properties that do not have a dedicated field remain available under format-specific keys. The architecture notes describe these mappings.
Making format support explicit
Records the readers cannot model can become Unknown entities, with warnings attached to the document. Unsupported files can return an error.
Those distinctions matter when another application uses the result. A drawing that opened successfully can still contain information that needs further inspection.
A small example
After building the CLI from the repository, you can inspect a local DXF drawing and export it:
cadkit info plan.dxf
cadkit layers plan.dxf
cadkit convert plan.dxf plan.svg --width 1200
cadkit convert plan.dxf plan.json --pretty
The commands provide a drawing summary, a layer listing, an SVG preview, and a JSON representation of the document.
Preserving CityGML
CityGML carries relationships and semantics beyond geometry. cadkit has a native representation for preserving that XML structure, alongside a projection into the shared geometry model. Exporting generic geometry requires an explicit coordinate reference system; building or room semantics are not inferred from linework. The CityGML notes document the boundaries.
Format support and validation
There is no DWG writer. DGN V8 export requires a seed file and supports a documented subset.
The validation record covers local tests across the interfaces and independent CityGML schema checks.
The source is available under MIT or Apache-2.0. If you build something with it, I’d like to hear about it.