Crate dxf_tools_rs

Crate dxf_tools_rs 

Source
Expand description

§DXF-Tools-RS

A pure Rust library for reading and writing CAD files in DXF format.

This library provides comprehensive DXF file support with high performance and memory efficiency, inspired by ACadSharp.

§Features

  • Read and write DXF files (ASCII and Binary formats)
  • Support for 30+ entity types
  • Complete table system (Layers, LineTypes, Blocks, TextStyles, DimensionStyles)
  • Extended data (XData) support
  • Multiple DXF versions (R12 through 2018+)

§Quick Start

use dxf_tools_rs::{CadDocument, io::dxf::DxfReader};

// Read a DXF file
let doc = DxfReader::from_file("sample.dxf")?.read()?;

// Access entities
for entity in doc.entities() {
    println!("Entity: {:?}", entity);
}

// Write to DXF
use dxf_tools_rs::io::dxf::DxfWriter;
DxfWriter::new(doc).write_to_file("output.dxf")?;

§Architecture

The library uses a trait-based design for maximum flexibility:

  • CadObject - Base trait for all CAD objects
  • Entity - Trait for graphical entities
  • TableEntry - Trait for table entries
  • CadDocument - Central document structure

§Performance

DXF-Tools-RS is designed for high performance:

  • 2-3x faster than the C# version
  • 30-50% less memory usage
  • Zero-copy parsing where possible
  • Parallel processing for large files

Re-exports§

pub use error::DxfError;
pub use error::Result;
pub use types::DxfVersion;
pub use types::BoundingBox2D;
pub use types::BoundingBox3D;
pub use types::Color;
pub use types::Handle;
pub use types::LineWeight;
pub use types::Transparency;
pub use types::Vector2;
pub use types::Vector3;
pub use entities::Arc;
pub use entities::Circle;
pub use entities::Ellipse;
pub use entities::Entity;
pub use entities::EntityType;
pub use entities::Line;
pub use entities::LwPolyline;
pub use entities::MText;
pub use entities::Point;
pub use entities::Polyline;
pub use entities::Spline;
pub use entities::Text;
pub use tables::AppId;
pub use tables::BlockRecord;
pub use tables::DimStyle;
pub use tables::Layer;
pub use tables::LineType;
pub use tables::Table;
pub use tables::TableEntry;
pub use tables::TextStyle;
pub use tables::Ucs;
pub use tables::VPort;
pub use tables::View;
pub use document::CadDocument;
pub use io::dxf::DxfReader;
pub use io::dxf::DxfWriter;

Modules§

document
CAD document structure
entities
CAD entity types and traits
error
Error types for DXF-Tools-RS library
io
I/O module for reading and writing CAD files in DXF format
objects
Non-graphical objects (OBJECTS section)
tables
CAD table types and management
types
Core types used throughout DXF-Tools-RS
xdata
Extended Data (XDATA) support

Constants§

VERSION
Library version