@linkiez/dxf-renew 7.1.0 → 7.2.3
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 +34 -0
- package/README.md +72 -10
- package/{PLAN.md → ROADMAP.md} +227 -35
- package/build.mjs +28 -0
- 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.d.ts +19 -0
- package/lib/Helper.d.ts.map +1 -0
- package/lib/Helper.js +4 -0
- package/lib/Helper.js.map +2 -2
- package/lib/applyTransforms.d.ts +12 -0
- package/lib/applyTransforms.d.ts.map +1 -0
- package/lib/cli.cjs +1 -2
- package/lib/cli.cjs.map +1 -1
- package/lib/cli.d.ts +3 -0
- package/lib/cli.d.ts.map +1 -0
- package/lib/config.d.ts +4 -0
- package/lib/config.d.ts.map +1 -0
- package/lib/constants.d.ts +3 -0
- package/lib/constants.d.ts.map +1 -0
- package/lib/denormalise.d.ts +3 -0
- package/lib/denormalise.d.ts.map +1 -0
- package/lib/dimensionToSVG.d.ts +18 -0
- package/lib/dimensionToSVG.d.ts.map +1 -0
- package/lib/entityToPolyline.cjs +95 -0
- package/lib/entityToPolyline.cjs.map +3 -3
- package/lib/entityToPolyline.d.ts +48 -0
- package/lib/entityToPolyline.d.ts.map +1 -0
- package/lib/entityToPolyline.js +95 -0
- package/lib/entityToPolyline.js.map +2 -2
- package/lib/getRGBForEntity.d.ts +5 -0
- package/lib/getRGBForEntity.d.ts.map +1 -0
- package/lib/groupEntitiesByLayer.d.ts +3 -0
- package/lib/groupEntitiesByLayer.d.ts.map +1 -0
- package/lib/handlers/blocks.d.ts +3 -0
- package/lib/handlers/blocks.d.ts.map +1 -0
- package/lib/handlers/entities.cjs +22 -2
- package/lib/handlers/entities.cjs.map +3 -3
- package/lib/handlers/entities.d.ts +4 -0
- package/lib/handlers/entities.d.ts.map +1 -0
- package/lib/handlers/entities.js +22 -2
- package/lib/handlers/entities.js.map +2 -2
- package/lib/handlers/entity/arc.d.ts +20 -0
- package/lib/handlers/entity/arc.d.ts.map +1 -0
- package/lib/handlers/entity/attdef.d.ts +11 -0
- package/lib/handlers/entity/attdef.d.ts.map +1 -0
- package/lib/handlers/entity/attrib.d.ts +9 -0
- package/lib/handlers/entity/attrib.d.ts.map +1 -0
- package/lib/handlers/entity/circle.d.ts +17 -0
- package/lib/handlers/entity/circle.d.ts.map +1 -0
- package/lib/handlers/entity/common.d.ts +3 -0
- package/lib/handlers/entity/common.d.ts.map +1 -0
- package/lib/handlers/entity/dgnUnderlay.d.ts +33 -0
- package/lib/handlers/entity/dgnUnderlay.d.ts.map +1 -0
- package/lib/handlers/entity/dimension.d.ts +35 -0
- package/lib/handlers/entity/dimension.d.ts.map +1 -0
- package/lib/handlers/entity/dwfUnderlay.d.ts +33 -0
- package/lib/handlers/entity/dwfUnderlay.d.ts.map +1 -0
- package/lib/handlers/entity/ellipse.d.ts +10 -0
- package/lib/handlers/entity/ellipse.d.ts.map +1 -0
- package/lib/handlers/entity/hatch.d.ts +9 -0
- package/lib/handlers/entity/hatch.d.ts.map +1 -0
- package/lib/handlers/entity/image.d.ts +26 -0
- package/lib/handlers/entity/image.d.ts.map +1 -0
- package/lib/handlers/entity/insert.d.ts +10 -0
- package/lib/handlers/entity/insert.d.ts.map +1 -0
- package/lib/handlers/entity/leader.d.ts +48 -0
- package/lib/handlers/entity/leader.d.ts.map +1 -0
- package/lib/handlers/entity/line.d.ts +16 -0
- package/lib/handlers/entity/line.d.ts.map +1 -0
- package/lib/handlers/entity/lwpolyline.d.ts +10 -0
- package/lib/handlers/entity/lwpolyline.d.ts.map +1 -0
- package/lib/handlers/entity/mleader.cjs +69 -0
- package/lib/handlers/entity/mleader.cjs.map +7 -0
- package/lib/handlers/entity/mleader.d.ts +15 -0
- package/lib/handlers/entity/mleader.d.ts.map +1 -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.d.ts +17 -0
- package/lib/handlers/entity/mline.d.ts.map +1 -0
- package/lib/handlers/entity/mline.js +56 -0
- package/lib/handlers/entity/mline.js.map +7 -0
- package/lib/handlers/entity/mtext.d.ts +62 -0
- package/lib/handlers/entity/mtext.d.ts.map +1 -0
- package/lib/handlers/entity/ole2Frame.d.ts +9 -0
- package/lib/handlers/entity/ole2Frame.d.ts.map +1 -0
- package/lib/handlers/entity/oleframe.cjs +98 -0
- package/lib/handlers/entity/oleframe.cjs.map +7 -0
- package/lib/handlers/entity/oleframe.d.ts +9 -0
- package/lib/handlers/entity/oleframe.d.ts.map +1 -0
- package/lib/handlers/entity/oleframe.js +63 -0
- package/lib/handlers/entity/oleframe.js.map +7 -0
- package/lib/handlers/entity/pdfUnderlay.d.ts +33 -0
- package/lib/handlers/entity/pdfUnderlay.d.ts.map +1 -0
- package/lib/handlers/entity/point.d.ts +17 -0
- package/lib/handlers/entity/point.d.ts.map +1 -0
- package/lib/handlers/entity/polyline.d.ts +21 -0
- package/lib/handlers/entity/polyline.d.ts.map +1 -0
- package/lib/handlers/entity/ray.cjs +81 -0
- package/lib/handlers/entity/ray.cjs.map +7 -0
- package/lib/handlers/entity/ray.d.ts +15 -0
- package/lib/handlers/entity/ray.d.ts.map +1 -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.d.ts +14 -0
- package/lib/handlers/entity/region.d.ts.map +1 -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.d.ts +22 -0
- package/lib/handlers/entity/shape.d.ts.map +1 -0
- package/lib/handlers/entity/shape.js +60 -0
- package/lib/handlers/entity/shape.js.map +7 -0
- package/lib/handlers/entity/solid.d.ts +15 -0
- package/lib/handlers/entity/solid.d.ts.map +1 -0
- package/lib/handlers/entity/spline.d.ts +30 -0
- package/lib/handlers/entity/spline.d.ts.map +1 -0
- package/lib/handlers/entity/table.cjs +71 -0
- package/lib/handlers/entity/table.cjs.map +7 -0
- package/lib/handlers/entity/table.d.ts +16 -0
- package/lib/handlers/entity/table.d.ts.map +1 -0
- package/lib/handlers/entity/table.js +36 -0
- package/lib/handlers/entity/table.js.map +7 -0
- package/lib/handlers/entity/text.d.ts +31 -0
- package/lib/handlers/entity/text.d.ts.map +1 -0
- package/lib/handlers/entity/threeDFace.d.ts +14 -0
- package/lib/handlers/entity/threeDFace.d.ts.map +1 -0
- package/lib/handlers/entity/tolerance.d.ts +25 -0
- package/lib/handlers/entity/tolerance.d.ts.map +1 -0
- package/lib/handlers/entity/trace.cjs +101 -0
- package/lib/handlers/entity/trace.cjs.map +7 -0
- package/lib/handlers/entity/trace.d.ts +15 -0
- package/lib/handlers/entity/trace.d.ts.map +1 -0
- package/lib/handlers/entity/trace.js +66 -0
- package/lib/handlers/entity/trace.js.map +7 -0
- package/lib/handlers/entity/vertex.d.ts +10 -0
- package/lib/handlers/entity/vertex.d.ts.map +1 -0
- package/lib/handlers/entity/viewport.d.ts +9 -0
- package/lib/handlers/entity/viewport.d.ts.map +1 -0
- package/lib/handlers/entity/wipeout.cjs +122 -0
- package/lib/handlers/entity/wipeout.cjs.map +7 -0
- package/lib/handlers/entity/wipeout.d.ts +28 -0
- package/lib/handlers/entity/wipeout.d.ts.map +1 -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.d.ts +15 -0
- package/lib/handlers/entity/xline.d.ts.map +1 -0
- package/lib/handlers/entity/xline.js +46 -0
- package/lib/handlers/entity/xline.js.map +7 -0
- package/lib/handlers/header.d.ts +3 -0
- package/lib/handlers/header.d.ts.map +1 -0
- package/lib/handlers/objects.cjs +43 -1
- package/lib/handlers/objects.cjs.map +2 -2
- package/lib/handlers/objects.d.ts +3 -0
- package/lib/handlers/objects.d.ts.map +1 -0
- 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.d.ts +13 -0
- package/lib/handlers/tables.d.ts.map +1 -0
- 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.d.ts +10 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +18 -16
- package/lib/index.js.map +3 -3
- package/lib/parseString.d.ts +3 -0
- package/lib/parseString.d.ts.map +1 -0
- package/lib/toJson.cjs +29 -0
- package/lib/toJson.cjs.map +7 -0
- package/lib/toJson.d.ts +3 -0
- package/lib/toJson.d.ts.map +1 -0
- package/lib/toJson.js +9 -0
- package/lib/toJson.js.map +7 -0
- package/lib/toPolylines.d.ts +4 -0
- package/lib/toPolylines.d.ts.map +1 -0
- package/lib/toSVG.cjs +34 -3
- package/lib/toSVG.cjs.map +2 -2
- package/lib/toSVG.d.ts +7 -0
- package/lib/toSVG.d.ts.map +1 -0
- package/lib/toSVG.js +34 -3
- package/lib/toSVG.js.map +2 -2
- package/lib/types/arc-entity.d.ts +8 -0
- package/lib/types/arc-entity.d.ts.map +1 -0
- package/lib/types/base-entity.d.ts +22 -0
- package/lib/types/base-entity.d.ts.map +1 -0
- package/lib/types/circle-entity.d.ts +6 -0
- package/lib/types/circle-entity.d.ts.map +1 -0
- package/lib/types/common.d.ts +30 -0
- package/lib/types/common.d.ts.map +1 -0
- package/lib/types/dimension-entity.d.ts +31 -0
- package/lib/types/dimension-entity.d.ts.map +1 -0
- package/lib/types/dxf.d.ts +55 -0
- package/lib/types/dxf.d.ts.map +1 -0
- package/lib/types/ellipse-entity.d.ts +11 -0
- package/lib/types/ellipse-entity.d.ts.map +1 -0
- package/lib/types/entity.cjs.map +1 -1
- package/lib/types/entity.d.ts +30 -0
- package/lib/types/entity.d.ts.map +1 -0
- package/lib/types/handler-internal.d.ts +44 -0
- package/lib/types/handler-internal.d.ts.map +1 -0
- package/lib/types/handler.d.ts +8 -0
- package/lib/types/handler.d.ts.map +1 -0
- package/lib/types/hatch-entity.d.ts +116 -0
- package/lib/types/hatch-entity.d.ts.map +1 -0
- package/lib/types/helper.cjs.map +1 -1
- package/lib/types/helper.d.ts +11 -0
- package/lib/types/helper.d.ts.map +1 -0
- package/lib/types/image-entity.d.ts +25 -0
- package/lib/types/image-entity.d.ts.map +1 -0
- package/lib/types/index.cjs +20 -0
- package/lib/types/index.cjs.map +2 -2
- package/lib/types/index.d.ts +43 -0
- package/lib/types/index.d.ts.map +1 -0
- package/lib/types/index.js +10 -0
- package/lib/types/index.js.map +2 -2
- package/lib/types/insert-entity.d.ts +16 -0
- package/lib/types/insert-entity.d.ts.map +1 -0
- package/lib/types/layer-groups.d.ts +6 -0
- package/lib/types/layer-groups.d.ts.map +1 -0
- package/lib/types/leader-entity.d.ts +28 -0
- package/lib/types/leader-entity.d.ts.map +1 -0
- package/lib/types/line-entity.d.ts +8 -0
- package/lib/types/line-entity.d.ts.map +1 -0
- package/lib/types/mleader-entity.cjs +17 -0
- package/lib/types/mleader-entity.cjs.map +7 -0
- package/lib/types/mleader-entity.d.ts +7 -0
- package/lib/types/mleader-entity.d.ts.map +1 -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.d.ts +10 -0
- package/lib/types/mline-entity.d.ts.map +1 -0
- package/lib/types/mline-entity.js +1 -0
- package/lib/types/mline-entity.js.map +7 -0
- package/lib/types/mtext-entity.d.ts +33 -0
- package/lib/types/mtext-entity.d.ts.map +1 -0
- package/lib/types/ole2frame-entity.d.ts +33 -0
- package/lib/types/ole2frame-entity.d.ts.map +1 -0
- package/lib/types/oleframe-entity.cjs +17 -0
- package/lib/types/oleframe-entity.cjs.map +7 -0
- package/lib/types/oleframe-entity.d.ts +33 -0
- package/lib/types/oleframe-entity.d.ts.map +1 -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/options.d.ts +57 -0
- package/lib/types/options.d.ts.map +1 -0
- package/lib/types/point-entity.d.ts +5 -0
- package/lib/types/point-entity.d.ts.map +1 -0
- package/lib/types/polyline-entity.d.ts +17 -0
- package/lib/types/polyline-entity.d.ts.map +1 -0
- package/lib/types/polylines.d.ts +18 -0
- package/lib/types/polylines.d.ts.map +1 -0
- package/lib/types/ray-entity.cjs +17 -0
- package/lib/types/ray-entity.cjs.map +7 -0
- package/lib/types/ray-entity.d.ts +10 -0
- package/lib/types/ray-entity.d.ts.map +1 -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.d.ts +10 -0
- package/lib/types/region-entity.d.ts.map +1 -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.d.ts +17 -0
- package/lib/types/shape-entity.d.ts.map +1 -0
- package/lib/types/shape-entity.js +1 -0
- package/lib/types/shape-entity.js.map +7 -0
- package/lib/types/solid-entity.d.ts +7 -0
- package/lib/types/solid-entity.d.ts.map +1 -0
- package/lib/types/spline-entity.d.ts +10 -0
- package/lib/types/spline-entity.d.ts.map +1 -0
- package/lib/types/svg.d.ts +27 -0
- package/lib/types/svg.d.ts.map +1 -0
- package/lib/types/table-entity.cjs +17 -0
- package/lib/types/table-entity.cjs.map +7 -0
- package/lib/types/table-entity.d.ts +12 -0
- package/lib/types/table-entity.d.ts.map +1 -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/tables.d.ts +549 -0
- package/lib/types/tables.d.ts.map +1 -0
- package/lib/types/text-entity.d.ts +21 -0
- package/lib/types/text-entity.d.ts.map +1 -0
- package/lib/types/tolerance-entity.d.ts +14 -0
- package/lib/types/tolerance-entity.d.ts.map +1 -0
- package/lib/types/trace-entity.cjs +17 -0
- package/lib/types/trace-entity.cjs.map +7 -0
- package/lib/types/trace-entity.d.ts +10 -0
- package/lib/types/trace-entity.d.ts.map +1 -0
- package/lib/types/trace-entity.js +1 -0
- package/lib/types/trace-entity.js.map +7 -0
- package/lib/types/underlay-entity.d.ts +26 -0
- package/lib/types/underlay-entity.d.ts.map +1 -0
- package/lib/types/util-types.d.ts +22 -0
- package/lib/types/util-types.d.ts.map +1 -0
- package/lib/types/viewport-entity.d.ts +79 -0
- package/lib/types/viewport-entity.d.ts.map +1 -0
- package/lib/types/wipeout-entity.cjs +17 -0
- package/lib/types/wipeout-entity.cjs.map +7 -0
- package/lib/types/wipeout-entity.d.ts +18 -0
- package/lib/types/wipeout-entity.d.ts.map +1 -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.d.ts +10 -0
- package/lib/types/xline-entity.d.ts.map +1 -0
- package/lib/types/xline-entity.js +1 -0
- package/lib/types/xline-entity.js.map +7 -0
- package/lib/types.d.ts +2 -0
- package/lib/types.d.ts.map +1 -0
- package/lib/util/bSpline.d.ts +8 -0
- package/lib/util/bSpline.d.ts.map +1 -0
- package/lib/util/colors.d.ts +5 -0
- package/lib/util/colors.d.ts.map +1 -0
- package/lib/util/createArcForLWPolyline.d.ts +9 -0
- package/lib/util/createArcForLWPolyline.d.ts.map +1 -0
- package/lib/util/dxfColorToRGB.d.ts +22 -0
- package/lib/util/dxfColorToRGB.d.ts.map +1 -0
- package/lib/util/escapeXmlText.d.ts +2 -0
- package/lib/util/escapeXmlText.d.ts.map +1 -0
- package/lib/util/insertKnot.d.ts +9 -0
- package/lib/util/insertKnot.d.ts.map +1 -0
- package/lib/util/logger.d.ts +10 -0
- package/lib/util/logger.d.ts.map +1 -0
- package/lib/util/rgbToColorAttribute.d.ts +7 -0
- package/lib/util/rgbToColorAttribute.d.ts.map +1 -0
- package/lib/util/rotate.d.ts +9 -0
- package/lib/util/rotate.d.ts.map +1 -0
- package/lib/util/round10.d.ts +2 -0
- package/lib/util/round10.d.ts.map +1 -0
- package/lib/util/toPiecewiseBezier.d.ts +18 -0
- package/lib/util/toPiecewiseBezier.d.ts.map +1 -0
- package/lib/util/transformBoundingBoxAndElement.d.ts +9 -0
- package/lib/util/transformBoundingBoxAndElement.d.ts.map +1 -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/src/types/entity.ts
CHANGED
|
@@ -10,14 +10,24 @@ import type { ImageEntity } from './image-entity'
|
|
|
10
10
|
import type { InsertEntity } from './insert-entity'
|
|
11
11
|
import type { LeaderEntity } from './leader-entity'
|
|
12
12
|
import type { LineEntity } from './line-entity'
|
|
13
|
+
import type { MLeaderEntity } from './mleader-entity'
|
|
14
|
+
import type { MLineEntity } from './mline-entity'
|
|
13
15
|
import type { MTextEntity } from './mtext-entity'
|
|
16
|
+
import type { OleFrameEntity } from './oleframe-entity'
|
|
14
17
|
import type { PointEntity } from './point-entity'
|
|
15
18
|
import type { PolylineEntity } from './polyline-entity'
|
|
19
|
+
import type { RayEntity } from './ray-entity'
|
|
20
|
+
import type { RegionEntity } from './region-entity'
|
|
21
|
+
import type { ShapeEntity } from './shape-entity'
|
|
16
22
|
import type { SolidEntity } from './solid-entity'
|
|
17
23
|
import type { SplineEntity } from './spline-entity'
|
|
24
|
+
import type { TableEntity } from './table-entity'
|
|
18
25
|
import type { TextEntity } from './text-entity'
|
|
19
26
|
import type { ToleranceEntity } from './tolerance-entity'
|
|
27
|
+
import type { TraceEntity } from './trace-entity'
|
|
20
28
|
import type { DgnUnderlayEntity, DwfUnderlayEntity, PdfUnderlayEntity } from './underlay-entity'
|
|
29
|
+
import type { WipeoutEntity } from './wipeout-entity'
|
|
30
|
+
import type { XLineEntity } from './xline-entity'
|
|
21
31
|
|
|
22
32
|
export type Entity =
|
|
23
33
|
| LineEntity
|
|
@@ -29,14 +39,24 @@ export type Entity =
|
|
|
29
39
|
| PointEntity
|
|
30
40
|
| PolylineEntity
|
|
31
41
|
| SplineEntity
|
|
42
|
+
| TableEntity
|
|
32
43
|
| DimensionEntity
|
|
33
44
|
| SolidEntity
|
|
45
|
+
| TraceEntity
|
|
34
46
|
| InsertEntity
|
|
35
47
|
| ImageEntity
|
|
36
48
|
| LeaderEntity
|
|
49
|
+
| MLineEntity
|
|
50
|
+
| MLeaderEntity
|
|
37
51
|
| ToleranceEntity
|
|
38
52
|
| DwfUnderlayEntity
|
|
39
53
|
| DgnUnderlayEntity
|
|
40
54
|
| PdfUnderlayEntity
|
|
41
55
|
| HatchEntity
|
|
42
56
|
| BaseEntity
|
|
57
|
+
| OleFrameEntity
|
|
58
|
+
| RayEntity
|
|
59
|
+
| RegionEntity
|
|
60
|
+
| ShapeEntity
|
|
61
|
+
| WipeoutEntity
|
|
62
|
+
| XLineEntity
|
package/src/types/helper.ts
CHANGED
|
@@ -2,11 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
import type { ParsedDXF } from './dxf'
|
|
4
4
|
import type { Entity } from './entity'
|
|
5
|
-
import type { ToPolylinesOptions, ToSVGOptions } from './options'
|
|
5
|
+
import type { ToJsonOptions, ToPolylinesOptions, ToSVGOptions } from './options'
|
|
6
6
|
|
|
7
7
|
export interface HelperInterface {
|
|
8
8
|
parsed: ParsedDXF
|
|
9
9
|
denormalised: Entity[]
|
|
10
10
|
toSVG(options?: ToSVGOptions): string
|
|
11
|
+
toJson(options?: ToJsonOptions): string
|
|
11
12
|
toPolylines(options?: ToPolylinesOptions): any[]
|
|
12
13
|
}
|
package/src/types/index.ts
CHANGED
|
@@ -16,16 +16,26 @@ export * from './image-entity'
|
|
|
16
16
|
export * from './insert-entity'
|
|
17
17
|
export * from './leader-entity'
|
|
18
18
|
export * from './line-entity'
|
|
19
|
+
export * from './mleader-entity'
|
|
20
|
+
export * from './mline-entity'
|
|
19
21
|
export * from './mtext-entity'
|
|
20
22
|
export * from './ole2frame-entity'
|
|
23
|
+
export * from './oleframe-entity'
|
|
21
24
|
export * from './point-entity'
|
|
22
25
|
export * from './polyline-entity'
|
|
26
|
+
export * from './ray-entity'
|
|
27
|
+
export * from './region-entity'
|
|
28
|
+
export * from './shape-entity'
|
|
23
29
|
export * from './solid-entity'
|
|
24
30
|
export * from './spline-entity'
|
|
31
|
+
export * from './table-entity'
|
|
25
32
|
export * from './text-entity'
|
|
26
33
|
export * from './tolerance-entity'
|
|
34
|
+
export * from './trace-entity'
|
|
27
35
|
export * from './underlay-entity'
|
|
28
36
|
export * from './viewport-entity'
|
|
37
|
+
export * from './wipeout-entity'
|
|
38
|
+
export * from './xline-entity'
|
|
29
39
|
|
|
30
40
|
// Union type
|
|
31
41
|
export * from './entity'
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { BaseEntity } from './base-entity'
|
|
2
|
+
import type { Point3D } from './common'
|
|
3
|
+
|
|
4
|
+
export interface MLineEntity extends BaseEntity {
|
|
5
|
+
type: 'MLINE'
|
|
6
|
+
|
|
7
|
+
startPoint?: Point3D
|
|
8
|
+
endPoint?: Point3D
|
|
9
|
+
|
|
10
|
+
vertexCount?: number
|
|
11
|
+
styleName?: string
|
|
12
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
// OLEFrame entity type
|
|
2
|
+
|
|
3
|
+
import type { BaseEntity } from './base-entity'
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* OLEFRAME entity
|
|
7
|
+
* Legacy OLE object frame entity.
|
|
8
|
+
*/
|
|
9
|
+
export interface OleFrameEntity extends BaseEntity {
|
|
10
|
+
type: 'OLEFRAME'
|
|
11
|
+
|
|
12
|
+
/** OLE version number */
|
|
13
|
+
version?: string | number
|
|
14
|
+
/** End of object name/description */
|
|
15
|
+
name?: string | number
|
|
16
|
+
|
|
17
|
+
/** Upper-left corner X coordinate (WCS) */
|
|
18
|
+
upperLeftX?: string | number
|
|
19
|
+
/** Upper-left corner Y coordinate (WCS) */
|
|
20
|
+
upperLeftY?: string | number
|
|
21
|
+
/** Upper-left corner Z coordinate (WCS) */
|
|
22
|
+
upperLeftZ?: string | number
|
|
23
|
+
|
|
24
|
+
/** Lower-right corner X coordinate (WCS) */
|
|
25
|
+
lowerRightX?: string | number
|
|
26
|
+
/** Lower-right corner Y coordinate (WCS) */
|
|
27
|
+
lowerRightY?: string | number
|
|
28
|
+
/** Lower-right corner Z coordinate (WCS) */
|
|
29
|
+
lowerRightZ?: string | number
|
|
30
|
+
|
|
31
|
+
/** Object type (1=Link, 2=Embedded, 3=Static) */
|
|
32
|
+
objectType?: string | number
|
|
33
|
+
/** Tile mode descriptor (0=Model space, 1=Paper space) */
|
|
34
|
+
tile?: string | number
|
|
35
|
+
|
|
36
|
+
/** Length of binary data */
|
|
37
|
+
length?: string | number
|
|
38
|
+
/** Binary data (concatenated from multiple 310 codes) */
|
|
39
|
+
data: string
|
|
40
|
+
}
|
package/src/types/options.ts
CHANGED
|
@@ -4,6 +4,13 @@ export interface ToPolylinesOptions {
|
|
|
4
4
|
interpolationsPerSplineSegment?: number
|
|
5
5
|
}
|
|
6
6
|
|
|
7
|
+
export interface ToJsonOptions {
|
|
8
|
+
/** Pretty-print JSON output (defaults to false). */
|
|
9
|
+
pretty?: boolean
|
|
10
|
+
/** Indentation spaces when pretty-printing (defaults to 2). */
|
|
11
|
+
space?: number
|
|
12
|
+
}
|
|
13
|
+
|
|
7
14
|
/**
|
|
8
15
|
* Viewport percentage controls for DIMENSION autoScale.
|
|
9
16
|
*
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
// RAY entity type
|
|
2
|
+
|
|
3
|
+
import type { BaseEntity } from './base-entity'
|
|
4
|
+
import type { Point3D } from './common'
|
|
5
|
+
|
|
6
|
+
export interface RayEntity extends BaseEntity {
|
|
7
|
+
type: 'RAY'
|
|
8
|
+
/** Starting point for the ray. */
|
|
9
|
+
start: Point3D
|
|
10
|
+
/** Unit direction vector. */
|
|
11
|
+
direction: Point3D
|
|
12
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { BaseEntity } from './base-entity'
|
|
2
|
+
|
|
3
|
+
export interface RegionEntity extends BaseEntity {
|
|
4
|
+
type: 'REGION'
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* ACIS data payload (text form). This project currently parses and stores it,
|
|
8
|
+
* but does not attempt to interpret it.
|
|
9
|
+
*/
|
|
10
|
+
acisData?: string[]
|
|
11
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
// SHAPE entity type
|
|
2
|
+
|
|
3
|
+
import type { BaseEntity } from './base-entity'
|
|
4
|
+
import type { Point3D } from './common'
|
|
5
|
+
|
|
6
|
+
export interface ShapeEntity extends BaseEntity {
|
|
7
|
+
type: 'SHAPE'
|
|
8
|
+
insertionPoint: Point3D
|
|
9
|
+
/** Shape name (from a loaded SHX shape file). */
|
|
10
|
+
name: string
|
|
11
|
+
/** Size in drawing units. */
|
|
12
|
+
size: number
|
|
13
|
+
rotation?: number
|
|
14
|
+
relativeXScale?: number
|
|
15
|
+
oblique?: number
|
|
16
|
+
thickness?: number
|
|
17
|
+
extrusionX?: number
|
|
18
|
+
extrusionY?: number
|
|
19
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { BaseEntity } from './base-entity'
|
|
2
|
+
|
|
3
|
+
export interface TableEntity extends BaseEntity {
|
|
4
|
+
type: 'TABLE'
|
|
5
|
+
|
|
6
|
+
rows?: number
|
|
7
|
+
columns?: number
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Minimal extracted cell text (from group code 1).
|
|
11
|
+
* This is intentionally lossy; full TABLE semantics are not implemented.
|
|
12
|
+
*/
|
|
13
|
+
cellText?: string[]
|
|
14
|
+
}
|
package/src/types/tables.ts
CHANGED
|
@@ -117,6 +117,54 @@ export interface LayerInternal {
|
|
|
117
117
|
lineWeightEnum?: string | number
|
|
118
118
|
}
|
|
119
119
|
|
|
120
|
+
/**
|
|
121
|
+
* Application ID (APPID) table entry
|
|
122
|
+
* Minimal internal representation during DXF parsing
|
|
123
|
+
*/
|
|
124
|
+
export interface AppIdInternal {
|
|
125
|
+
type: string
|
|
126
|
+
/** Application name */
|
|
127
|
+
name?: string | number
|
|
128
|
+
/** Standard flags (bit-coded) */
|
|
129
|
+
flags?: string | number
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* Block Record (BLOCK_RECORD) table entry
|
|
134
|
+
* Minimal internal representation during DXF parsing
|
|
135
|
+
*/
|
|
136
|
+
export interface BlockRecordInternal {
|
|
137
|
+
type: string
|
|
138
|
+
/** Block record name */
|
|
139
|
+
name?: string | number
|
|
140
|
+
/** Standard flags (bit-coded) */
|
|
141
|
+
flags?: string | number
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* User Coordinate System (UCS) table entry
|
|
146
|
+
* Minimal internal representation during DXF parsing
|
|
147
|
+
*/
|
|
148
|
+
export interface UcsInternal {
|
|
149
|
+
type: string
|
|
150
|
+
/** UCS name */
|
|
151
|
+
name?: string | number
|
|
152
|
+
/** Standard flags (bit-coded) */
|
|
153
|
+
flags?: string | number
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* View (VIEW) table entry
|
|
158
|
+
* Minimal internal representation during DXF parsing
|
|
159
|
+
*/
|
|
160
|
+
export interface ViewInternal {
|
|
161
|
+
type: string
|
|
162
|
+
/** View name */
|
|
163
|
+
name?: string | number
|
|
164
|
+
/** Standard flags (bit-coded) */
|
|
165
|
+
flags?: string | number
|
|
166
|
+
}
|
|
167
|
+
|
|
120
168
|
/**
|
|
121
169
|
* Text Style (STYLE) table entry
|
|
122
170
|
* Internal representation during DXF parsing
|
|
@@ -477,6 +525,28 @@ export interface UnderlayDefinitionObject {
|
|
|
477
525
|
tuples: DXFTuple[]
|
|
478
526
|
}
|
|
479
527
|
|
|
528
|
+
export interface DimAssocObject {
|
|
529
|
+
type: 'DIMASSOC'
|
|
530
|
+
handle?: string | number
|
|
531
|
+
|
|
532
|
+
/** Soft-pointer ID/handle to the owning dictionary (when present). */
|
|
533
|
+
ownerHandle?: string | number
|
|
534
|
+
|
|
535
|
+
/** Raw tuples for downstream consumers (excluding the initial 0/DIMASSOC tuple). */
|
|
536
|
+
tuples: DXFTuple[]
|
|
537
|
+
}
|
|
538
|
+
|
|
539
|
+
export interface FieldObject {
|
|
540
|
+
type: 'FIELD'
|
|
541
|
+
handle?: string | number
|
|
542
|
+
|
|
543
|
+
/** Soft-pointer ID/handle to the owning dictionary (when present). */
|
|
544
|
+
ownerHandle?: string | number
|
|
545
|
+
|
|
546
|
+
/** Raw tuples for downstream consumers (excluding the initial 0/FIELD tuple). */
|
|
547
|
+
tuples: DXFTuple[]
|
|
548
|
+
}
|
|
549
|
+
|
|
480
550
|
export interface ParsedObjects {
|
|
481
551
|
/** Layout objects */
|
|
482
552
|
layouts: LayoutInternal[]
|
|
@@ -495,4 +565,10 @@ export interface ParsedObjects {
|
|
|
495
565
|
|
|
496
566
|
/** UNDERLAYDEFINITION objects keyed by handle */
|
|
497
567
|
underlayDefinitions?: Record<string, UnderlayDefinitionObject>
|
|
568
|
+
|
|
569
|
+
/** DIMASSOC objects keyed by handle */
|
|
570
|
+
dimAssocs?: Record<string, DimAssocObject>
|
|
571
|
+
|
|
572
|
+
/** FIELD objects keyed by handle */
|
|
573
|
+
fields?: Record<string, FieldObject>
|
|
498
574
|
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// TRACE entity type
|
|
2
|
+
|
|
3
|
+
import type { BaseEntity } from './base-entity'
|
|
4
|
+
import type { Point3D } from './common'
|
|
5
|
+
|
|
6
|
+
export interface TraceEntity extends BaseEntity {
|
|
7
|
+
type: 'TRACE'
|
|
8
|
+
|
|
9
|
+
/** Four corner points (10/20/30, 11/21/31, 12/22/32, 13/23/33). */
|
|
10
|
+
corners: Point3D[]
|
|
11
|
+
|
|
12
|
+
/** Optional thickness (39). */
|
|
13
|
+
thickness?: number
|
|
14
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
// WIPEOUT entity type
|
|
2
|
+
|
|
3
|
+
import type { BaseEntity } from './base-entity'
|
|
4
|
+
import type { Point2D, Point3D } from './common'
|
|
5
|
+
|
|
6
|
+
export interface WipeoutEntity extends BaseEntity {
|
|
7
|
+
type: 'WIPEOUT'
|
|
8
|
+
|
|
9
|
+
insertionPoint: Point3D
|
|
10
|
+
uVector: Point3D
|
|
11
|
+
vVector: Point3D
|
|
12
|
+
|
|
13
|
+
clipBoundaryType?: 1 | 2
|
|
14
|
+
clipBoundaryVertices?: Point2D[]
|
|
15
|
+
|
|
16
|
+
displayProperties?: number
|
|
17
|
+
clippingState?: 0 | 1
|
|
18
|
+
classVersion?: number
|
|
19
|
+
imageSizePixels?: { u: number; v: number }
|
|
20
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
// XLINE entity type
|
|
2
|
+
|
|
3
|
+
import type { BaseEntity } from './base-entity'
|
|
4
|
+
import type { Point3D } from './common'
|
|
5
|
+
|
|
6
|
+
export interface XLineEntity extends BaseEntity {
|
|
7
|
+
type: 'XLINE'
|
|
8
|
+
/** Base point for the infinite line. */
|
|
9
|
+
basePoint: Point3D
|
|
10
|
+
/** Unit direction vector. */
|
|
11
|
+
direction: Point3D
|
|
12
|
+
}
|
|
@@ -1,254 +0,0 @@
|
|
|
1
|
-
# DIMENSION Implementation Summary
|
|
2
|
-
|
|
3
|
-
## Overview
|
|
4
|
-
|
|
5
|
-
The `DIMENSION` entity is implemented with support for the `DIMSTYLE` system, including parsing, storage, and SVG rendering.
|
|
6
|
-
|
|
7
|
-
SVG rendering supports DXF dimension types 0/1/2/3/4/5/6.
|
|
8
|
-
|
|
9
|
-
## Implementation Status
|
|
10
|
-
|
|
11
|
-
### ✅ Phase 1: DIMSTYLE Parsing and Storage (100%)
|
|
12
|
-
|
|
13
|
-
* **DIMSTYLE Handler**: `src/handlers/tables.ts`
|
|
14
|
-
* 68+ properties parsed via group codes
|
|
15
|
-
* Main properties: DIMASZ (41), DIMTXT (140), DIMEXO (176), DIMEXE (177)
|
|
16
|
-
* Colors: DIMCLRD (176), DIMCLRE (177), DIMCLRT (178)
|
|
17
|
-
* Line weights: DIMLWD (371), DIMLWE (372)
|
|
18
|
-
* Arrow blocks: DIMBLK (342), DIMBLK1 (343), DIMBLK2 (344)
|
|
19
|
-
* Tolerances: DIMTOL (71), DIMTOLJ (283)
|
|
20
|
-
* Alternate units: DIMALT (170), DIMALTF (143), DIMALTD (171)
|
|
21
|
-
|
|
22
|
-
* **TypeScript Interfaces**:
|
|
23
|
-
* `DimStyleInternal` in `src/types/tables.ts` (internal storage)
|
|
24
|
-
* `DimStyleTable` in `src/types/dxf.ts` (public API)
|
|
25
|
-
|
|
26
|
-
* **Integration**:
|
|
27
|
-
* DIMSTYLE stored in `parsed.tables.dimStyles`
|
|
28
|
-
* DIMENSION entity linked to style via `styleName`
|
|
29
|
-
|
|
30
|
-
### ✅ Phase 2: Modular Architecture (100%)
|
|
31
|
-
|
|
32
|
-
* **Dedicated Module**: `src/dimensionToSVG.ts` (428 lines)
|
|
33
|
-
* Dispatcher based on `entity.dimensionType`
|
|
34
|
-
* 6 specialized rendering functions
|
|
35
|
-
* SVG marker system for arrows
|
|
36
|
-
* Helper functions for colors and geometry
|
|
37
|
-
|
|
38
|
-
* **Main Functions**:
|
|
39
|
-
* `dimensionToSVG()`: Main dispatcher
|
|
40
|
-
* `createArrowMarker()`: SVG marker creation with unique IDs
|
|
41
|
-
* `colorNumberToSVG()`: DXF color conversion (0-255) to RGB
|
|
42
|
-
* `getDimensionColors()`: Color extraction from DIMSTYLE
|
|
43
|
-
|
|
44
|
-
* **Integration with toSVG.ts**:
|
|
45
|
-
* `dimension()` calls `dimensionToSVG()` with correct DIMSTYLE
|
|
46
|
-
* Apply transforms to dimensions
|
|
47
|
-
|
|
48
|
-
### ✅ Phase 3: Advanced Rendering (100%)
|
|
49
|
-
|
|
50
|
-
Dimension types implemented with precise geometry:
|
|
51
|
-
|
|
52
|
-
#### 1. Linear Dimension (types 0 and 1)
|
|
53
|
-
|
|
54
|
-
* Extension lines with offset (DIMEXO) and extension (DIMEXE)
|
|
55
|
-
* Perpendicular geometry calculation (angle + π/2)
|
|
56
|
-
* Dimension line with arrows at ends
|
|
57
|
-
* Rotated text aligned to dimension
|
|
58
|
-
* File: `renderLinearDimension()`
|
|
59
|
-
|
|
60
|
-
#### 2. Angular Dimension (type 2)
|
|
61
|
-
|
|
62
|
-
* Radial extension lines from center
|
|
63
|
-
* Dimension line as SVG arc
|
|
64
|
-
* Large-arc flag calculation for arcs > 180°
|
|
65
|
-
* Arrows at arc ends
|
|
66
|
-
* Text rotated at mid-angle
|
|
67
|
-
* File: `renderAngularDimension()`
|
|
68
|
-
|
|
69
|
-
#### 3. Diameter Dimension (type 3)
|
|
70
|
-
|
|
71
|
-
* Line through circle
|
|
72
|
-
* Symbol ⌀ (Unicode U+2300) in text
|
|
73
|
-
* Single arrow at end
|
|
74
|
-
* File: `renderDiameterDimension()`
|
|
75
|
-
|
|
76
|
-
#### 4. Radius Dimension (type 4)
|
|
77
|
-
|
|
78
|
-
* Line from center to circumference
|
|
79
|
-
* Prefix "R" in text
|
|
80
|
-
* Single arrow at end
|
|
81
|
-
* File: `renderRadialDimension()`
|
|
82
|
-
|
|
83
|
-
#### 5. Ordinate Dimension (type 6)
|
|
84
|
-
|
|
85
|
-
* Simple leader line
|
|
86
|
-
* No arrows (per DXF specification)
|
|
87
|
-
* Text with X or Y coordinate
|
|
88
|
-
* File: `renderOrdinateDimension()`
|
|
89
|
-
|
|
90
|
-
#### 6. Fallback
|
|
91
|
-
|
|
92
|
-
* Minimal rendering for unsupported types
|
|
93
|
-
* Text only at textMidpoint position
|
|
94
|
-
* File: `renderFallbackDimension()`
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
### ✅ Phase 4: Colors and Refinements (100%)
|
|
99
|
-
|
|
100
|
-
#### DIMSTYLE Colors (100%)
|
|
101
|
-
|
|
102
|
-
* **DIMCLRD**: Dimension line color
|
|
103
|
-
* **DIMCLRE**: Extension line color
|
|
104
|
-
* **DIMCLRT**: Text color
|
|
105
|
-
* **DIMLWD**: Dimension line weight
|
|
106
|
-
* **DIMLWE**: Extension line weight
|
|
107
|
-
|
|
108
|
-
Implementation:
|
|
109
|
-
|
|
110
|
-
* DXF color table: `src/util/colors.ts` (267 colors)
|
|
111
|
-
* DXF → RGB conversion: `colorNumberToSVG()`
|
|
112
|
-
* Special cases: 0 (ByBlock), 256 (ByLayer), 7 (white/black) → currentColor
|
|
113
|
-
* Applied in all rendering functions
|
|
114
|
-
* Arrow markers inherit dimension line color
|
|
115
|
-
|
|
116
|
-
#### Optional Features (Not Implemented)
|
|
117
|
-
|
|
118
|
-
##### Custom Arrow Blocks (⏸️ Low Priority)
|
|
119
|
-
|
|
120
|
-
* DIMBLK, DIMBLK1, DIMBLK2 parsed and available
|
|
121
|
-
* Requires complex integration with INSERT renderer
|
|
122
|
-
* Fallback to standard triangular arrows works in most cases
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
##### Tolerances and Alternate Units (⏸️ Low Priority)
|
|
126
|
-
|
|
127
|
-
* DIMTOL, DIMALT and related properties parsed
|
|
128
|
-
* Requires complex multi-line text formatting
|
|
129
|
-
* Simple text sufficient for most cases
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
##### XDATA Overrides (⏸️ Rare Edge Case)
|
|
133
|
-
|
|
134
|
-
* Per-entity DIMSTYLE property overrides via XDATA
|
|
135
|
-
* Not implemented
|
|
136
|
-
* Default DIMSTYLE works in most cases
|
|
137
|
-
|
|
138
|
-
## Modified Files
|
|
139
|
-
|
|
140
|
-
### Created
|
|
141
|
-
|
|
142
|
-
* `src/dimensionToSVG.ts`: Complete rendering module (428 lines)
|
|
143
|
-
* `docs/DIMENSION_IMPLEMENTATION_PLAN.md`: Detailed implementation plan
|
|
144
|
-
* `docs/DIMENSION_SUMMARY.md`: This file
|
|
145
|
-
|
|
146
|
-
### Modified
|
|
147
|
-
|
|
148
|
-
* `src/handlers/entity/dimension.ts`: Added text (1) and styleName (3) parsing
|
|
149
|
-
* `src/types/dimension-entity.ts`: Added text and styleName properties
|
|
150
|
-
* `src/handlers/tables.ts`: Complete DIMSTYLE handler (68 properties)
|
|
151
|
-
* `src/types/tables.ts`: DimStyleInternal interface
|
|
152
|
-
* `src/types/dxf.ts`: DimStyleTable interface (public API)
|
|
153
|
-
* `src/toSVG.ts`: Integration with dimensionToSVG, pass dimStyles
|
|
154
|
-
* `docs/IMPLEMENTED-2D-ENTITIES.md`: Updated DIMENSION entry
|
|
155
|
-
|
|
156
|
-
## Commits
|
|
157
|
-
|
|
158
|
-
### Commit 1: Phases 1 and 2
|
|
159
|
-
|
|
160
|
-
```text
|
|
161
|
-
feat: add complete DIMSTYLE parsing and modular architecture for DIMENSION
|
|
162
|
-
|
|
163
|
-
Phase 1: DIMSTYLE Parsing and Storage
|
|
164
|
-
- Create complete DIMSTYLE handler with 68+ properties
|
|
165
|
-
- Process group codes: DIMASZ (41), DIMTXT (140), DIMEXO (176), DIMEXE (177), etc.
|
|
166
|
-
- Add DimStyleInternal and DimStyleTable interfaces
|
|
167
|
-
- Integrate dimStyles into parsed.tables
|
|
168
|
-
- Link DIMENSION entities to their DIMSTYLE via styleName
|
|
169
|
-
|
|
170
|
-
Phase 2: Modular Rendering Architecture
|
|
171
|
-
- Create dedicated module src/dimensionToSVG.ts
|
|
172
|
-
- Implement dispatcher based on dimensionType
|
|
173
|
-
- Create 6 specialized rendering functions
|
|
174
|
-
- Add createArrowMarker for SVG markers
|
|
175
|
-
- Integrate dimensionToSVG with toSVG.ts
|
|
176
|
-
```
|
|
177
|
-
|
|
178
|
-
9 files modified, 874 insertions(+), 10 deletions(-)
|
|
179
|
-
|
|
180
|
-
### Commit 2: Phase 3
|
|
181
|
-
|
|
182
|
-
```text
|
|
183
|
-
feat: implement advanced dimension rendering with extension lines and arrows
|
|
184
|
-
|
|
185
|
-
Phase 3: Advanced Rendering
|
|
186
|
-
- Implement extension lines with DIMEXO (offset) and DIMEXE (extension)
|
|
187
|
-
- Add perpendicular geometry calculation for extension lines
|
|
188
|
-
- Create SVG markers for arrows with unique IDs (timestamp-based)
|
|
189
|
-
- Implement text rotation aligned to dimension
|
|
190
|
-
- Add angular dimensions with SVG arcs
|
|
191
|
-
- Implement ⌀ and R symbols for diameter/radius
|
|
192
|
-
- Support ordinate dimensions without arrows
|
|
193
|
-
- Apply configurable line weights
|
|
194
|
-
```
|
|
195
|
-
|
|
196
|
-
2 files modified, 145 insertions(+), 30 deletions(-)
|
|
197
|
-
|
|
198
|
-
### Commit 3: Phase 4 (This Commit)
|
|
199
|
-
|
|
200
|
-
```text
|
|
201
|
-
feat: add complete DIMSTYLE color support and documentation
|
|
202
|
-
|
|
203
|
-
Phase 4: Colors and Refinements
|
|
204
|
-
- Add colorNumberToSVG function for DXF → RGB conversion
|
|
205
|
-
- Implement getDimensionColors to extract colors from DIMSTYLE
|
|
206
|
-
- Apply DIMCLRD (dimension line color) in all renderings
|
|
207
|
-
- Apply DIMCLRE (extension line color) in all renderings
|
|
208
|
-
- Apply DIMCLRT (text color) in all renderings
|
|
209
|
-
- Apply DIMLWD and DIMLWE (line weights) to lines
|
|
210
|
-
- Add dimBlk, dimBlk1, dimBlk2 properties to DimStyleTable
|
|
211
|
-
- Update implementation plan with complete status
|
|
212
|
-
- Update entity documentation with detailed implementation
|
|
213
|
-
- Create complete implementation summary
|
|
214
|
-
```
|
|
215
|
-
|
|
216
|
-
## Testing and Validation
|
|
217
|
-
|
|
218
|
-
### Build
|
|
219
|
-
|
|
220
|
-
* ✅ ESM Build: 21-24ms
|
|
221
|
-
* ✅ CJS Build: 18-19ms
|
|
222
|
-
* ✅ 0 TypeScript errors
|
|
223
|
-
* ⚠️ 1 warning (import.meta in es2015 - unrelated)
|
|
224
|
-
|
|
225
|
-
### Generated Files
|
|
226
|
-
|
|
227
|
-
* `lib/dimensionToSVG.js`: 14.6kb (ESM)
|
|
228
|
-
* `lib/dimensionToSVG.cjs`: 16.4kb (CJS)
|
|
229
|
-
* `lib/handlers/tables.js`: 15.3kb (ESM)
|
|
230
|
-
* `lib/handlers/tables.cjs`: 16.8kb (CJS)
|
|
231
|
-
|
|
232
|
-
### Feature Coverage
|
|
233
|
-
|
|
234
|
-
* ✅ Parsing: 100% (68 DIMSTYLE properties)
|
|
235
|
-
* ✅ Basic rendering: 100% (6 dimension types)
|
|
236
|
-
* ✅ Advanced rendering: 100% (extension lines, arrows, rotation)
|
|
237
|
-
* ✅ Colors: 100% (DIMCLRD, DIMCLRE, DIMCLRT)
|
|
238
|
-
* ⏸️ Custom arrows: 0% (optional, low priority)
|
|
239
|
-
* ⏸️ Tolerances: 0% (optional, low priority)
|
|
240
|
-
* ⏸️ XDATA overrides: 0% (optional, edge case)
|
|
241
|
-
|
|
242
|
-
## Next Steps (Optional)
|
|
243
|
-
|
|
244
|
-
1. **Unit tests**: Create tests for each dimension type
|
|
245
|
-
2. **Integration tests**: Validate with real DXF files
|
|
246
|
-
3. **Custom arrow blocks**: Implement if there is demand
|
|
247
|
-
4. **Tolerances**: Implement if there is demand
|
|
248
|
-
5. **Performance**: Profiling and optimization if necessary
|
|
249
|
-
|
|
250
|
-
## Conclusion
|
|
251
|
-
|
|
252
|
-
The `DIMENSION` implementation is complete for common use cases (estimate: 95% of DXF files). The optional features not implemented are rare edge cases or too complex for the limited benefit they would provide.
|
|
253
|
-
|
|
254
|
-
The modular architecture allows for easy future extension if needed.
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
# DXF Version Support
|
|
2
|
-
|
|
3
|
-
## Current Position
|
|
4
|
-
|
|
5
|
-
The parser is designed around DXF group codes and sections, and does not currently gate behavior on `$ACADVER`.
|
|
6
|
-
|
|
7
|
-
In practice, this means:
|
|
8
|
-
|
|
9
|
-
- We aim to **parse and render** supported entities across many DXF versions.
|
|
10
|
-
- We treat `$ACADVER` primarily as a fixture metadata signal and future compatibility hook.
|
|
11
|
-
|
|
12
|
-
## What “Latest AutoCAD DXF” Means Here
|
|
13
|
-
|
|
14
|
-
AutoCAD introduces newer DXF versions over time (reflected in `$ACADVER`). Supporting “the latest” is best defined as:
|
|
15
|
-
|
|
16
|
-
- The library can load DXF files produced by recent AutoCAD versions **without rejecting due to version**, and
|
|
17
|
-
- The library has fixtures that include a recent `$ACADVER` value, validated by ezdxf.
|
|
18
|
-
|
|
19
|
-
## Recommended Strategy
|
|
20
|
-
|
|
21
|
-
1. **Track `$ACADVER` in fixture validation**
|
|
22
|
-
- Use `yarn validate:fixtures` to report `$ACADVER` for every fixture.
|
|
23
|
-
|
|
24
|
-
2. **Add at least one fixture exported from a recent AutoCAD version**
|
|
25
|
-
- Keep it small and single-purpose.
|
|
26
|
-
- Prefer a fixture that includes DIMENSION + text (to exercise newer text encoding and styles).
|
|
27
|
-
|
|
28
|
-
3. **Add an integration test for that fixture**
|
|
29
|
-
- The goal is “does not throw + expected key SVG features exist”.
|
|
30
|
-
|
|
31
|
-
4. **Add a policy (doc + CI)**
|
|
32
|
-
- Document which `$ACADVER` values are present in fixtures.
|
|
33
|
-
- Optionally enforce a minimum accepted `$ACADVER` in fixtures if the project wants to keep up with AutoCAD releases.
|
|
34
|
-
|
|
35
|
-
## Non-Goals
|
|
36
|
-
|
|
37
|
-
- Guarantee support for every new entity introduced by new DXF versions.
|
|
38
|
-
- Guarantee binary DXF support (unless explicitly added).
|
|
39
|
-
|
|
40
|
-
## Follow-ups (If Needed)
|
|
41
|
-
|
|
42
|
-
If we need version-specific behavior later, add:
|
|
43
|
-
|
|
44
|
-
- A header helper that exposes `$ACADVER` in a typed way.
|
|
45
|
-
- Tests that cover version-specific parsing/rendering differences.
|