1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
//! # acadrust
//!
//! A pure Rust library for reading, writing, and inspecting CAD files in DXF
//! (ASCII and binary) and native binary DWG formats. DXF support spans R12
//! through R2018+; DWG support spans R13 through R2018+.
//!
//! ## Highlights
//!
//! - **48 top-level [`EntityType`] variants** for geometry, annotations,
//! dimensions, meshes, solids, regions, bodies, and surfaces.
//! - **ACIS/SAT/SAB** parsing and writing, including solid history and primitive
//! builders.
//! - **Tables and objects** for layers, styles, dictionaries, layouts, fields,
//! materials, and associative data.
//! - **Failsafe reads** with bounded [`ReadDiagnostic`] values and aggregate
//! [`ReadStats`] returned by [`DxfReader::read_with_stats`] and
//! [`DwgReader::read_with_stats`].
//! - **Automatic code-page handling** for older drawings.
//! - Optional Serde serialization and 3D import support.
//!
//! ## Feature Flags
//!
//! | Feature | Description |
//! |---------|-------------|
//! | `serde` | Enables `serde::Serialize` and `serde::Deserialize` implementations. |
//! | `import` | Enables STL, COLLADA, OBJ, glTF/GLB, and FBX importers. |
//!
//! ```toml
//! [dependencies]
//! acadrust = { version = "0.6.0", features = ["serde", "import"] }
//! ```
//!
//! ## Quick Start — DXF
//!
//! ```rust,no_run
//! use acadrust::DxfReader;
//! use acadrust::DxfWriter;
//!
//! # fn main() -> acadrust::Result<()> {
//! let doc = DxfReader::from_file("input.dxf")?.read()?;
//! println!("Entities: {}", doc.entities().count());
//! DxfWriter::new(&doc).write_to_file("output.dxf")?;
//! # Ok(())
//! # }
//! ```
//!
//! ## Quick Start — DWG
//!
//! ```rust,no_run
//! use acadrust::{CadDocument, Color, DwgReader, DwgWriter, EntityType, Line};
//!
//! # fn main() -> acadrust::Result<()> {
//! let mut reader = DwgReader::from_file("input.dwg")?;
//! let doc = reader.read()?;
//! println!("Entities: {}", doc.entities().count());
//!
//! let mut output = CadDocument::new();
//! let mut line = Line::from_coords(0.0, 0.0, 0.0, 100.0, 50.0, 0.0);
//! line.common.color = Color::RED;
//! output.add_entity(EntityType::Line(line))?;
//! DwgWriter::write_to_file("output.dwg", &output)?;
//! # Ok(())
//! # }
//! ```
//!
//! ## Failsafe Reading and Diagnostics
//!
//! Set [`DxfReaderConfiguration::failsafe`] to continue past recoverable
//! record errors. The returned [`ReadOutcome`] contains the document plus
//! source/decode counts and structured diagnostics; strict mode remains the
//! default.
//!
//! ```rust,no_run
//! use acadrust::{DxfReader, DxfReaderConfiguration};
//!
//! # fn main() -> acadrust::Result<()> {
//! let config = DxfReaderConfiguration { failsafe: true, ..Default::default() };
//! let outcome = DxfReader::from_file("drawing.dxf")?
//! .with_configuration(config)
//! .read_with_stats()?;
//! println!("{} entities, {} diagnostics", outcome.stats.output_entities,
//! outcome.stats.diagnostics.len());
//! # Ok(())
//! # }
//! ```
//!
//! ## Optional 3D Imports
//!
//! With `features = ["import"]`, `import_file` auto-detects STL, COLLADA,
//! OBJ, glTF/GLB, and FBX by extension and converts them to a [`CadDocument`].
//!
//! ```rust,no_run
//! # fn main() -> acadrust::Result<()> {
//! # #[cfg(feature = "import")]
//! # {
//! use acadrust::{import_file, ImportConfig};
//!
//! let doc = import_file("model.glb", &ImportConfig::default())?;
//! println!("Imported {} entities", doc.entities().count());
//! # }
//! # Ok(())
//! # }
//! ```
//!
//! ## Serde
//!
//! With `features = ["serde"]`, document types implement Serde traits and can
//! be serialized to JSON using your chosen JSON crate.
//!
//! ```rust,no_run
//! # fn main() -> acadrust::Result<()> {
//! # #[cfg(feature = "serde")]
//! # {
//! use acadrust::{CadDocument, DxfReader};
//!
//! let doc = DxfReader::from_file("drawing.dxf")?.read()?;
//! let json = serde_json::to_string(&doc).unwrap();
//! let restored: CadDocument = serde_json::from_str(&json).unwrap();
//! assert_eq!(restored.entities().count(), doc.entities().count());
//! # }
//! # Ok(())
//! # }
//! ```
//!
//! ## Module Overview
//!
//! | Module | Contents |
//! |--------|----------|
//! | [`document`] | [`CadDocument`] — central drawing container |
//! | [`entities`] | 48 top-level entity variants |
//! | [`tables`] | Table entries such as [`Layer`] and [`LineType`] |
//! | [`objects`] | Non-graphical objects, dictionaries, layouts, and styles |
//! | [`types`] | Primitives such as [`Vector3`], [`Color`], and [`DxfVersion`] |
//! | [`io`] | DXF, DWG, and optional import readers and writers |
//! | [`entities::acis`] | ACIS/SAT/SAB parsing, writing, and primitive builders |
//! | [`notification`] | Structured parse notifications and recovery counts |
//!
//! ## File Version Support
//!
//! | Code | AutoCAD | DXF | DWG |
//! |------|---------|-----|-----|
//! | AC1009 | R12 | R/W | — |
//! | AC1012 | R13 | R/W | R/W |
//! | AC1014 | R14 | R/W | R/W |
//! | AC1015 | 2000 | R/W | R/W |
//! | AC1018 | 2004 | R/W | R/W |
//! | AC1021 | 2007 | R/W | R/W |
//! | AC1024 | 2010 | R/W | R/W |
//! | AC1027 | 2013 | R/W | R/W |
//! | AC1032 | 2018+ | R/W | R/W |
//!
//! `R/W` describes the format-level reader and writer paths. Entity
//! availability varies by file version. See the
//! [per-version compatibility matrix](https://github.com/hakanaktt/acadrust/blob/main/src/docs/entity_status_matrix.md),
//! which records tested fixtures and CAD-engine audit results rather than a
//! guarantee for every possible drawing.
// Re-export commonly used types
pub use ;
pub use ;
// Re-export entity types
pub use ;
// Re-export table types
pub use ;
// Re-export document
pub use ;
pub use ;
// Re-export I/O types
pub use ;
pub use ;
pub use ;
// Re-export ACIS types
pub use primitives;
pub use ;
pub use ;
// Re-export import types (when `import` feature is enabled)
pub use ;
/// Library version
pub const VERSION: &str = env!;