@linkiez/dxf-renew 7.1.0 → 7.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc.json +1 -16
- package/.yarn/install-state.gz +0 -0
- package/ARCHITECTURE.md +163 -0
- package/CHANGELOG.md +16 -0
- package/README.md +72 -10
- package/{PLAN.md → ROADMAP.md} +227 -35
- package/dist/dxf.js +1090 -344
- package/docs/FIXTURE_VALIDATION_EZDXF.md +1 -1
- package/lib/Helper.cjs +4 -0
- package/lib/Helper.cjs.map +3 -3
- package/lib/Helper.js +4 -0
- package/lib/Helper.js.map +2 -2
- package/lib/entityToPolyline.cjs +95 -0
- package/lib/entityToPolyline.cjs.map +3 -3
- package/lib/entityToPolyline.js +95 -0
- package/lib/entityToPolyline.js.map +2 -2
- package/lib/handlers/entities.cjs +22 -2
- package/lib/handlers/entities.cjs.map +3 -3
- package/lib/handlers/entities.js +22 -2
- package/lib/handlers/entities.js.map +2 -2
- package/lib/handlers/entity/mleader.cjs +69 -0
- package/lib/handlers/entity/mleader.cjs.map +7 -0
- package/lib/handlers/entity/mleader.js +34 -0
- package/lib/handlers/entity/mleader.js.map +7 -0
- package/lib/handlers/entity/mline.cjs +91 -0
- package/lib/handlers/entity/mline.cjs.map +7 -0
- package/lib/handlers/entity/mline.js +56 -0
- package/lib/handlers/entity/mline.js.map +7 -0
- package/lib/handlers/entity/oleframe.cjs +98 -0
- package/lib/handlers/entity/oleframe.cjs.map +7 -0
- package/lib/handlers/entity/oleframe.js +63 -0
- package/lib/handlers/entity/oleframe.js.map +7 -0
- package/lib/handlers/entity/ray.cjs +81 -0
- package/lib/handlers/entity/ray.cjs.map +7 -0
- package/lib/handlers/entity/ray.js +46 -0
- package/lib/handlers/entity/ray.js.map +7 -0
- package/lib/handlers/entity/region.cjs +67 -0
- package/lib/handlers/entity/region.cjs.map +7 -0
- package/lib/handlers/entity/region.js +32 -0
- package/lib/handlers/entity/region.js.map +7 -0
- package/lib/handlers/entity/shape.cjs +95 -0
- package/lib/handlers/entity/shape.cjs.map +7 -0
- package/lib/handlers/entity/shape.js +60 -0
- package/lib/handlers/entity/shape.js.map +7 -0
- package/lib/handlers/entity/table.cjs +71 -0
- package/lib/handlers/entity/table.cjs.map +7 -0
- package/lib/handlers/entity/table.js +36 -0
- package/lib/handlers/entity/table.js.map +7 -0
- package/lib/handlers/entity/trace.cjs +101 -0
- package/lib/handlers/entity/trace.cjs.map +7 -0
- package/lib/handlers/entity/trace.js +66 -0
- package/lib/handlers/entity/trace.js.map +7 -0
- package/lib/handlers/entity/wipeout.cjs +122 -0
- package/lib/handlers/entity/wipeout.cjs.map +7 -0
- package/lib/handlers/entity/wipeout.js +87 -0
- package/lib/handlers/entity/wipeout.js.map +7 -0
- package/lib/handlers/entity/xline.cjs +81 -0
- package/lib/handlers/entity/xline.cjs.map +7 -0
- package/lib/handlers/entity/xline.js +46 -0
- package/lib/handlers/entity/xline.js.map +7 -0
- package/lib/handlers/objects.cjs +43 -1
- package/lib/handlers/objects.cjs.map +2 -2
- package/lib/handlers/objects.js +43 -1
- package/lib/handlers/objects.js.map +2 -2
- package/lib/handlers/tables.cjs +96 -17
- package/lib/handlers/tables.cjs.map +2 -2
- package/lib/handlers/tables.js +96 -17
- package/lib/handlers/tables.js.map +2 -2
- package/lib/index.cjs +5 -2
- package/lib/index.cjs.map +3 -3
- package/lib/index.js +18 -16
- package/lib/index.js.map +3 -3
- package/lib/toJson.cjs +29 -0
- package/lib/toJson.cjs.map +7 -0
- package/lib/toJson.js +9 -0
- package/lib/toJson.js.map +7 -0
- package/lib/toSVG.cjs +34 -3
- package/lib/toSVG.cjs.map +2 -2
- package/lib/toSVG.js +34 -3
- package/lib/toSVG.js.map +2 -2
- package/lib/types/entity.cjs.map +1 -1
- package/lib/types/helper.cjs.map +1 -1
- package/lib/types/index.cjs +20 -0
- package/lib/types/index.cjs.map +2 -2
- package/lib/types/index.js +10 -0
- package/lib/types/index.js.map +2 -2
- package/lib/types/mleader-entity.cjs +17 -0
- package/lib/types/mleader-entity.cjs.map +7 -0
- package/lib/types/mleader-entity.js +1 -0
- package/lib/types/mleader-entity.js.map +7 -0
- package/lib/types/mline-entity.cjs +17 -0
- package/lib/types/mline-entity.cjs.map +7 -0
- package/lib/types/mline-entity.js +1 -0
- package/lib/types/mline-entity.js.map +7 -0
- package/lib/types/oleframe-entity.cjs +17 -0
- package/lib/types/oleframe-entity.cjs.map +7 -0
- package/lib/types/oleframe-entity.js +1 -0
- package/lib/types/oleframe-entity.js.map +7 -0
- package/lib/types/options.cjs.map +1 -1
- package/lib/types/ray-entity.cjs +17 -0
- package/lib/types/ray-entity.cjs.map +7 -0
- package/lib/types/ray-entity.js +1 -0
- package/lib/types/ray-entity.js.map +7 -0
- package/lib/types/region-entity.cjs +17 -0
- package/lib/types/region-entity.cjs.map +7 -0
- package/lib/types/region-entity.js +1 -0
- package/lib/types/region-entity.js.map +7 -0
- package/lib/types/shape-entity.cjs +17 -0
- package/lib/types/shape-entity.cjs.map +7 -0
- package/lib/types/shape-entity.js +1 -0
- package/lib/types/shape-entity.js.map +7 -0
- package/lib/types/table-entity.cjs +17 -0
- package/lib/types/table-entity.cjs.map +7 -0
- package/lib/types/table-entity.js +1 -0
- package/lib/types/table-entity.js.map +7 -0
- package/lib/types/tables.cjs.map +1 -1
- package/lib/types/trace-entity.cjs +17 -0
- package/lib/types/trace-entity.cjs.map +7 -0
- package/lib/types/trace-entity.js +1 -0
- package/lib/types/trace-entity.js.map +7 -0
- package/lib/types/wipeout-entity.cjs +17 -0
- package/lib/types/wipeout-entity.cjs.map +7 -0
- package/lib/types/wipeout-entity.js +1 -0
- package/lib/types/wipeout-entity.js.map +7 -0
- package/lib/types/xline-entity.cjs +17 -0
- package/lib/types/xline-entity.cjs.map +7 -0
- package/lib/types/xline-entity.js +1 -0
- package/lib/types/xline-entity.js.map +7 -0
- package/package.json +5 -19
- package/src/Helper.ts +6 -1
- package/src/entityToPolyline.ts +124 -2
- package/src/handlers/entities.ts +21 -1
- package/src/handlers/entity/mleader.ts +46 -0
- package/src/handlers/entity/mline.ts +74 -0
- package/src/handlers/entity/oleframe.ts +62 -0
- package/src/handlers/entity/ray.ts +52 -0
- package/src/handlers/entity/region.ts +42 -0
- package/src/handlers/entity/shape.ts +73 -0
- package/src/handlers/entity/table.ts +49 -0
- package/src/handlers/entity/trace.ts +72 -0
- package/src/handlers/entity/wipeout.ts +114 -0
- package/src/handlers/entity/xline.ts +52 -0
- package/src/handlers/objects.ts +64 -8
- package/src/handlers/tables.ts +134 -21
- package/src/index.ts +9 -18
- package/src/toJson.ts +8 -0
- package/src/toSVG.ts +45 -3
- package/src/types/entity.ts +20 -0
- package/src/types/helper.ts +2 -1
- package/src/types/index.ts +10 -0
- package/src/types/mleader-entity.ts +8 -0
- package/src/types/mline-entity.ts +12 -0
- package/src/types/oleframe-entity.ts +40 -0
- package/src/types/options.ts +7 -0
- package/src/types/ray-entity.ts +12 -0
- package/src/types/region-entity.ts +11 -0
- package/src/types/shape-entity.ts +19 -0
- package/src/types/table-entity.ts +14 -0
- package/src/types/tables.ts +76 -0
- package/src/types/trace-entity.ts +14 -0
- package/src/types/wipeout-entity.ts +20 -0
- package/src/types/xline-entity.ts +12 -0
- package/docs/DIMENSION_SUMMARY.md +0 -254
- package/docs/DXF_VERSION_SUPPORT.md +0 -45
- package/docs/ENTITY_SVG_ROADMAP.md +0 -96
- package/docs/IMPLEMENTED-2D-ENTITIES.md +0 -54
- package/docs/README.md +0 -22
- package/docs/SVG_RENDERING_INTEGRATION_TESTS.md +0 -119
- package/docs/TEXT-MTEXT-DIMENSION-SUPPORT.md +0 -241
package/{PLAN.md → ROADMAP.md}
RENAMED
|
@@ -17,6 +17,17 @@ This document describes a phased plan to align this project’s DXF parsing beha
|
|
|
17
17
|
- Full ObjectARX/.NET API parity (this is a DXF parser, not a CAD kernel).
|
|
18
18
|
- Perfect fidelity for every proprietary/extension object (fallback behavior is acceptable).
|
|
19
19
|
|
|
20
|
+
## Progress
|
|
21
|
+
|
|
22
|
+
Last updated: 2026-01-01
|
|
23
|
+
|
|
24
|
+
- M0 — Baseline & Regression Harness: done (existing unit + integration coverage is in place).
|
|
25
|
+
- M1 — DXF Format & Section-Level Compliance: ongoing (incremental hardening as fixtures demand).
|
|
26
|
+
- M2 — TABLES Coverage (2D-Relevant): in progress (added minimal parsing for APPID, BLOCK_RECORD, UCS, VIEW).
|
|
27
|
+
- M3 — OBJECTS Coverage (2D-Relevant): in progress (DICTIONARY/XRECORD/IMAGEDEF/UNDERLAY definitions exist; added minimal DIMASSOC parsing).
|
|
28
|
+
- M4 — ENTITIES: Complete 2D Set: ongoing (added TRACE parse + toPolylines support).
|
|
29
|
+
- M5 — Rendering Parity (toPolylines / toSVG): ongoing (TRACE now renders in SVG as a filled path; LEADER now converts to polylines; RAY/XLINE now render via finite polyline fallback; SHAPE renders as text fallback).
|
|
30
|
+
|
|
20
31
|
## References
|
|
21
32
|
|
|
22
33
|
### Primary (ezdxf stable docs)
|
|
@@ -36,7 +47,186 @@ When behavior is ambiguous or disputed, treat Autodesk’s DXF reference as auth
|
|
|
36
47
|
|
|
37
48
|
Project documentation index:
|
|
38
49
|
|
|
39
|
-
|
|
50
|
+
This plan also serves as the documentation index.
|
|
51
|
+
|
|
52
|
+
Standalone reference docs that remain under `docs/`:
|
|
53
|
+
|
|
54
|
+
- `docs/autocad_2012_pdf_dxf-reference_enu.md` (local reference copy)
|
|
55
|
+
- `docs/EZDXF_REFERENCE_SITEMAP.md` (ezdxf reference navigation)
|
|
56
|
+
- `docs/FIXTURE_VALIDATION_EZDXF.md` (ezdxf-based fixture validation)
|
|
57
|
+
|
|
58
|
+
## Documentation (Consolidated)
|
|
59
|
+
|
|
60
|
+
This section consolidates documentation previously living under `docs/` so the project roadmap and implementation guidance are in one place.
|
|
61
|
+
|
|
62
|
+
### Where to Start
|
|
63
|
+
|
|
64
|
+
- Entity support overview: “Implemented Entities (2D)” below
|
|
65
|
+
- DXF version support notes: “DXF Version Support” below
|
|
66
|
+
- Text + annotation notes: “TEXT / MTEXT / DIMENSION (SVG)” below
|
|
67
|
+
- SVG integration testing: “SVG Rendering Integration Tests” below
|
|
68
|
+
- Entity-by-entity workflow: “Entity SVG Roadmap” below
|
|
69
|
+
|
|
70
|
+
### DXF Version Support
|
|
71
|
+
|
|
72
|
+
The parser is designed around DXF group codes and sections, and does not currently gate behavior on `$ACADVER`.
|
|
73
|
+
|
|
74
|
+
In practice, this means:
|
|
75
|
+
|
|
76
|
+
- We aim to parse and render supported entities across many DXF versions.
|
|
77
|
+
- We treat `$ACADVER` primarily as a fixture metadata signal and future compatibility hook.
|
|
78
|
+
|
|
79
|
+
Supporting “the latest AutoCAD DXF” is best defined as:
|
|
80
|
+
|
|
81
|
+
- The library can load DXF files produced by recent AutoCAD versions without rejecting due to version, and
|
|
82
|
+
- The library has fixtures that include a recent `$ACADVER` value, validated by ezdxf.
|
|
83
|
+
|
|
84
|
+
Recommended strategy:
|
|
85
|
+
|
|
86
|
+
- Track `$ACADVER` in fixture validation (see `docs/FIXTURE_VALIDATION_EZDXF.md`).
|
|
87
|
+
- Add at least one fixture exported from a recent AutoCAD version (keep it small and single-purpose; prefer a fixture that includes DIMENSION + text).
|
|
88
|
+
- Add an integration test for that fixture (goal: “does not throw + expected key SVG features exist”).
|
|
89
|
+
- Document which `$ACADVER` values are present in fixtures.
|
|
90
|
+
|
|
91
|
+
Non-goals:
|
|
92
|
+
|
|
93
|
+
- Guarantee support for every new entity introduced by new DXF versions.
|
|
94
|
+
- Guarantee binary DXF support (unless explicitly added).
|
|
95
|
+
|
|
96
|
+
If version-specific behavior is needed later:
|
|
97
|
+
|
|
98
|
+
- Add a header helper that exposes `$ACADVER` in a typed way.
|
|
99
|
+
- Add tests covering version-specific parsing/rendering differences.
|
|
100
|
+
|
|
101
|
+
### Implemented Entities (2D)
|
|
102
|
+
|
|
103
|
+
This list was generated based on the AutoCAD 2012 DXF reference documentation. It catalogs 2D entities, indicating whether they have already been implemented in this project.
|
|
104
|
+
|
|
105
|
+
| Entity | Implemented | Description |
|
|
106
|
+
| :--- | :---: | :--- |
|
|
107
|
+
| **ARC** | ✅ | A circular arc. |
|
|
108
|
+
| **CIRCLE** | ✅ | A circle. |
|
|
109
|
+
| **ELLIPSE** | ✅ | An ellipse or elliptical arc. |
|
|
110
|
+
| **HATCH** | ✅ | Fills a bounded area with a pattern, solid color, or gradient. |
|
|
111
|
+
| **LINE** | ✅ | A straight line segment. |
|
|
112
|
+
| **LWPOLYLINE** | ✅ | A lightweight 2D polyline. |
|
|
113
|
+
| **MTEXT** | ✅ | Multi-line text with advanced formatting (partial formatting support in SVG). |
|
|
114
|
+
| **POINT** | ✅ | A point entity. |
|
|
115
|
+
| **POLYLINE** | ✅ | A 2D or 3D polyline (with vertices). |
|
|
116
|
+
| **SOLID** | ✅ | A 2D area filled with solid color. |
|
|
117
|
+
| **SPLINE** | ✅ | A spline curve. |
|
|
118
|
+
| **TEXT** | ✅ | A single line of text. |
|
|
119
|
+
| **DIMENSION** | ✅ | Dimension entity (linear, angular, radial, etc.). DIMSTYLE integration and SVG rendering are implemented (see “DIMENSION Implementation Summary”). |
|
|
120
|
+
| **INSERT** | ✅ | A block insertion (block reference). |
|
|
121
|
+
| **ATTDEF** | ✅ | Attribute definition for a block. |
|
|
122
|
+
| **ATTRIB** | ✅ | An attribute instance attached to a block. |
|
|
123
|
+
| **OLE2FRAME** | ✅ | An OLE (Object Linking and Embedding) object. |
|
|
124
|
+
| **LEADER** | ✅ | A leader line, used for annotations. |
|
|
125
|
+
| **MLINE** | ❌ | A multi-line entity with parallel lines. |
|
|
126
|
+
| **RAY** | ✅ | A semi-infinite line that extends infinitely in one direction from its start point. |
|
|
127
|
+
| **SHAPE** | ✅ | A shape from a shape file (.shx). |
|
|
128
|
+
| **TOLERANCE** | ✅ | A geometric tolerance (feature control frame). |
|
|
129
|
+
| **TRACE** | ✅ | A solid 2D line with width. |
|
|
130
|
+
| **WIPEOUT** | ✅ | A background masking area (currently rendered as an outline-only fallback; no masking yet). |
|
|
131
|
+
| **XLINE** | ✅ | An infinite construction line. |
|
|
132
|
+
|
|
133
|
+
### TEXT / MTEXT / DIMENSION (SVG)
|
|
134
|
+
|
|
135
|
+
This project supports SVG rendering for TEXT, MTEXT, and DIMENSION entities.
|
|
136
|
+
|
|
137
|
+
Notes:
|
|
138
|
+
|
|
139
|
+
- Text font selection is not currently respected in SVG (defaults to browser font).
|
|
140
|
+
- Complex MTEXT formatting is not fully supported (kept intentionally incremental).
|
|
141
|
+
- Text bounding boxes are approximate.
|
|
142
|
+
|
|
143
|
+
Supported group code highlights:
|
|
144
|
+
|
|
145
|
+
- TEXT: text (1), insertion point (10/20/30), alignment point (11/21/31), height (40), scale X (41), rotation (50), oblique (51), align (72/73)
|
|
146
|
+
- MTEXT: text (1/3), insertion point (10/20/30), X-axis direction (11/21/31), nominal height (40), reference width (41), attachment (71), drawing direction (72)
|
|
147
|
+
- DIMENSION: block name (2), definition point (10/20/30), text midpoint (11/21/31), measurement points (13/23/33, 14/24/34), rotation (50), type (70)
|
|
148
|
+
|
|
149
|
+
Example:
|
|
150
|
+
|
|
151
|
+
```typescript
|
|
152
|
+
import { Helper } from '@linkiez/dxf-renew'
|
|
153
|
+
|
|
154
|
+
const helper = new Helper(dxfString)
|
|
155
|
+
const svg = helper.toSVG()
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
### SVG Rendering Integration Tests
|
|
159
|
+
|
|
160
|
+
Goal: validate final SVG output for real DXF fixtures:
|
|
161
|
+
|
|
162
|
+
`DXF fixture → parseString() → (optional denormalise) → toSVG() → SVG assertions`
|
|
163
|
+
|
|
164
|
+
Framework:
|
|
165
|
+
|
|
166
|
+
- Final rendering integration tests run in a real browser using Playwright.
|
|
167
|
+
|
|
168
|
+
Where tests live:
|
|
169
|
+
|
|
170
|
+
- Integration tests: `test/integration/**`
|
|
171
|
+
- Browser integration tests: `test/integration-browser/**`
|
|
172
|
+
- DXF fixtures: `test/resources/*.dxf`
|
|
173
|
+
|
|
174
|
+
Recommended assertions:
|
|
175
|
+
|
|
176
|
+
1. SVG well-formed envelope (`<svg>`, `</svg>`, `viewBox`)
|
|
177
|
+
2. Entity-specific elements (`<line>`, `<path>`, `<circle>`, `<text>`, `<image>`)
|
|
178
|
+
3. Critical attributes (e.g. `marker-start` / `marker-end` for DIMENSION)
|
|
179
|
+
4. Text content (when applicable)
|
|
180
|
+
5. “Does not throw” for a curated set of fixtures
|
|
181
|
+
|
|
182
|
+
Saved render artifacts (PNG):
|
|
183
|
+
|
|
184
|
+
- Browser integration tests should save a screenshot under `test/rendered/` for manual review.
|
|
185
|
+
- Prefer deterministic filenames tied to fixtures, e.g. `test/rendered/dimension-vertical.png`.
|
|
186
|
+
|
|
187
|
+
Handling non-deterministic IDs:
|
|
188
|
+
|
|
189
|
+
- Some SVG IDs are timestamp-based (e.g. DIMENSION arrow markers). Validate prefix-based patterns instead of exact IDs.
|
|
190
|
+
|
|
191
|
+
### Entity SVG Roadmap (Fixture → ezdxf → SVG Integration)
|
|
192
|
+
|
|
193
|
+
This roadmap is a repeatable checklist for each DXF entity:
|
|
194
|
+
|
|
195
|
+
- Confirm/produce a fixture in `test/resources/`.
|
|
196
|
+
- Validate it with ezdxf (see `docs/FIXTURE_VALIDATION_EZDXF.md`).
|
|
197
|
+
- Add/extend unit parsing tests.
|
|
198
|
+
- Add final SVG integration tests.
|
|
199
|
+
|
|
200
|
+
Template:
|
|
201
|
+
|
|
202
|
+
- Fixture: add or pick a DXF fixture in `test/resources/<entity>-<scenario>.dxf` (keep fixtures minimal).
|
|
203
|
+
- ezdxf validation: run `yarn validate:fixtures`, confirm the file loads, `$ACADVER` is present, and entity counts include your target entity.
|
|
204
|
+
- Unit tests: add unit parsing tests under `test/unit/`, assert minimum required fields for the entity type.
|
|
205
|
+
- SVG integration tests: add `test/integration-browser/<entity>-rendering.browser.spec.js`, assert SVG envelope + required elements/attributes + expected text content when applicable.
|
|
206
|
+
|
|
207
|
+
Saved PNG per entity (required):
|
|
208
|
+
|
|
209
|
+
- Every browser integration test should save a screenshot to `test/rendered/<fixture-name>.png`.
|
|
210
|
+
|
|
211
|
+
### DIMENSION Implementation Summary
|
|
212
|
+
|
|
213
|
+
The DIMENSION entity is implemented with support for the DIMSTYLE system, including parsing, storage, and SVG rendering.
|
|
214
|
+
|
|
215
|
+
Highlights:
|
|
216
|
+
|
|
217
|
+
- DIMSTYLE parsing in `src/handlers/tables.ts` (dozens of properties including arrow blocks, tolerances, alternate units).
|
|
218
|
+
- Rendering module `src/dimensionToSVG.ts` dispatches by dimension type and generates SVG markers for arrows.
|
|
219
|
+
- Color + lineweight support via DIMSTYLE values (dimension, extension, and text colors; line weights).
|
|
220
|
+
|
|
221
|
+
Dimension types supported in SVG rendering:
|
|
222
|
+
|
|
223
|
+
- Type 0/1 (linear): extension lines, dimension line, arrows, rotated text
|
|
224
|
+
- Type 2 (angular): arc dimension line, arrows, rotated text
|
|
225
|
+
- Type 3 (diameter): ⌀ symbol
|
|
226
|
+
- Type 4 (radius): R prefix
|
|
227
|
+
- Type 6 (ordinate): leader line and coordinate text
|
|
228
|
+
|
|
229
|
+
Optional features (not implemented): custom arrow blocks rendering, full tolerances/alternate units formatting, per-entity XDATA overrides.
|
|
40
230
|
|
|
41
231
|
## “Sitemap” / Checklist Source
|
|
42
232
|
|
|
@@ -52,8 +242,8 @@ This section is intentionally short; it highlights gaps relevant to the migratio
|
|
|
52
242
|
|
|
53
243
|
Entity parsers currently exist for (see `src/handlers/entities.ts` and `src/handlers/entity/*`):
|
|
54
244
|
|
|
55
|
-
- Implemented: ARC, ATTDEF, ATTRIB, CIRCLE, DIMENSION, ELLIPSE, HATCH, INSERT, LINE, LWPOLYLINE, MTEXT, OLE2FRAME, POINT, POLYLINE, SOLID, SPLINE, TEXT, 3DFACE, VERTEX, VIEWPORT.
|
|
56
|
-
- Missing (not exhaustive):
|
|
245
|
+
- Implemented: ARC, ATTDEF, ATTRIB, CIRCLE, DIMENSION, ELLIPSE, HATCH, INSERT, LEADER, LINE, LWPOLYLINE, MTEXT, OLE2FRAME, POINT, POLYLINE, RAY, SHAPE, SOLID, SPLINE, TEXT, TOLERANCE, TRACE, WIPEOUT, XLINE, 3DFACE, VERTEX, VIEWPORT.
|
|
246
|
+
- Missing (not exhaustive): SEQEND handling robustness.
|
|
57
247
|
|
|
58
248
|
### Tables
|
|
59
249
|
|
|
@@ -66,8 +256,8 @@ Entity parsers currently exist for (see `src/handlers/entities.ts` and `src/hand
|
|
|
66
256
|
|
|
67
257
|
`src/handlers/objects.ts` currently parses:
|
|
68
258
|
|
|
69
|
-
- Implemented: LAYOUT (partial), DICTIONARY, XRECORD.
|
|
70
|
-
- Missing from Autodesk TOC subset above:
|
|
259
|
+
- Implemented: LAYOUT (partial), DICTIONARY, XRECORD, DIMASSOC, FIELD, IMAGEDEF (+ reactor), UNDERLAY definitions.
|
|
260
|
+
- Missing from Autodesk TOC subset above: TABLESTYLE, GROUP, etc.
|
|
71
261
|
|
|
72
262
|
## Project Analysis (Code-Backed)
|
|
73
263
|
|
|
@@ -279,7 +469,7 @@ There is already substantial fixture coverage in `test/resources/*.dxf` and unit
|
|
|
279
469
|
|
|
280
470
|
1. Implement missing entity handlers (prioritized)
|
|
281
471
|
|
|
282
|
-
Annotation:
|
|
472
|
+
Annotation: MLEADER. Geometry: REGION. Reference: IMAGE, UNDERLAY. Legacy: OLEFRAME. Table-in-entities: TABLE (entity). Optional/edge: MLINE.
|
|
283
473
|
|
|
284
474
|
1. Ensure common fields are handled consistently
|
|
285
475
|
|
|
@@ -340,27 +530,29 @@ Legend:
|
|
|
340
530
|
|
|
341
531
|
### A.1 Entities (2D-critical)
|
|
342
532
|
|
|
343
|
-
Already parsed (handlers exist): LINE, LWPOLYLINE, POLYLINE, ARC, CIRCLE, ELLIPSE, SPLINE, TEXT, MTEXT, DIMENSION, INSERT, ATTDEF, ATTRIB, HATCH, SOLID, POINT, VIEWPORT, OLE2FRAME.
|
|
533
|
+
Already parsed (handlers exist): LINE, LWPOLYLINE, POLYLINE, ARC, CIRCLE, ELLIPSE, SPLINE, TEXT, MTEXT, DIMENSION, INSERT, ATTDEF, ATTRIB, HATCH, SOLID, TRACE, POINT, VIEWPORT, OLE2FRAME, LEADER, RAY, XLINE, SHAPE, TOLERANCE, WIPEOUT.
|
|
534
|
+
|
|
535
|
+
Also parsed (parse-only / safe ignore): MLEADER, MLINE, OLEFRAME, REGION, TABLE (entity).
|
|
344
536
|
|
|
345
537
|
The items below are the main gaps to reach “complete 2D” as defined in this plan.
|
|
346
538
|
|
|
347
539
|
| Entity | Parse | Render (SVG) | Render (Polylines) | Block-safe | Minimal implementation checklist |
|
|
348
540
|
| --- | --- | --- | --- | --- | --- |
|
|
349
541
|
| SEQEND | Sentinel only | N/A | N/A | N/A | Add `src/handlers/entity/seqend.ts` (optional) or harden sequencing in `src/handlers/entities.ts` + add fixture that stresses POLYLINE/VERTEX/SEQEND ordering |
|
|
350
|
-
| LEADER | Yes | Yes |
|
|
351
|
-
| MLEADER |
|
|
352
|
-
| TOLERANCE | Yes | Yes | No | No |
|
|
542
|
+
| LEADER | Yes | Yes | Yes | No | Implemented (minimal polyline support + SVG routing) |
|
|
543
|
+
| MLEADER | Yes | No | No | No | Implemented parse-only + safe ignore in rendering |
|
|
544
|
+
| TOLERANCE | Yes | Yes | No | No | Implemented (SVG text fallback only) |
|
|
353
545
|
| IMAGE | Yes | No | No | No | Add `src/types/image-entity.ts`; add `src/handlers/entity/image.ts`; add OBJECTS: IMAGEDEF/IMAGEDEF_REACTOR; render as placeholder rect or ignore safely |
|
|
354
546
|
| UNDERLAY | Yes | No | No | No | Add `src/types/underlay-entity.ts`; add `src/handlers/entity/dwfUnderlay.ts` + `src/handlers/entity/dgnUnderlay.ts`; add OBJECTS: UNDERLAYDEFINITION; render placeholder/ignore |
|
|
355
|
-
| WIPEOUT |
|
|
356
|
-
| RAY |
|
|
357
|
-
| XLINE |
|
|
358
|
-
| OLEFRAME |
|
|
359
|
-
| TRACE |
|
|
360
|
-
| REGION |
|
|
361
|
-
| TABLE (entity) |
|
|
362
|
-
| SHAPE |
|
|
363
|
-
| MLINE |
|
|
547
|
+
| WIPEOUT | Yes | Yes | Yes | No | Implemented (outline-only; masking not yet implemented) |
|
|
548
|
+
| RAY | Yes | Yes | Yes | No | Implemented (finite fallback in polyline/SVG) |
|
|
549
|
+
| XLINE | Yes | Yes | Yes | No | Implemented (finite fallback in polyline/SVG) |
|
|
550
|
+
| OLEFRAME | Yes | No | No | No | Implemented parse-only + safe ignore in rendering |
|
|
551
|
+
| TRACE | Yes | Yes | Yes | No | Implemented (filled SVG + closed polyline) |
|
|
552
|
+
| REGION | Yes | No | No | No | Implemented parse-only + safe ignore in rendering |
|
|
553
|
+
| TABLE (entity) | Yes | No | No | No | Implemented parse-only + safe ignore in rendering |
|
|
554
|
+
| SHAPE | Yes | Yes | Yes | No | Implemented (minimal polyline + SVG text fallback) |
|
|
555
|
+
| MLINE | Yes | No | No | No | Implemented parse-only + safe ignore in rendering |
|
|
364
556
|
|
|
365
557
|
### A.2 Tables (2D-relevant)
|
|
366
558
|
|
|
@@ -377,10 +569,10 @@ The items below are the main gaps to reach “complete 2D” as defined in this
|
|
|
377
569
|
| --- | --- | --- | --- |
|
|
378
570
|
| DICTIONARY | Implemented | `src/handlers/objects.ts` (+ new types file if desired) | Group objects by `0`; add DICTIONARY parser; store by handle for lookup |
|
|
379
571
|
| XRECORD | Implemented | `src/handlers/objects.ts` | Add XRECORD parser; preserve raw records for downstream consumers |
|
|
380
|
-
| DIMASSOC |
|
|
572
|
+
| DIMASSOC | Implemented | `src/handlers/objects.ts` | Implemented minimal parse; preserves raw tuples for downstream consumers |
|
|
381
573
|
| IMAGEDEF / IMAGEDEF_REACTOR | Implemented | `src/handlers/objects.ts` | Parse enough to resolve IMAGE entity references; do not crash if external files missing |
|
|
382
574
|
| UNDERLAYDEFINITION | Implemented | `src/handlers/objects.ts` | Parse enough to resolve DWFUNDERLAY/DGNUNDERLAY references; do not crash if external files missing |
|
|
383
|
-
| FIELD |
|
|
575
|
+
| FIELD | Implemented | `src/handlers/objects.ts` | Implemented minimal parse; preserves raw tuples for downstream consumers |
|
|
384
576
|
| TABLESTYLE | Missing | `src/handlers/objects.ts` | Parse style basics; used later for TABLE entity rendering |
|
|
385
577
|
| GROUP | Missing | `src/handlers/objects.ts` | Parse group membership; safe ignore if not used |
|
|
386
578
|
|
|
@@ -400,7 +592,7 @@ This appendix provides an explicit sequence of PRs. The intent is to keep each P
|
|
|
400
592
|
- **Stabilize existing behavior**: ✅ PR B1.1 (POLYLINE/VERTEX/SEQEND sequencing), ✅ PR B1.2 (block basepoint for TEXT/MTEXT/DIMENSION).
|
|
401
593
|
- **Unblock references and metadata**: ✅ PR B1.3 (OBJECTS dispatch + DICTIONARY), ✅ PR B1.4 (XRECORD).
|
|
402
594
|
- **Enable images/underlays**: ✅ PR B1.5 (IMAGEDEF / IMAGEDEF_REACTOR), ✅ PR B1.6 (IMAGE entity), ✅ PR B1.7 (UNDERLAY defs + UNDERLAY entity).
|
|
403
|
-
- **Add remaining common 2D annotation**: ✅ PR B1.8 (LEADER), ✅ PR B1.9 (TOLERANCE), PR B1.10 (DIMASSOC), PR B1.11 (MLEADER).
|
|
595
|
+
- **Add remaining common 2D annotation**: ✅ PR B1.8 (LEADER), ✅ PR B1.9 (TOLERANCE), ✅ PR B1.10 (DIMASSOC), ✅ PR B1.11 (MLEADER).
|
|
404
596
|
|
|
405
597
|
### B.2 PR templates by feature type
|
|
406
598
|
|
|
@@ -434,20 +626,20 @@ This table expands Appendix A into explicit PR steps.
|
|
|
434
626
|
|
|
435
627
|
| Entity | PR 1 (Parse) | PR 2 (SVG) | PR 3 (Polylines) | PR 4 (Block-safe) |
|
|
436
628
|
| --- | --- | --- | --- | --- |
|
|
437
|
-
| LEADER |
|
|
438
|
-
| MLEADER |
|
|
439
|
-
| TOLERANCE |
|
|
629
|
+
| LEADER | Done | Done | Done | Optional |
|
|
630
|
+
| MLEADER | Done (parse-only) | Safe ignore or placeholder first | N/A | Later, after DICTIONARY/XRECORD/DIMASSOC coverage |
|
|
631
|
+
| TOLERANCE | Done | Done (text fallback) | N/A | Optional |
|
|
440
632
|
| IMAGE | Add IMAGEDEF(+reactor) objects, then IMAGE entity parse + tests | Placeholder rect/image element or safe ignore | N/A | Update `denormalise` for block-contained images |
|
|
441
633
|
| UNDERLAY | Add underlay defs objects, then UNDERLAY entity parse + tests | Placeholder | N/A | Optional |
|
|
442
|
-
| WIPEOUT |
|
|
443
|
-
| RAY |
|
|
444
|
-
| XLINE |
|
|
445
|
-
| OLEFRAME |
|
|
446
|
-
| TRACE |
|
|
447
|
-
| REGION |
|
|
448
|
-
| TABLE (entity) |
|
|
449
|
-
| SHAPE |
|
|
450
|
-
| MLINE |
|
|
634
|
+
| WIPEOUT | Done | Done (outline-only fallback) | Done | Optional |
|
|
635
|
+
| RAY | Done | Done | Done | Optional |
|
|
636
|
+
| XLINE | Done | Done | Done | Optional |
|
|
637
|
+
| OLEFRAME | Done | Placeholder or safe ignore | N/A | Optional |
|
|
638
|
+
| TRACE | Done | Done | Done | Optional |
|
|
639
|
+
| REGION | Done (parse-only) | Safe ignore first | Safe ignore | N/A |
|
|
640
|
+
| TABLE (entity) | Done (parse-only) | Safe ignore/placeholder | N/A | Optional |
|
|
641
|
+
| SHAPE | Done | Done (text fallback) | Done | N/A |
|
|
642
|
+
| MLINE | Done (parse-only) | Safe ignore first | N/A | N/A |
|
|
451
643
|
|
|
452
644
|
### B.4 Concrete PR checklist for missing tables
|
|
453
645
|
|
|
@@ -462,6 +654,6 @@ This table expands Appendix A into explicit PR steps.
|
|
|
462
654
|
- PR: Add XRECORD support + tests.
|
|
463
655
|
- PR: Add DIMASSOC support + tests.
|
|
464
656
|
- PR: Add IMAGEDEF / IMAGEDEF_REACTOR support + tests.
|
|
465
|
-
- PR: Add FIELD support + tests.
|
|
657
|
+
- ✅ PR: Add FIELD support + tests.
|
|
466
658
|
- PR: Add TABLESTYLE support + tests.
|
|
467
659
|
- PR: Add GROUP support + tests.
|