Skip to content
cadkithome
Menu

Open source · MIT OR Apache-2.0

The open CAD engine, in pure Rust.

Read DWG, DGN, DXF and CityGML. Write DXF, DGN V8 and CityGML. From Rust, Python, JavaScript and C.

cargo add cadkit
Synthetic apartment floor plan (12 m by 9 m) rendered by cadkit-wasm LIVING 29.58 m² KITCHEN 11.47 m² ENTRY 10.20 m² BEDROOM 23.89 m² CORRIDOR BATH 4.53 m² STUDY 6.39 m² SYNTHETIC SAMPLE PLAN - cadkit.org - MIT OR Apache-2.0 A B C 1 2 3 6.45 5.25 12.00 4.95 3.75 9.00
File
cadkit-sample-plan.dxf
Format
DXF AC1032
Entities
161
Layers
7
Units
meter

Rendered at build time by cadkit-wasm 0.5.3. Download the DXF sample plan (31 KB)

Formats

Every reader produces the same format-neutral document. Readers degrade instead of failing: records they cannot model become Unknown entities and warnings on the document.

Format support in cadkit
FormatReadWriteStatusEvidence
DWGReadAC1014 (R14) to AC1032 (2018), including 2007No writerRead-only. R13 (AC1012) is untested; entity coverage is still growing.
DGN V7Readincluding tagsNo writerImplemented, including tags.
DGN V8ReadSubsetseed-based V8 writerLocal tests pass; external application acceptance is pending. Writing needs a seed file.
DXFReadASCII and binary, R12 to 2018WriteASCII, R12 to 2018Entity coverage is still growing.
CityGML 2.0Readnative XML and geometryWritenative XML and explicit generic geometryNew geometry needs an explicit CRS. Optional local structural TKGM preflight; not institutional acceptance.

Every interface also writes the document as JSON and SVG. There is no DWG writer yet. Local test evidence and the remaining external acceptance work are recorded in INTERCHANGE_STATUS.md.

The same task in four languages

Open the sample plan, list its layers, export SVG. File I/O and document operations ship for Rust, Python, JavaScript (WebAssembly, browser and Node) and C, with a C++17 wrapper over the C ABI.

  • The site's snippet checks run the Python and JavaScript snippets on the sample plan, type-check the Rust one with cargo check and compile the C one against cadkit.h.
  • The C API returns layer names inside the document JSON; the C example prints the count.
  • Rust API reference: docs.rs/cadkit.
src/main.rs
fn main() -> Result<(), Box<dyn std::error::Error>> {
let doc = cadkit::open("cadkit-sample-plan.dxf")?;
for layer in &doc.layers {
println!("{}", layer.name);
}
let options = cadkit::SvgOptions::new().with_width_px(1200.0);
std::fs::write("plan.svg", cadkit::to_svg(&doc, &options))?;
Ok(())
}

Modules you can adopt independently

The facade and format crates do not depend on the scene or GPU crates. Pick geometry and rendering separately; the host application supplies its UI, editing tools and domain rules.

Clean-room, with a ledger of sources

cadkit is built only from allowed references. Every source of format knowledge is recorded in PROVENANCE.md.

Allowed references

  • The public Open Design Specification for DWG
  • MIT-licensed projects: ACadSharp, ezdgn and the DGN driver of GDAL
  • Public sample files and our own analysis of them

Code or headers from copyleft-licensed CAD projects and from vendor SDKs are never read or ported.

Untrusted input

  • No panics on any input
  • Every size and count checked against configurable limits before allocation
  • Recoverable problems become warnings on the document
  • Every reader has a fuzz target that runs in CI

Built for

  • Drawing viewers and editors

    Read a drawing into one document model, render it as SVG or with the wgpu plan renderer, and keep your own UI and editing tools.

  • Converters and export pipelines

    Convert to DXF, seed-based DGN V8, CityGML 2.0, SVG or JSON from a library, the CLI or a script, with bounded stdin/stdout conversion in the CLI.

  • GIS and CityGML pipelines

    Read and write CityGML 2.0 with an explicit CRS, keep native IDs and references, and run an optional local structural TKGM preflight.

  • Inspection services

    Header-only inspection, configurable resource limits on every reader and warnings with stable codes for files you did not create.

Used by

  • Cady, an architectural CAD application, uses cadkit-geom, cadkit-scene and cadkit-gpu.

cadkit is vendor-neutral. Using it in your project? Say so in GitHub Discussions.

Start with the docs

Install one package, open a drawing, export it. The rest of the API builds on that.