Crate dxf [] [src]

This crate provides the ability to read and write DXF CAD files.

Examples

Open a DXF file from disk:

use dxf::Drawing;
use dxf::entities::*;

let drawing = try!(Drawing::load_file("path/to/file.dxf"));
for e in drawing.entities {
    println!("found entity on layer {}", e.common.layer);
    match e.specific {
        EntityType::Circle(ref circle) => {
            // do something with the circle
        },
        EntityType::Line(ref line) => {
            // do something with the line
        },
        _ => (),
    }
}

Saving a DXF file to disk:

use dxf::Drawing;
use dxf::entities::*;

let mut drawing = Drawing::new();
drawing.entities.push(Entity::new(EntityType::Line(Line::default())));
try!(drawing.save_file("path/to/file.dxf"));

Reference

Since I don't want to fall afoul of Autodesk's lawyers, this repo can't include the actual DXF documentation. It can, however contain links to the official documents that I've been able to scrape together. For most scenarios the 2014 documentation should suffice, but all other versions are included here for backwards compatibility and reference between versions.

R10 (non-Autodesk source)

R11 (differences between R10 and R11)

R12 (non-Autodesk source)

R13 (self-extracting 16-bit executable)

R14

2000

2002

2004

2005

2006

2007 (Autodesk's link erroneously points to the R2008 documentation)

2008

2009

2010

2011

2012

2013

2014

These links were compiled from the archive.org May 9, 2013 snapshot of http://usa.autodesk.com/adsk/servlet/item?siteID=123112&id=12272454&linkID=10809853 (https://web.archive.org/web/20130509144333/http://usa.autodesk.com/adsk/servlet/item?siteID=123112&id=12272454&linkID=10809853)

Modules

entities
enums
header
tables

Structs

Color

Represents an indexed color.

Drawing

Represents a DXF drawing.

LineWeight

Represents a line weight.

LwPolylineVertex

Represents a single vertex of a LwPolyline.

Point

Represents a simple point in Cartesian space.

Vector

Represents a simple vector in Cartesian space.

Enums

DxfError
ExpectedType

Functions

get_code_pair_type
get_expected_type
get_reader_function

Type Definitions

DxfResult