dxfscan 0.1.0

Binary DXF parser with typed entity data and lookup indices
Documentation
  • Coverage
  • 100%
    351 out of 351 items documented0 out of 18 items with examples
  • Size
  • Source code size: 138.83 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 14.61 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 17s Average build duration of successful builds.
  • all releases: 17s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • xorgy/dxfscan
    0 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • xorgy

dxfscan

A parser for the AutoCAD binary DXF format.

Parses a binary DXF file from a &[u8] slice in a single pass, producing typed entity data with indices for layers, styles, blocks, and entity handles. All string data borrows directly from the input for zero-copy operation. no_std + alloc.

The input must be in binary DXF format (starts with the 22-byte AutoCAD Binary DXF sentinel) in a R13 or later format. To convert a text DXF file to binary format (including at runtime), try dxfbin.

Usage

let data = std::fs::read("drawing.dxf").unwrap();
let drawing = dxfscan::scan(&data).unwrap();

for entity in &drawing.entities {
    let common = entity.common();
    // common.layer, common.color, common.handle, ...
}

if let Some(layer) = drawing.layer_by_name(b"Walls") {
    // layer.color, layer.lineweight, layer.is_on(), ...
}

if let Some(block) = drawing.block_by_name(b"Door") {
    // block.base_point, block.entities, ...
}

Supported entities

LINE, CIRCLE, ARC, ELLIPSE, LWPOLYLINE, POLYLINE, SPLINE, SOLID, TRACE, 3DFACE, POINT, TEXT, MTEXT, INSERT, DIMENSION, LEADER, HATCH, WIPEOUT, ATTRIB, ATTDEF. Unrecognized entity types are preserved as Entity::Unknown.

no_std

[dependencies]
dxfscan = { version = "0.1", default-features = false }

License

ISC