@linkiez/dxf-renew 5.3.1 → 7.1.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/{docs/CODE_PATTERNS.md → .github/instructions/code-patterns.instructions.md} +4 -1
- package/.github/instructions/exdxf.instruction.md +161 -0
- package/.github/instructions/tdd.instructions.md +271 -0
- package/.github/workflows/release.yml +4 -5
- package/.releaserc.json +1 -1
- package/.yarn/install-state.gz +0 -0
- package/CHANGELOG.md +59 -0
- package/CONTRIBUTING.md +16 -14
- package/PLAN.md +34 -84
- package/README.md +43 -8
- package/dist/dxf.js +1388 -376
- package/docs/DIMENSION_SUMMARY.md +11 -5
- package/docs/DXF_VERSION_SUPPORT.md +45 -0
- package/docs/ENTITY_SVG_ROADMAP.md +96 -0
- package/docs/EZDXF_REFERENCE_SITEMAP.md +55 -0
- package/docs/FIXTURE_VALIDATION_EZDXF.md +62 -0
- package/docs/README.md +22 -0
- package/docs/SVG_RENDERING_INTEGRATION_TESTS.md +119 -0
- package/docs/TEXT-MTEXT-DIMENSION-SUPPORT.md +1 -1
- package/lib/Helper.cjs +2 -2
- package/lib/Helper.cjs.map +2 -2
- package/lib/Helper.js +2 -2
- package/lib/Helper.js.map +2 -2
- package/lib/denormalise.cjs +131 -91
- package/lib/denormalise.cjs.map +2 -2
- package/lib/denormalise.js +131 -91
- package/lib/denormalise.js.map +2 -2
- package/lib/dimensionToSVG.cjs +318 -53
- package/lib/dimensionToSVG.cjs.map +3 -3
- package/lib/dimensionToSVG.js +316 -52
- package/lib/dimensionToSVG.js.map +2 -2
- package/lib/handlers/entities.cjs +90 -26
- package/lib/handlers/entities.cjs.map +3 -3
- package/lib/handlers/entities.js +90 -26
- package/lib/handlers/entities.js.map +3 -3
- package/lib/handlers/entity/dgnUnderlay.cjs +106 -0
- package/lib/handlers/entity/dgnUnderlay.cjs.map +7 -0
- package/lib/handlers/entity/dgnUnderlay.js +71 -0
- package/lib/handlers/entity/dgnUnderlay.js.map +7 -0
- package/lib/handlers/entity/dimension.cjs +24 -0
- package/lib/handlers/entity/dimension.cjs.map +2 -2
- package/lib/handlers/entity/dimension.js +24 -0
- package/lib/handlers/entity/dimension.js.map +2 -2
- package/lib/handlers/entity/dwfUnderlay.cjs +106 -0
- package/lib/handlers/entity/dwfUnderlay.cjs.map +7 -0
- package/lib/handlers/entity/dwfUnderlay.js +71 -0
- package/lib/handlers/entity/dwfUnderlay.js.map +7 -0
- package/lib/handlers/entity/image.cjs +123 -0
- package/lib/handlers/entity/image.cjs.map +7 -0
- package/lib/handlers/entity/image.js +88 -0
- package/lib/handlers/entity/image.js.map +7 -0
- package/lib/handlers/entity/leader.cjs +148 -0
- package/lib/handlers/entity/leader.cjs.map +7 -0
- package/lib/handlers/entity/leader.js +113 -0
- package/lib/handlers/entity/leader.js.map +7 -0
- package/lib/handlers/entity/pdfUnderlay.cjs +106 -0
- package/lib/handlers/entity/pdfUnderlay.cjs.map +7 -0
- package/lib/handlers/entity/pdfUnderlay.js +71 -0
- package/lib/handlers/entity/pdfUnderlay.js.map +7 -0
- package/lib/handlers/entity/tolerance.cjs +90 -0
- package/lib/handlers/entity/tolerance.cjs.map +7 -0
- package/lib/handlers/entity/tolerance.js +55 -0
- package/lib/handlers/entity/tolerance.js.map +7 -0
- package/lib/handlers/objects.cjs +257 -136
- package/lib/handlers/objects.cjs.map +2 -2
- package/lib/handlers/objects.js +257 -136
- package/lib/handlers/objects.js.map +2 -2
- package/lib/toSVG.cjs +71 -8
- package/lib/toSVG.cjs.map +3 -3
- package/lib/toSVG.js +72 -9
- package/lib/toSVG.js.map +2 -2
- package/lib/types/dimension-entity.cjs.map +1 -1
- package/lib/types/entity.cjs.map +1 -1
- package/lib/types/image-entity.cjs +17 -0
- package/lib/types/image-entity.cjs.map +7 -0
- package/lib/types/image-entity.js +1 -0
- package/lib/types/image-entity.js.map +7 -0
- package/lib/types/index.cjs +8 -0
- package/lib/types/index.cjs.map +2 -2
- package/lib/types/index.js +4 -0
- package/lib/types/index.js.map +2 -2
- package/lib/types/leader-entity.cjs +17 -0
- package/lib/types/leader-entity.cjs.map +7 -0
- package/lib/types/leader-entity.js +1 -0
- package/lib/types/leader-entity.js.map +7 -0
- package/lib/types/options.cjs.map +1 -1
- package/lib/types/tables.cjs.map +1 -1
- package/lib/types/tolerance-entity.cjs +17 -0
- package/lib/types/tolerance-entity.cjs.map +7 -0
- package/lib/types/tolerance-entity.js +1 -0
- package/lib/types/tolerance-entity.js.map +7 -0
- package/lib/types/underlay-entity.cjs +17 -0
- package/lib/types/underlay-entity.cjs.map +7 -0
- package/lib/types/underlay-entity.js +1 -0
- package/lib/types/underlay-entity.js.map +7 -0
- package/lib/util/escapeXmlText.cjs +27 -0
- package/lib/util/escapeXmlText.cjs.map +7 -0
- package/lib/util/escapeXmlText.js +7 -0
- package/lib/util/escapeXmlText.js.map +7 -0
- package/package.json +13 -4
- package/playwright.config.cjs +20 -0
- package/src/Helper.ts +3 -3
- package/src/denormalise.ts +182 -116
- package/src/dimensionToSVG.ts +466 -54
- package/src/handlers/entities.ts +109 -34
- package/src/handlers/entity/dgnUnderlay.ts +94 -0
- package/src/handlers/entity/dimension.ts +27 -1
- package/src/handlers/entity/dwfUnderlay.ts +94 -0
- package/src/handlers/entity/image.ts +118 -0
- package/src/handlers/entity/leader.ts +153 -0
- package/src/handlers/entity/pdfUnderlay.ts +94 -0
- package/src/handlers/entity/tolerance.ts +75 -0
- package/src/handlers/objects.ts +323 -139
- package/src/toSVG.ts +98 -7
- package/src/types/dimension-entity.ts +11 -0
- package/src/types/entity.ts +10 -0
- package/src/types/image-entity.ts +35 -0
- package/src/types/index.ts +4 -0
- package/src/types/leader-entity.ts +40 -0
- package/src/types/options.ts +41 -0
- package/src/types/tables.ts +84 -0
- package/src/types/tolerance-entity.ts +20 -0
- package/src/types/underlay-entity.ts +35 -0
- package/src/util/escapeXmlText.ts +10 -0
- package/tools/browser_test_server.cjs +87 -0
- package/tools/ezdxf_generate_dimensions_all_types.py +246 -0
- package/tools/ezdxf_generate_dimensions_angular_3p.py +59 -0
- package/tools/ezdxf_generate_dimensions_large_scale.py +87 -0
- package/tools/ezdxf_regenerate_problem_fixtures.py +184 -0
- package/tools/ezdxf_validate_fixtures.py +165 -0
- package/docs/DIMENSION_SUMMARY.pt-BR.md +0 -248
- package/docs/IMPLEMENTED-2D-ENTITIES.pt-BR.md +0 -54
- package/docs/TEXT-MTEXT-DIMENSION-SUPPORT.pt-BR.md +0 -169
package/PLAN.md
CHANGED
|
@@ -9,6 +9,7 @@ This document describes a phased plan to align this project’s DXF parsing beha
|
|
|
9
9
|
- Provide complete 2D coverage for geometry + annotation features typically found in 2D drawings.
|
|
10
10
|
- Keep backwards compatibility with existing API outputs (`parseString`, `toSVG`, `toPolylines`) where feasible.
|
|
11
11
|
- Grow test coverage using real DXF fixtures and regression tests.
|
|
12
|
+
- Run final SVG rendering integration tests in a real browser and save PNG artifacts for manual review.
|
|
12
13
|
|
|
13
14
|
## Non-goals
|
|
14
15
|
|
|
@@ -16,88 +17,32 @@ This document describes a phased plan to align this project’s DXF parsing beha
|
|
|
16
17
|
- Full ObjectARX/.NET API parity (this is a DXF parser, not a CAD kernel).
|
|
17
18
|
- Perfect fidelity for every proprietary/extension object (fallback behavior is acceptable).
|
|
18
19
|
|
|
19
|
-
## References
|
|
20
|
+
## References
|
|
20
21
|
|
|
21
|
-
Primary
|
|
22
|
+
### Primary (ezdxf stable docs)
|
|
22
23
|
|
|
23
|
-
-
|
|
24
|
-
- DXF Format entry point (guid): <https://help.autodesk.com/view/OARX/2024/ENU/?guid=GUID-235B22E0-A567-4CF6-92D3-38A2306D73F3>
|
|
25
|
-
|
|
26
|
-
## “Sitemap” / Checklist Source (DXF Reference TOC)
|
|
27
|
-
|
|
28
|
-
This sitemap is derived from the Autodesk 2024 DXF Reference left navigation (expanded nodes).
|
|
29
|
-
|
|
30
|
-
### DXF Format
|
|
31
|
-
|
|
32
|
-
- About the DXF Format (DXF)
|
|
33
|
-
- About DXF Formatting Conventions
|
|
34
|
-
- About Object and Entity Codes (DXF)
|
|
35
|
-
- Group Code Value Types Reference (DXF)
|
|
36
|
-
- DXF Group Codes in Numerical Order Reference
|
|
37
|
-
|
|
38
|
-
### Header Section
|
|
24
|
+
Primary reference used for day-to-day implementation details (entities/objects/tables and their attributes):
|
|
39
25
|
|
|
40
|
-
-
|
|
41
|
-
-
|
|
26
|
+
- ezdxf Reference: <https://ezdxf.readthedocs.io/en/stable/reference.html>
|
|
27
|
+
- Curated sitemap for this repo: [docs/EZDXF_REFERENCE_SITEMAP.md](docs/EZDXF_REFERENCE_SITEMAP.md)
|
|
28
|
+
- Setup / extras install: <https://ezdxf.readthedocs.io/en/stable/setup.html#installation-with-extras>
|
|
42
29
|
|
|
43
|
-
###
|
|
30
|
+
### Authoritative (Autodesk / ObjectARX)
|
|
44
31
|
|
|
45
|
-
|
|
46
|
-
- CLASSES Section Group Codes (DXF)
|
|
47
|
-
- Default Class Values (DXF)
|
|
32
|
+
When behavior is ambiguous or disputed, treat Autodesk’s DXF reference as authoritative:
|
|
48
33
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
- About the DXF TABLES Section (DXF)
|
|
52
|
-
- About Symbol Table Group Codes (DXF)
|
|
53
|
-
- Common Symbol Table Group Codes (DXF)
|
|
54
|
-
- APPID (DXF)
|
|
55
|
-
- BLOCK_RECORD (DXF)
|
|
56
|
-
- DIMSTYLE (DXF)
|
|
57
|
-
- LAYER (DXF)
|
|
58
|
-
- LTYPE (DXF)
|
|
59
|
-
- STYLE (DXF)
|
|
60
|
-
- UCS (DXF)
|
|
61
|
-
- VIEW (DXF)
|
|
62
|
-
- VPORT (DXF)
|
|
63
|
-
|
|
64
|
-
### Blocks Section
|
|
65
|
-
|
|
66
|
-
- About the DXF BLOCKS Section
|
|
67
|
-
- About BLOCKS Section Group Codes (DXF)
|
|
68
|
-
- BLOCK (DXF)
|
|
69
|
-
- ENDBLK (DXF)
|
|
70
|
-
|
|
71
|
-
### Entities Section
|
|
34
|
+
- Root: <https://help.autodesk.com/view/OARX/2024/ENU/>
|
|
35
|
+
- DXF Format entry point (guid): <https://help.autodesk.com/view/OARX/2024/ENU/?guid=GUID-235B22E0-A567-4CF6-92D3-38A2306D73F3>
|
|
72
36
|
|
|
73
|
-
|
|
37
|
+
Project documentation index:
|
|
74
38
|
|
|
75
|
-
-
|
|
76
|
-
- LWPOLYLINE, POLYLINE (+ VERTEX + SEQEND)
|
|
77
|
-
- ELLIPSE, SPLINE
|
|
78
|
-
- HATCH, SOLID, TRACE, REGION
|
|
79
|
-
- POINT
|
|
80
|
-
- TEXT, MTEXT
|
|
81
|
-
- DIMENSION, LEADER, MLEADER, TOLERANCE
|
|
82
|
-
- INSERT, ATTDEF, ATTRIB
|
|
83
|
-
- VIEWPORT
|
|
84
|
-
- IMAGE, UNDERLAY, WIPEOUT
|
|
85
|
-
- RAY, XLINE
|
|
86
|
-
- OLEFRAME, OLE2FRAME
|
|
87
|
-
- TABLE (entity)
|
|
39
|
+
- `docs/README.md`
|
|
88
40
|
|
|
89
|
-
|
|
41
|
+
## “Sitemap” / Checklist Source
|
|
90
42
|
|
|
91
|
-
|
|
43
|
+
- Primary navigation for implementation work: [docs/EZDXF_REFERENCE_SITEMAP.md](docs/EZDXF_REFERENCE_SITEMAP.md)
|
|
92
44
|
|
|
93
|
-
|
|
94
|
-
- XRECORD
|
|
95
|
-
- LAYOUT
|
|
96
|
-
- DIMASSOC
|
|
97
|
-
- IMAGEDEF / IMAGEDEF_REACTOR
|
|
98
|
-
- GROUP
|
|
99
|
-
- TABLESTYLE
|
|
100
|
-
- FIELD
|
|
45
|
+
Note: do not embed large copies of Autodesk TOCs/spec text in this plan. Keep external links instead so this file stays maintainable.
|
|
101
46
|
|
|
102
47
|
## Current State (Repository Snapshot)
|
|
103
48
|
|
|
@@ -121,8 +66,8 @@ Entity parsers currently exist for (see `src/handlers/entities.ts` and `src/hand
|
|
|
121
66
|
|
|
122
67
|
`src/handlers/objects.ts` currently parses:
|
|
123
68
|
|
|
124
|
-
- Implemented: LAYOUT (partial).
|
|
125
|
-
- Missing from Autodesk TOC subset above:
|
|
69
|
+
- Implemented: LAYOUT (partial), DICTIONARY, XRECORD.
|
|
70
|
+
- Missing from Autodesk TOC subset above: DIMASSOC, IMAGEDEF (+ reactor), FIELD, TABLESTYLE, GROUP, etc.
|
|
126
71
|
|
|
127
72
|
## Project Analysis (Code-Backed)
|
|
128
73
|
|
|
@@ -228,6 +173,8 @@ There is already substantial fixture coverage in `test/resources/*.dxf` and unit
|
|
|
228
173
|
|
|
229
174
|
- Rendering tests exist for `toSVG`, `toPolylines`, dimension/text, blocks/inserts, and hatches.
|
|
230
175
|
- Use this existing corpus to gate each milestone; add only minimal new fixtures per newly-supported feature.
|
|
176
|
+
- When fixtures become too complex, brittle, or hard to assert against, it is acceptable to replace them with simpler, targeted fixtures (including ezdxf-generated ones) as long as the test still covers the intended behavior.
|
|
177
|
+
- After adding or regenerating fixtures, run `yarn validate:fixtures` to ensure DXF structure is sound.
|
|
231
178
|
|
|
232
179
|
## Milestones
|
|
233
180
|
|
|
@@ -242,6 +189,8 @@ There is already substantial fixture coverage in `test/resources/*.dxf` and unit
|
|
|
242
189
|
- PR 0.1: Add/confirm one “golden” unit test per public API (`parseString`, `toPolylines`, `toSVG`).
|
|
243
190
|
- PR 0.2: Add a test-only strict mode helper (e.g., fail on unknown entity/table/object types) without changing the runtime default behavior.
|
|
244
191
|
- PR 0.3: Add 1–3 new fixtures only if existing fixtures don’t cover a targeted feature.
|
|
192
|
+
- If a fixture is too complex for stable assertions, prefer a smaller, focused fixture generated via ezdxf.
|
|
193
|
+
- It is OK to replace or simplify existing fixtures if they remain representative of the behavior under test.
|
|
245
194
|
|
|
246
195
|
- Add/confirm a single “golden” pipeline test per API surface:
|
|
247
196
|
- `parseString()` parses representative DXFs without throwing.
|
|
@@ -398,11 +347,11 @@ The items below are the main gaps to reach “complete 2D” as defined in this
|
|
|
398
347
|
| Entity | Parse | Render (SVG) | Render (Polylines) | Block-safe | Minimal implementation checklist |
|
|
399
348
|
| --- | --- | --- | --- | --- | --- |
|
|
400
349
|
| 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 |
|
|
401
|
-
| LEADER |
|
|
350
|
+
| LEADER | Yes | Yes | No | No | Add `src/types/leader-entity.ts` + export in `src/types/index.ts`; add `src/handlers/entity/leader.ts`; add `toSVG` case (even minimal); add fixture + unit test |
|
|
402
351
|
| MLEADER | No | No | No | No | Add `src/types/mleader-entity.ts`; add `src/handlers/entity/mleader.ts`; likely requires OBJECTS support (DICTIONARY/XRECORD) for full fidelity; start with parse-only + safe ignore in render |
|
|
403
|
-
| TOLERANCE |
|
|
404
|
-
| IMAGE |
|
|
405
|
-
| UNDERLAY |
|
|
352
|
+
| TOLERANCE | Yes | Yes | No | No | Add `src/types/tolerance-entity.ts`; add `src/handlers/entity/tolerance.ts`; render as text fallback (SVG only) |
|
|
353
|
+
| 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
|
+
| 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 |
|
|
406
355
|
| WIPEOUT | No | No | No | No | Add `src/types/wipeout-entity.ts`; add `src/handlers/entity/wipeout.ts`; render as polygon mask approximation or ignore safely |
|
|
407
356
|
| RAY | No | No | No | No | Add `src/types/ray-entity.ts`; add `src/handlers/entity/ray.ts`; render as long line (bounded by extents) or ignore |
|
|
408
357
|
| XLINE | No | No | No | No | Add `src/types/xline-entity.ts`; add `src/handlers/entity/xline.ts`; render as long line (bounded by extents) or ignore |
|
|
@@ -426,10 +375,11 @@ The items below are the main gaps to reach “complete 2D” as defined in this
|
|
|
426
375
|
|
|
427
376
|
| Object | Current status | Primary file(s) to change | Minimal checklist |
|
|
428
377
|
| --- | --- | --- | --- |
|
|
429
|
-
| DICTIONARY |
|
|
430
|
-
| XRECORD |
|
|
378
|
+
| DICTIONARY | Implemented | `src/handlers/objects.ts` (+ new types file if desired) | Group objects by `0`; add DICTIONARY parser; store by handle for lookup |
|
|
379
|
+
| XRECORD | Implemented | `src/handlers/objects.ts` | Add XRECORD parser; preserve raw records for downstream consumers |
|
|
431
380
|
| DIMASSOC | Missing | `src/handlers/objects.ts` | Add DIMASSOC parse with safe unresolved references; add fixture-based test |
|
|
432
|
-
| IMAGEDEF / IMAGEDEF_REACTOR |
|
|
381
|
+
| IMAGEDEF / IMAGEDEF_REACTOR | Implemented | `src/handlers/objects.ts` | Parse enough to resolve IMAGE entity references; do not crash if external files missing |
|
|
382
|
+
| UNDERLAYDEFINITION | Implemented | `src/handlers/objects.ts` | Parse enough to resolve DWFUNDERLAY/DGNUNDERLAY references; do not crash if external files missing |
|
|
433
383
|
| FIELD | Missing | `src/handlers/objects.ts` | Parse as raw text/value pairs; do not attempt full evaluation initially |
|
|
434
384
|
| TABLESTYLE | Missing | `src/handlers/objects.ts` | Parse style basics; used later for TABLE entity rendering |
|
|
435
385
|
| GROUP | Missing | `src/handlers/objects.ts` | Parse group membership; safe ignore if not used |
|
|
@@ -447,10 +397,10 @@ This appendix provides an explicit sequence of PRs. The intent is to keep each P
|
|
|
447
397
|
|
|
448
398
|
### B.1 Recommended order (high value first)
|
|
449
399
|
|
|
450
|
-
- **Stabilize existing behavior**: PR B1.1 (POLYLINE/VERTEX/SEQEND sequencing), PR B1.2 (block basepoint for TEXT/MTEXT/DIMENSION).
|
|
451
|
-
- **Unblock references and metadata**: PR B1.3 (OBJECTS dispatch + DICTIONARY), PR B1.4 (XRECORD).
|
|
452
|
-
- **Enable images/underlays**: PR B1.5 (IMAGEDEF / IMAGEDEF_REACTOR), PR B1.6 (IMAGE entity), PR B1.7 (UNDERLAY defs + UNDERLAY entity).
|
|
453
|
-
- **Add remaining common 2D annotation**: PR B1.8 (LEADER), PR B1.9 (TOLERANCE), PR B1.10 (DIMASSOC), PR B1.11 (MLEADER).
|
|
400
|
+
- **Stabilize existing behavior**: ✅ PR B1.1 (POLYLINE/VERTEX/SEQEND sequencing), ✅ PR B1.2 (block basepoint for TEXT/MTEXT/DIMENSION).
|
|
401
|
+
- **Unblock references and metadata**: ✅ PR B1.3 (OBJECTS dispatch + DICTIONARY), ✅ PR B1.4 (XRECORD).
|
|
402
|
+
- **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).
|
|
454
404
|
|
|
455
405
|
### B.2 PR templates by feature type
|
|
456
406
|
|
package/README.md
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
# DXF-Renewed
|
|
2
|
+
|
|
1
3
|
[](https://travis-ci.org/bjnortier/dxf)
|
|
2
4
|
[](https://github.com/semantic-release/semantic-release)
|
|
3
5
|
|
|
4
|
-
# DXF-Renewed
|
|
5
|
-
|
|
6
6
|
> **⚠️ WARNING: This repository is currently under development and has not been fully tested in production. Use at your own risk.**
|
|
7
7
|
|
|
8
8
|
DXF parser for node/browser.
|
|
@@ -24,7 +24,7 @@ Written in **TypeScript** with full type definitions included. Uses modern ES201
|
|
|
24
24
|
- 🎯 Full TypeScript codebase with strict type checking
|
|
25
25
|
- ⚡ Built with esbuild (96% faster than Babel - 18ms vs 447ms)
|
|
26
26
|
- 📦 Modular type system with 22+ separate type files
|
|
27
|
-
- ✅
|
|
27
|
+
- ✅ Extensive unit tests and browser integration tests
|
|
28
28
|
- 🎨 Enhanced SVG rendering with TEXT, MTEXT, and DIMENSION support
|
|
29
29
|
- 📚 Comprehensive type definitions for all DXF entities
|
|
30
30
|
|
|
@@ -148,6 +148,34 @@ Here's an example you will find in the functional test output:
|
|
|
148
148
|
|
|
149
149
|

|
|
150
150
|
|
|
151
|
+
### DIMENSION auto-scaling
|
|
152
|
+
|
|
153
|
+
DIMENSION rendering supports viewport-based auto-scaling so that arrows and text remain readable across different coordinate scales.
|
|
154
|
+
|
|
155
|
+
```ts
|
|
156
|
+
import { Helper } from '@linkiez/dxf-renew'
|
|
157
|
+
|
|
158
|
+
const helper = new Helper(dxfString)
|
|
159
|
+
|
|
160
|
+
const svg = helper.toSVG({
|
|
161
|
+
dimension: {
|
|
162
|
+
autoScale: true,
|
|
163
|
+
// Reference used when percentages are not provided.
|
|
164
|
+
autoScaleViewportReference: 40,
|
|
165
|
+
// Optional per-element overrides as a percentage (0..100)
|
|
166
|
+
// of min(viewBoxWidth, viewBoxHeight).
|
|
167
|
+
autoScaleViewportPercentages: {
|
|
168
|
+
arrowSize: 1.5,
|
|
169
|
+
textHeight: 1
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
})
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
When `autoScaleViewportPercentages` is provided (and `autoScale` is enabled), the final size for each configured element is computed as:
|
|
176
|
+
|
|
177
|
+
`size = min(viewBoxWidth, viewBoxHeight) * (percent / 100)`
|
|
178
|
+
|
|
151
179
|
## Interpolation
|
|
152
180
|
|
|
153
181
|
The library supports outputting DXFs as interpolated polylines for custom rendering (e.g. WebGL) or other applications:
|
|
@@ -189,6 +217,14 @@ Running the unit tests:
|
|
|
189
217
|
yarn test
|
|
190
218
|
```
|
|
191
219
|
|
|
220
|
+
Running the browser integration tests (Playwright):
|
|
221
|
+
|
|
222
|
+
```bash
|
|
223
|
+
yarn test:integration:browser
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
These tests render fixtures in a real browser and write deterministic PNG screenshots under `test/rendered/` (overwritten on each run).
|
|
227
|
+
|
|
192
228
|
Running the functional tests in a browser:
|
|
193
229
|
|
|
194
230
|
```bash
|
|
@@ -199,7 +235,7 @@ Please open `toSVG.html` when the file listing loads in the browser (or open `ht
|
|
|
199
235
|
|
|
200
236
|
## Development Guidelines
|
|
201
237
|
|
|
202
|
-
|
|
238
|
+
Project documentation index: `docs/README.md`
|
|
203
239
|
|
|
204
240
|
## TypeScript Support
|
|
205
241
|
|
|
@@ -251,8 +287,7 @@ This project uses [semantic-release](https://semantic-release.gitbook.io/) for a
|
|
|
251
287
|
**Releases are automatically created** when commits following [Conventional Commits](https://www.conventionalcommits.org/en/) are pushed to:
|
|
252
288
|
|
|
253
289
|
- `main` - Stable production releases (`1.0.0`, `1.1.0`, `2.0.0`)
|
|
254
|
-
|
|
255
|
-
- `beta` - Beta pre-releases (`1.1.0-beta.1`, `1.1.0-beta.2`)
|
|
290
|
+
|
|
256
291
|
|
|
257
292
|
### Commit Format
|
|
258
293
|
|
|
@@ -276,9 +311,9 @@ To contribute:
|
|
|
276
311
|
1. Fork the repository
|
|
277
312
|
2. Make commits using `yarn commit` (interactive) or following Conventional Commits
|
|
278
313
|
3. Push to your fork
|
|
279
|
-
4. Open a Pull Request to `
|
|
314
|
+
4. Open a Pull Request to `main`
|
|
280
315
|
|
|
281
|
-
See [CONTRIBUTING.md](./CONTRIBUTING.md) for detailed guidelines
|
|
316
|
+
See [CONTRIBUTING.md](./CONTRIBUTING.md) for detailed guidelines.
|
|
282
317
|
|
|
283
318
|
## Contributors
|
|
284
319
|
|