# 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`](https://crates.io/crates/dxfbin).
## Usage
```rust
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`
```toml
[dependencies]
dxfscan = { version = "0.1", default-features = false }
```
## License
ISC