@linkiez/dxf-renew 5.3.1
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/.eslintignore +17 -0
- package/.eslintrc.json +61 -0
- package/.gitattributes +4 -0
- package/.github/instructions/project-en_US.instructions.md +352 -0
- package/.github/workflows/release.yml +110 -0
- package/.husky/commit-msg +4 -0
- package/.husky/pre-commit +1 -0
- package/.prettierignore +1 -0
- package/.prettierrc.json +6 -0
- package/.releaserc.json +76 -0
- package/.travis.yml +6 -0
- package/.yarn/install-state.gz +0 -0
- package/.yarnrc.yml +1 -0
- package/CHANGELOG.md +134 -0
- package/CONTRIBUTING.md +271 -0
- package/LICENSE +21 -0
- package/PLAN.md +517 -0
- package/README.md +306 -0
- package/build.mjs +66 -0
- package/commitlint.config.js +25 -0
- package/dist/dxf.js +7234 -0
- package/docs/CODE_PATTERNS.md +182 -0
- package/docs/DIMENSION_SUMMARY.md +248 -0
- package/docs/DIMENSION_SUMMARY.pt-BR.md +248 -0
- package/docs/IMPLEMENTED-2D-ENTITIES.md +54 -0
- package/docs/IMPLEMENTED-2D-ENTITIES.pt-BR.md +54 -0
- package/docs/TEXT-MTEXT-DIMENSION-SUPPORT.md +241 -0
- package/docs/TEXT-MTEXT-DIMENSION-SUPPORT.pt-BR.md +169 -0
- package/docs/autocad_2012_pdf_dxf-reference_enu.md +8272 -0
- package/examples/dxf.html +36 -0
- package/examples/example.es5.js +30 -0
- package/examples/example.es6.js +30 -0
- package/examples/text-dimension-viewer.html +133 -0
- package/lib/Helper.cjs +89 -0
- package/lib/Helper.cjs.map +7 -0
- package/lib/Helper.js +59 -0
- package/lib/Helper.js.map +7 -0
- package/lib/applyTransforms.cjs +59 -0
- package/lib/applyTransforms.cjs.map +7 -0
- package/lib/applyTransforms.js +39 -0
- package/lib/applyTransforms.js.map +7 -0
- package/lib/cli.cjs +53 -0
- package/lib/cli.cjs.map +7 -0
- package/lib/cli.js +29 -0
- package/lib/cli.js.map +7 -0
- package/lib/config.cjs +30 -0
- package/lib/config.cjs.map +7 -0
- package/lib/config.js +10 -0
- package/lib/config.js.map +7 -0
- package/lib/constants.cjs +39 -0
- package/lib/constants.cjs.map +7 -0
- package/lib/constants.js +15 -0
- package/lib/constants.js.map +7 -0
- package/lib/denormalise.cjs +148 -0
- package/lib/denormalise.cjs.map +7 -0
- package/lib/denormalise.js +118 -0
- package/lib/denormalise.js.map +7 -0
- package/lib/dimensionToSVG.cjs +307 -0
- package/lib/dimensionToSVG.cjs.map +7 -0
- package/lib/dimensionToSVG.js +273 -0
- package/lib/dimensionToSVG.js.map +7 -0
- package/lib/entityToPolyline.cjs +248 -0
- package/lib/entityToPolyline.cjs.map +7 -0
- package/lib/entityToPolyline.js +213 -0
- package/lib/entityToPolyline.js.map +7 -0
- package/lib/getRGBForEntity.cjs +53 -0
- package/lib/getRGBForEntity.cjs.map +7 -0
- package/lib/getRGBForEntity.js +23 -0
- package/lib/getRGBForEntity.js.map +7 -0
- package/lib/groupEntitiesByLayer.cjs +34 -0
- package/lib/groupEntitiesByLayer.cjs.map +7 -0
- package/lib/groupEntitiesByLayer.js +14 -0
- package/lib/groupEntitiesByLayer.js.map +7 -0
- package/lib/handlers/blocks.cjs +93 -0
- package/lib/handlers/blocks.cjs.map +7 -0
- package/lib/handlers/blocks.js +63 -0
- package/lib/handlers/blocks.js.map +7 -0
- package/lib/handlers/entities.cjs +118 -0
- package/lib/handlers/entities.cjs.map +7 -0
- package/lib/handlers/entities.js +88 -0
- package/lib/handlers/entities.js.map +7 -0
- package/lib/handlers/entity/arc.cjs +82 -0
- package/lib/handlers/entity/arc.cjs.map +7 -0
- package/lib/handlers/entity/arc.js +47 -0
- package/lib/handlers/entity/arc.js.map +7 -0
- package/lib/handlers/entity/attdef.cjs +318 -0
- package/lib/handlers/entity/attdef.cjs.map +7 -0
- package/lib/handlers/entity/attdef.js +282 -0
- package/lib/handlers/entity/attdef.js.map +7 -0
- package/lib/handlers/entity/attrib.cjs +52 -0
- package/lib/handlers/entity/attrib.cjs.map +7 -0
- package/lib/handlers/entity/attrib.js +27 -0
- package/lib/handlers/entity/attrib.js.map +7 -0
- package/lib/handlers/entity/circle.cjs +73 -0
- package/lib/handlers/entity/circle.cjs.map +7 -0
- package/lib/handlers/entity/circle.js +38 -0
- package/lib/handlers/entity/circle.js.map +7 -0
- package/lib/handlers/entity/common.cjs +83 -0
- package/lib/handlers/entity/common.cjs.map +7 -0
- package/lib/handlers/entity/common.js +63 -0
- package/lib/handlers/entity/common.js.map +7 -0
- package/lib/handlers/entity/dimension.cjs +203 -0
- package/lib/handlers/entity/dimension.cjs.map +7 -0
- package/lib/handlers/entity/dimension.js +168 -0
- package/lib/handlers/entity/dimension.js.map +7 -0
- package/lib/handlers/entity/ellipse.cjs +88 -0
- package/lib/handlers/entity/ellipse.cjs.map +7 -0
- package/lib/handlers/entity/ellipse.js +53 -0
- package/lib/handlers/entity/ellipse.js.map +7 -0
- package/lib/handlers/entity/hatch.cjs +470 -0
- package/lib/handlers/entity/hatch.cjs.map +7 -0
- package/lib/handlers/entity/hatch.js +435 -0
- package/lib/handlers/entity/hatch.js.map +7 -0
- package/lib/handlers/entity/insert.cjs +106 -0
- package/lib/handlers/entity/insert.cjs.map +7 -0
- package/lib/handlers/entity/insert.js +71 -0
- package/lib/handlers/entity/insert.js.map +7 -0
- package/lib/handlers/entity/line.cjs +84 -0
- package/lib/handlers/entity/line.cjs.map +7 -0
- package/lib/handlers/entity/line.js +49 -0
- package/lib/handlers/entity/line.js.map +7 -0
- package/lib/handlers/entity/lwpolyline.cjs +82 -0
- package/lib/handlers/entity/lwpolyline.cjs.map +7 -0
- package/lib/handlers/entity/lwpolyline.js +47 -0
- package/lib/handlers/entity/lwpolyline.js.map +7 -0
- package/lib/handlers/entity/mtext.cjs +121 -0
- package/lib/handlers/entity/mtext.cjs.map +7 -0
- package/lib/handlers/entity/mtext.js +85 -0
- package/lib/handlers/entity/mtext.js.map +7 -0
- package/lib/handlers/entity/ole2Frame.cjs +98 -0
- package/lib/handlers/entity/ole2Frame.cjs.map +7 -0
- package/lib/handlers/entity/ole2Frame.js +63 -0
- package/lib/handlers/entity/ole2Frame.js.map +7 -0
- package/lib/handlers/entity/point.cjs +73 -0
- package/lib/handlers/entity/point.cjs.map +7 -0
- package/lib/handlers/entity/point.js +38 -0
- package/lib/handlers/entity/point.js.map +7 -0
- package/lib/handlers/entity/polyline.cjs +70 -0
- package/lib/handlers/entity/polyline.cjs.map +7 -0
- package/lib/handlers/entity/polyline.js +35 -0
- package/lib/handlers/entity/polyline.js.map +7 -0
- package/lib/handlers/entity/solid.cjs +101 -0
- package/lib/handlers/entity/solid.cjs.map +7 -0
- package/lib/handlers/entity/solid.js +66 -0
- package/lib/handlers/entity/solid.js.map +7 -0
- package/lib/handlers/entity/spline.cjs +109 -0
- package/lib/handlers/entity/spline.cjs.map +7 -0
- package/lib/handlers/entity/spline.js +74 -0
- package/lib/handlers/entity/spline.js.map +7 -0
- package/lib/handlers/entity/text.cjs +85 -0
- package/lib/handlers/entity/text.cjs.map +7 -0
- package/lib/handlers/entity/text.js +49 -0
- package/lib/handlers/entity/text.js.map +7 -0
- package/lib/handlers/entity/threeDFace.cjs +98 -0
- package/lib/handlers/entity/threeDFace.cjs.map +7 -0
- package/lib/handlers/entity/threeDFace.js +63 -0
- package/lib/handlers/entity/threeDFace.js.map +7 -0
- package/lib/handlers/entity/vertex.cjs +78 -0
- package/lib/handlers/entity/vertex.cjs.map +7 -0
- package/lib/handlers/entity/vertex.js +53 -0
- package/lib/handlers/entity/vertex.js.map +7 -0
- package/lib/handlers/entity/viewport.cjs +153 -0
- package/lib/handlers/entity/viewport.cjs.map +7 -0
- package/lib/handlers/entity/viewport.js +118 -0
- package/lib/handlers/entity/viewport.js.map +7 -0
- package/lib/handlers/header.cjs +92 -0
- package/lib/handlers/header.cjs.map +7 -0
- package/lib/handlers/header.js +72 -0
- package/lib/handlers/header.js.map +7 -0
- package/lib/handlers/objects.cjs +170 -0
- package/lib/handlers/objects.cjs.map +7 -0
- package/lib/handlers/objects.js +150 -0
- package/lib/handlers/objects.js.map +7 -0
- package/lib/handlers/tables.cjs +587 -0
- package/lib/handlers/tables.cjs.map +7 -0
- package/lib/handlers/tables.js +557 -0
- package/lib/handlers/tables.js.map +7 -0
- package/lib/index.cjs +60 -0
- package/lib/index.cjs.map +7 -0
- package/lib/index.js +19 -0
- package/lib/index.js.map +7 -0
- package/lib/parseString.cjs +118 -0
- package/lib/parseString.cjs.map +7 -0
- package/lib/parseString.js +88 -0
- package/lib/parseString.js.map +7 -0
- package/lib/toPolylines.cjs +69 -0
- package/lib/toPolylines.cjs.map +7 -0
- package/lib/toPolylines.js +39 -0
- package/lib/toPolylines.js.map +7 -0
- package/lib/toSVG.cjs +395 -0
- package/lib/toSVG.cjs.map +7 -0
- package/lib/toSVG.js +361 -0
- package/lib/toSVG.js.map +7 -0
- package/lib/types/arc-entity.cjs +17 -0
- package/lib/types/arc-entity.cjs.map +7 -0
- package/lib/types/arc-entity.js +1 -0
- package/lib/types/arc-entity.js.map +7 -0
- package/lib/types/base-entity.cjs +17 -0
- package/lib/types/base-entity.cjs.map +7 -0
- package/lib/types/base-entity.js +1 -0
- package/lib/types/base-entity.js.map +7 -0
- package/lib/types/circle-entity.cjs +17 -0
- package/lib/types/circle-entity.cjs.map +7 -0
- package/lib/types/circle-entity.js +1 -0
- package/lib/types/circle-entity.js.map +7 -0
- package/lib/types/common.cjs +17 -0
- package/lib/types/common.cjs.map +7 -0
- package/lib/types/common.js +1 -0
- package/lib/types/common.js.map +7 -0
- package/lib/types/dimension-entity.cjs +17 -0
- package/lib/types/dimension-entity.cjs.map +7 -0
- package/lib/types/dimension-entity.js +1 -0
- package/lib/types/dimension-entity.js.map +7 -0
- package/lib/types/dxf.cjs +17 -0
- package/lib/types/dxf.cjs.map +7 -0
- package/lib/types/dxf.js +1 -0
- package/lib/types/dxf.js.map +7 -0
- package/lib/types/ellipse-entity.cjs +17 -0
- package/lib/types/ellipse-entity.cjs.map +7 -0
- package/lib/types/ellipse-entity.js +1 -0
- package/lib/types/ellipse-entity.js.map +7 -0
- package/lib/types/entity.cjs +17 -0
- package/lib/types/entity.cjs.map +7 -0
- package/lib/types/entity.js +1 -0
- package/lib/types/entity.js.map +7 -0
- package/lib/types/handler-internal.cjs +17 -0
- package/lib/types/handler-internal.cjs.map +7 -0
- package/lib/types/handler-internal.js +1 -0
- package/lib/types/handler-internal.js.map +7 -0
- package/lib/types/handler.cjs +17 -0
- package/lib/types/handler.cjs.map +7 -0
- package/lib/types/handler.js +1 -0
- package/lib/types/handler.js.map +7 -0
- package/lib/types/hatch-entity.cjs +17 -0
- package/lib/types/hatch-entity.cjs.map +7 -0
- package/lib/types/hatch-entity.js +1 -0
- package/lib/types/hatch-entity.js.map +7 -0
- package/lib/types/helper.cjs +17 -0
- package/lib/types/helper.cjs.map +7 -0
- package/lib/types/helper.js +1 -0
- package/lib/types/helper.js.map +7 -0
- package/lib/types/index.cjs +77 -0
- package/lib/types/index.cjs.map +7 -0
- package/lib/types/index.js +29 -0
- package/lib/types/index.js.map +7 -0
- package/lib/types/insert-entity.cjs +17 -0
- package/lib/types/insert-entity.cjs.map +7 -0
- package/lib/types/insert-entity.js +1 -0
- package/lib/types/insert-entity.js.map +7 -0
- package/lib/types/layer-groups.cjs +17 -0
- package/lib/types/layer-groups.cjs.map +7 -0
- package/lib/types/layer-groups.js +1 -0
- package/lib/types/layer-groups.js.map +7 -0
- package/lib/types/line-entity.cjs +17 -0
- package/lib/types/line-entity.cjs.map +7 -0
- package/lib/types/line-entity.js +1 -0
- package/lib/types/line-entity.js.map +7 -0
- package/lib/types/mtext-entity.cjs +17 -0
- package/lib/types/mtext-entity.cjs.map +7 -0
- package/lib/types/mtext-entity.js +1 -0
- package/lib/types/mtext-entity.js.map +7 -0
- package/lib/types/ole2frame-entity.cjs +17 -0
- package/lib/types/ole2frame-entity.cjs.map +7 -0
- package/lib/types/ole2frame-entity.js +1 -0
- package/lib/types/ole2frame-entity.js.map +7 -0
- package/lib/types/options.cjs +17 -0
- package/lib/types/options.cjs.map +7 -0
- package/lib/types/options.js +1 -0
- package/lib/types/options.js.map +7 -0
- package/lib/types/point-entity.cjs +17 -0
- package/lib/types/point-entity.cjs.map +7 -0
- package/lib/types/point-entity.js +1 -0
- package/lib/types/point-entity.js.map +7 -0
- package/lib/types/polyline-entity.cjs +17 -0
- package/lib/types/polyline-entity.cjs.map +7 -0
- package/lib/types/polyline-entity.js +1 -0
- package/lib/types/polyline-entity.js.map +7 -0
- package/lib/types/polylines.cjs +17 -0
- package/lib/types/polylines.cjs.map +7 -0
- package/lib/types/polylines.js +1 -0
- package/lib/types/polylines.js.map +7 -0
- package/lib/types/solid-entity.cjs +17 -0
- package/lib/types/solid-entity.cjs.map +7 -0
- package/lib/types/solid-entity.js +1 -0
- package/lib/types/solid-entity.js.map +7 -0
- package/lib/types/spline-entity.cjs +17 -0
- package/lib/types/spline-entity.cjs.map +7 -0
- package/lib/types/spline-entity.js +1 -0
- package/lib/types/spline-entity.js.map +7 -0
- package/lib/types/svg.cjs +17 -0
- package/lib/types/svg.cjs.map +7 -0
- package/lib/types/svg.js +1 -0
- package/lib/types/svg.js.map +7 -0
- package/lib/types/tables.cjs +17 -0
- package/lib/types/tables.cjs.map +7 -0
- package/lib/types/tables.js +1 -0
- package/lib/types/tables.js.map +7 -0
- package/lib/types/text-entity.cjs +17 -0
- package/lib/types/text-entity.cjs.map +7 -0
- package/lib/types/text-entity.js +1 -0
- package/lib/types/text-entity.js.map +7 -0
- package/lib/types/util-types.cjs +17 -0
- package/lib/types/util-types.cjs.map +7 -0
- package/lib/types/util-types.js +1 -0
- package/lib/types/util-types.js.map +7 -0
- package/lib/types/vecks.d.cjs +2 -0
- package/lib/types/vecks.d.cjs.map +7 -0
- package/lib/types/vecks.d.js +1 -0
- package/lib/types/vecks.d.js.map +7 -0
- package/lib/types/viewport-entity.cjs +17 -0
- package/lib/types/viewport-entity.cjs.map +7 -0
- package/lib/types/viewport-entity.js +1 -0
- package/lib/types/viewport-entity.js.map +7 -0
- package/lib/types.cjs +23 -0
- package/lib/types.cjs.map +7 -0
- package/lib/types.js +2 -0
- package/lib/types.js.map +7 -0
- package/lib/util/bSpline.cjs +95 -0
- package/lib/util/bSpline.cjs.map +7 -0
- package/lib/util/bSpline.js +65 -0
- package/lib/util/bSpline.js.map +7 -0
- package/lib/util/colors.cjs +283 -0
- package/lib/util/colors.cjs.map +7 -0
- package/lib/util/colors.js +263 -0
- package/lib/util/colors.js.map +7 -0
- package/lib/util/createArcForLWPolyline.cjs +84 -0
- package/lib/util/createArcForLWPolyline.cjs.map +7 -0
- package/lib/util/createArcForLWPolyline.js +64 -0
- package/lib/util/createArcForLWPolyline.js.map +7 -0
- package/lib/util/dxfColorToRGB.cjs +115 -0
- package/lib/util/dxfColorToRGB.cjs.map +7 -0
- package/lib/util/dxfColorToRGB.js +90 -0
- package/lib/util/dxfColorToRGB.js.map +7 -0
- package/lib/util/insertKnot.cjs +77 -0
- package/lib/util/insertKnot.cjs.map +7 -0
- package/lib/util/insertKnot.js +57 -0
- package/lib/util/insertKnot.js.map +7 -0
- package/lib/util/logger.cjs +53 -0
- package/lib/util/logger.cjs.map +7 -0
- package/lib/util/logger.js +23 -0
- package/lib/util/logger.js.map +7 -0
- package/lib/util/rgbToColorAttribute.cjs +32 -0
- package/lib/util/rgbToColorAttribute.cjs.map +7 -0
- package/lib/util/rgbToColorAttribute.js +12 -0
- package/lib/util/rgbToColorAttribute.js.map +7 -0
- package/lib/util/rotate.cjs +30 -0
- package/lib/util/rotate.cjs.map +7 -0
- package/lib/util/rotate.js +10 -0
- package/lib/util/rotate.js.map +7 -0
- package/lib/util/round10.cjs +38 -0
- package/lib/util/round10.cjs.map +7 -0
- package/lib/util/round10.js +18 -0
- package/lib/util/round10.js.map +7 -0
- package/lib/util/toPiecewiseBezier.cjs +90 -0
- package/lib/util/toPiecewiseBezier.cjs.map +7 -0
- package/lib/util/toPiecewiseBezier.js +54 -0
- package/lib/util/toPiecewiseBezier.js.map +7 -0
- package/lib/util/transformBoundingBoxAndElement.cjs +80 -0
- package/lib/util/transformBoundingBoxAndElement.cjs.map +7 -0
- package/lib/util/transformBoundingBoxAndElement.js +60 -0
- package/lib/util/transformBoundingBoxAndElement.js.map +7 -0
- package/package.json +127 -0
- package/src/Helper.ts +71 -0
- package/src/applyTransforms.ts +54 -0
- package/src/cli.ts +41 -0
- package/src/config.ts +10 -0
- package/src/constants.ts +14 -0
- package/src/denormalise.ts +153 -0
- package/src/dimensionToSVG.ts +427 -0
- package/src/entityToPolyline.ts +338 -0
- package/src/getRGBForEntity.ts +28 -0
- package/src/groupEntitiesByLayer.ts +14 -0
- package/src/handlers/blocks.ts +65 -0
- package/src/handlers/entities.ts +111 -0
- package/src/handlers/entity/arc.ts +61 -0
- package/src/handlers/entity/attdef.ts +284 -0
- package/src/handlers/entity/attrib.ts +29 -0
- package/src/handlers/entity/circle.ts +47 -0
- package/src/handlers/entity/common.ts +79 -0
- package/src/handlers/entity/dimension.ts +217 -0
- package/src/handlers/entity/ellipse.ts +55 -0
- package/src/handlers/entity/hatch.ts +471 -0
- package/src/handlers/entity/insert.ts +73 -0
- package/src/handlers/entity/line.ts +56 -0
- package/src/handlers/entity/lwpolyline.ts +54 -0
- package/src/handlers/entity/mtext.ts +150 -0
- package/src/handlers/entity/ole2Frame.ts +64 -0
- package/src/handlers/entity/point.ts +47 -0
- package/src/handlers/entity/polyline.ts +49 -0
- package/src/handlers/entity/solid.ts +73 -0
- package/src/handlers/entity/spline.ts +103 -0
- package/src/handlers/entity/text.ts +83 -0
- package/src/handlers/entity/threeDFace.ts +69 -0
- package/src/handlers/entity/vertex.ts +55 -0
- package/src/handlers/entity/viewport.ts +119 -0
- package/src/handlers/header.ts +73 -0
- package/src/handlers/objects.ts +152 -0
- package/src/handlers/tables.ts +581 -0
- package/src/index.ts +19 -0
- package/src/parseString.ts +97 -0
- package/src/toPolylines.ts +47 -0
- package/src/toSVG.ts +518 -0
- package/src/types/README.md +91 -0
- package/src/types/arc-entity.ts +10 -0
- package/src/types/base-entity.ts +25 -0
- package/src/types/circle-entity.ts +8 -0
- package/src/types/common.ts +37 -0
- package/src/types/dimension-entity.ts +23 -0
- package/src/types/dxf.ts +64 -0
- package/src/types/ellipse-entity.ts +13 -0
- package/src/types/entity.ts +32 -0
- package/src/types/handler-internal.ts +51 -0
- package/src/types/handler.ts +10 -0
- package/src/types/hatch-entity.ts +127 -0
- package/src/types/helper.ts +12 -0
- package/src/types/index.ts +53 -0
- package/src/types/insert-entity.ts +19 -0
- package/src/types/layer-groups.ts +8 -0
- package/src/types/line-entity.ts +10 -0
- package/src/types/mtext-entity.ts +35 -0
- package/src/types/ole2frame-entity.ts +35 -0
- package/src/types/options.ts +17 -0
- package/src/types/point-entity.ts +7 -0
- package/src/types/polyline-entity.ts +20 -0
- package/src/types/polylines.ts +22 -0
- package/src/types/solid-entity.ts +9 -0
- package/src/types/spline-entity.ts +12 -0
- package/src/types/svg.ts +31 -0
- package/src/types/tables.ts +414 -0
- package/src/types/text-entity.ts +23 -0
- package/src/types/util-types.ts +27 -0
- package/src/types/vecks.d.ts +29 -0
- package/src/types/viewport-entity.ts +81 -0
- package/src/types.ts +5 -0
- package/src/util/bSpline.ts +97 -0
- package/src/util/colors.ts +266 -0
- package/src/util/createArcForLWPolyline.ts +93 -0
- package/src/util/diagram.png +0 -0
- package/src/util/dxfColorToRGB.ts +106 -0
- package/src/util/insertKnot.ts +69 -0
- package/src/util/logger.ts +23 -0
- package/src/util/rgbToColorAttribute.ts +14 -0
- package/src/util/rotate.ts +14 -0
- package/src/util/round10.ts +24 -0
- package/src/util/toPiecewiseBezier.ts +70 -0
- package/src/util/transformBoundingBoxAndElement.ts +74 -0
- package/tsconfig.json +34 -0
package/lib/toSVG.js
ADDED
|
@@ -0,0 +1,361 @@
|
|
|
1
|
+
import { Box2 } from "vecks";
|
|
2
|
+
import denormalise from "./denormalise";
|
|
3
|
+
import dimensionToSVG from "./dimensionToSVG";
|
|
4
|
+
import entityToPolyline from "./entityToPolyline";
|
|
5
|
+
import getRGBForEntity from "./getRGBForEntity";
|
|
6
|
+
import logger from "./util/logger";
|
|
7
|
+
import rgbToColorAttribute from "./util/rgbToColorAttribute";
|
|
8
|
+
import rotate from "./util/rotate";
|
|
9
|
+
import toPiecewiseBezier, { multiplicity } from "./util/toPiecewiseBezier";
|
|
10
|
+
import transformBoundingBoxAndElement from "./util/transformBoundingBoxAndElement";
|
|
11
|
+
const addFlipXIfApplicable = (entity, { bbox, element }) => {
|
|
12
|
+
if (entity.extrusionZ === -1) {
|
|
13
|
+
return {
|
|
14
|
+
bbox: new Box2().expandByPoint({ x: -bbox.min.x, y: bbox.min.y }).expandByPoint({ x: -bbox.max.x, y: bbox.max.y }),
|
|
15
|
+
element: `<g transform="matrix(-1 0 0 1 0 0)">
|
|
16
|
+
${element}
|
|
17
|
+
</g>`
|
|
18
|
+
};
|
|
19
|
+
} else {
|
|
20
|
+
return { bbox, element };
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
const polyline = (entity) => {
|
|
24
|
+
const vertices = entityToPolyline(entity);
|
|
25
|
+
const bbox = vertices.reduce(
|
|
26
|
+
(acc, [x, y]) => acc.expandByPoint({ x, y }),
|
|
27
|
+
new Box2()
|
|
28
|
+
);
|
|
29
|
+
const d = vertices.reduce((acc, point, i) => {
|
|
30
|
+
acc += i === 0 ? "M" : "L";
|
|
31
|
+
acc += point[0] + "," + point[1];
|
|
32
|
+
return acc;
|
|
33
|
+
}, "");
|
|
34
|
+
return transformBoundingBoxAndElement(
|
|
35
|
+
bbox,
|
|
36
|
+
`<path d="${d}" />`,
|
|
37
|
+
entity.transforms ?? []
|
|
38
|
+
);
|
|
39
|
+
};
|
|
40
|
+
const lwpolyline = (entity) => {
|
|
41
|
+
const vertices = entityToPolyline(entity);
|
|
42
|
+
const bbox0 = vertices.reduce(
|
|
43
|
+
(acc, [x, y]) => acc.expandByPoint({ x, y }),
|
|
44
|
+
new Box2()
|
|
45
|
+
);
|
|
46
|
+
const d = vertices.reduce((acc, point, i) => {
|
|
47
|
+
acc += i === 0 ? "M" : "L";
|
|
48
|
+
acc += point[0] + "," + point[1];
|
|
49
|
+
return acc;
|
|
50
|
+
}, "");
|
|
51
|
+
const element0 = `<path d="${d}" />`;
|
|
52
|
+
const { bbox, element } = addFlipXIfApplicable(entity, {
|
|
53
|
+
bbox: bbox0,
|
|
54
|
+
element: element0
|
|
55
|
+
});
|
|
56
|
+
return transformBoundingBoxAndElement(
|
|
57
|
+
bbox,
|
|
58
|
+
element,
|
|
59
|
+
entity.transforms ?? []
|
|
60
|
+
);
|
|
61
|
+
};
|
|
62
|
+
const circle = (entity) => {
|
|
63
|
+
const bbox0 = new Box2().expandByPoint({
|
|
64
|
+
x: entity.x + entity.r,
|
|
65
|
+
y: entity.y + entity.r
|
|
66
|
+
}).expandByPoint({
|
|
67
|
+
x: entity.x - entity.r,
|
|
68
|
+
y: entity.y - entity.r
|
|
69
|
+
});
|
|
70
|
+
const element0 = `<circle cx="${entity.x}" cy="${entity.y}" r="${entity.r}" />`;
|
|
71
|
+
const { bbox, element } = addFlipXIfApplicable(entity, {
|
|
72
|
+
bbox: bbox0,
|
|
73
|
+
element: element0
|
|
74
|
+
});
|
|
75
|
+
return transformBoundingBoxAndElement(bbox, element, entity.transforms ?? []);
|
|
76
|
+
};
|
|
77
|
+
const ellipseOrArc = (params) => {
|
|
78
|
+
const { cx, cy, majorX, majorY, axisRatio, startAngle, endAngle } = params;
|
|
79
|
+
const rx = Math.hypot(majorX, majorY);
|
|
80
|
+
const ry = axisRatio * rx;
|
|
81
|
+
const rotationAngle = -Math.atan2(-majorY, majorX);
|
|
82
|
+
const bbox = bboxEllipseOrArc(params);
|
|
83
|
+
if (Math.abs(startAngle - endAngle) < 1e-9 || Math.abs(startAngle - endAngle + Math.PI * 2) < 1e-9) {
|
|
84
|
+
const element = `<g transform="rotate(${rotationAngle / Math.PI * 180} ${cx}, ${cy})">
|
|
85
|
+
<ellipse cx="${cx}" cy="${cy}" rx="${rx}" ry="${ry}" />
|
|
86
|
+
</g>`;
|
|
87
|
+
return { bbox, element };
|
|
88
|
+
} else {
|
|
89
|
+
const startOffset = rotate(
|
|
90
|
+
{
|
|
91
|
+
x: Math.cos(startAngle) * rx,
|
|
92
|
+
y: Math.sin(startAngle) * ry
|
|
93
|
+
},
|
|
94
|
+
rotationAngle
|
|
95
|
+
);
|
|
96
|
+
const startPoint = {
|
|
97
|
+
x: cx + startOffset.x,
|
|
98
|
+
y: cy + startOffset.y
|
|
99
|
+
};
|
|
100
|
+
const endOffset = rotate(
|
|
101
|
+
{
|
|
102
|
+
x: Math.cos(endAngle) * rx,
|
|
103
|
+
y: Math.sin(endAngle) * ry
|
|
104
|
+
},
|
|
105
|
+
rotationAngle
|
|
106
|
+
);
|
|
107
|
+
const endPoint = {
|
|
108
|
+
x: cx + endOffset.x,
|
|
109
|
+
y: cy + endOffset.y
|
|
110
|
+
};
|
|
111
|
+
const adjustedEndAngle = endAngle < startAngle ? endAngle + Math.PI * 2 : endAngle;
|
|
112
|
+
const largeArcFlag = adjustedEndAngle - startAngle < Math.PI ? 0 : 1;
|
|
113
|
+
const d = `M ${startPoint.x} ${startPoint.y} A ${rx} ${ry} ${rotationAngle / Math.PI * 180} ${largeArcFlag} 1 ${endPoint.x} ${endPoint.y}`;
|
|
114
|
+
const element = `<path d="${d}" />`;
|
|
115
|
+
return { bbox, element };
|
|
116
|
+
}
|
|
117
|
+
};
|
|
118
|
+
const bboxEllipseOrArc = (params) => {
|
|
119
|
+
const { cx, cy, majorX, majorY, axisRatio } = params;
|
|
120
|
+
let { startAngle, endAngle } = params;
|
|
121
|
+
while (startAngle < 0) startAngle += Math.PI * 2;
|
|
122
|
+
while (endAngle <= startAngle) endAngle += Math.PI * 2;
|
|
123
|
+
const angles = [];
|
|
124
|
+
if (Math.abs(majorX) < 1e-12 || Math.abs(majorY) < 1e-12) {
|
|
125
|
+
for (let i = 0; i < 4; i++) {
|
|
126
|
+
angles.push(i / 2 * Math.PI);
|
|
127
|
+
}
|
|
128
|
+
} else {
|
|
129
|
+
angles[0] = Math.atan(-majorY * axisRatio / majorX) - Math.PI;
|
|
130
|
+
angles[1] = Math.atan(majorX * axisRatio / majorY) - Math.PI;
|
|
131
|
+
angles[2] = angles[0] - Math.PI;
|
|
132
|
+
angles[3] = angles[1] - Math.PI;
|
|
133
|
+
}
|
|
134
|
+
for (let i = 4; i >= 0; i--) {
|
|
135
|
+
while (angles[i] < startAngle) angles[i] += Math.PI * 2;
|
|
136
|
+
if (angles[i] > endAngle) {
|
|
137
|
+
angles.splice(i, 1);
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
angles.push(startAngle, endAngle);
|
|
141
|
+
const pts = angles.map((a) => ({
|
|
142
|
+
x: Math.cos(a),
|
|
143
|
+
y: Math.sin(a)
|
|
144
|
+
}));
|
|
145
|
+
const M = [
|
|
146
|
+
[majorX, -majorY * axisRatio],
|
|
147
|
+
[majorY, majorX * axisRatio]
|
|
148
|
+
];
|
|
149
|
+
const rotatedPts = pts.map((p) => ({
|
|
150
|
+
x: p.x * M[0][0] + p.y * M[0][1] + cx,
|
|
151
|
+
y: p.x * M[1][0] + p.y * M[1][1] + cy
|
|
152
|
+
}));
|
|
153
|
+
const bbox = rotatedPts.reduce((acc, p) => {
|
|
154
|
+
acc.expandByPoint(p);
|
|
155
|
+
return acc;
|
|
156
|
+
}, new Box2());
|
|
157
|
+
return bbox;
|
|
158
|
+
};
|
|
159
|
+
const ellipse = (entity) => {
|
|
160
|
+
const { bbox: bbox0, element: element0 } = ellipseOrArc({
|
|
161
|
+
cx: entity.x,
|
|
162
|
+
cy: entity.y,
|
|
163
|
+
majorX: entity.majorX,
|
|
164
|
+
majorY: entity.majorY,
|
|
165
|
+
axisRatio: entity.axisRatio,
|
|
166
|
+
startAngle: entity.startAngle,
|
|
167
|
+
endAngle: entity.endAngle
|
|
168
|
+
});
|
|
169
|
+
const { bbox, element } = addFlipXIfApplicable(entity, {
|
|
170
|
+
bbox: bbox0,
|
|
171
|
+
element: element0
|
|
172
|
+
});
|
|
173
|
+
return transformBoundingBoxAndElement(bbox, element, entity.transforms ?? []);
|
|
174
|
+
};
|
|
175
|
+
const arc = (entity) => {
|
|
176
|
+
const { bbox: bbox0, element: element0 } = ellipseOrArc({
|
|
177
|
+
cx: entity.x,
|
|
178
|
+
cy: entity.y,
|
|
179
|
+
majorX: entity.r,
|
|
180
|
+
majorY: 0,
|
|
181
|
+
axisRatio: 1,
|
|
182
|
+
startAngle: entity.startAngle,
|
|
183
|
+
endAngle: entity.endAngle,
|
|
184
|
+
flipX: entity.extrusionZ === -1
|
|
185
|
+
});
|
|
186
|
+
const { bbox, element } = addFlipXIfApplicable(entity, {
|
|
187
|
+
bbox: bbox0,
|
|
188
|
+
element: element0
|
|
189
|
+
});
|
|
190
|
+
return transformBoundingBoxAndElement(bbox, element, entity.transforms ?? []);
|
|
191
|
+
};
|
|
192
|
+
const text = (entity) => {
|
|
193
|
+
const x = entity.x ?? 0;
|
|
194
|
+
const y = entity.y ?? 0;
|
|
195
|
+
const height = entity.textHeight ?? 1;
|
|
196
|
+
const rotation = entity.rotation ?? 0;
|
|
197
|
+
const content = entity.string ?? "";
|
|
198
|
+
const textWidth = content.length * height * 0.6;
|
|
199
|
+
const bbox0 = new Box2().expandByPoint({ x, y }).expandByPoint({ x: x + textWidth, y: y + height });
|
|
200
|
+
const rotationDegrees = rotation * 180 / Math.PI;
|
|
201
|
+
const element0 = `<text x="${x}" y="${y}" font-size="${height}" transform="rotate(${-rotationDegrees} ${x} ${y}) scale(1,-1) translate(0 ${-2 * y})">${content}</text>`;
|
|
202
|
+
const { bbox, element } = addFlipXIfApplicable(entity, {
|
|
203
|
+
bbox: bbox0,
|
|
204
|
+
element: element0
|
|
205
|
+
});
|
|
206
|
+
return transformBoundingBoxAndElement(bbox, element, entity.transforms ?? []);
|
|
207
|
+
};
|
|
208
|
+
const mtext = (entity) => {
|
|
209
|
+
const x = entity.x ?? 0;
|
|
210
|
+
const y = entity.y ?? 0;
|
|
211
|
+
const height = entity.nominalTextHeight ?? entity.textHeight ?? 1;
|
|
212
|
+
const content = entity.string ?? "";
|
|
213
|
+
const textWidth = entity.refRectangleWidth ?? content.length * height * 0.6;
|
|
214
|
+
const bbox0 = new Box2().expandByPoint({ x, y }).expandByPoint({ x: x + textWidth, y: y + height });
|
|
215
|
+
const rotation = entity.xAxisX !== void 0 && entity.xAxisY !== void 0 ? Math.atan2(entity.xAxisY, entity.xAxisX) : 0;
|
|
216
|
+
const rotationDegrees = rotation * 180 / Math.PI;
|
|
217
|
+
const element0 = `<text x="${x}" y="${y}" font-size="${height}" transform="rotate(${-rotationDegrees} ${x} ${y}) scale(1,-1) translate(0 ${-2 * y})">${content}</text>`;
|
|
218
|
+
const { bbox, element } = addFlipXIfApplicable(entity, {
|
|
219
|
+
bbox: bbox0,
|
|
220
|
+
element: element0
|
|
221
|
+
});
|
|
222
|
+
return transformBoundingBoxAndElement(bbox, element, entity.transforms ?? []);
|
|
223
|
+
};
|
|
224
|
+
const dimension = (entity, dimStyle) => {
|
|
225
|
+
const result = dimensionToSVG(entity, dimStyle);
|
|
226
|
+
return transformBoundingBoxAndElement(
|
|
227
|
+
result.bbox,
|
|
228
|
+
result.element,
|
|
229
|
+
entity.transforms ?? []
|
|
230
|
+
);
|
|
231
|
+
};
|
|
232
|
+
const piecewiseToPaths = (k, knots, controlPoints) => {
|
|
233
|
+
const paths = [];
|
|
234
|
+
let controlPointIndex = 0;
|
|
235
|
+
let knotIndex = k;
|
|
236
|
+
while (knotIndex < knots.length - k + 1) {
|
|
237
|
+
const m = multiplicity(knots, knotIndex);
|
|
238
|
+
const cp = controlPoints.slice(controlPointIndex, controlPointIndex + k);
|
|
239
|
+
if (k === 4) {
|
|
240
|
+
paths.push(
|
|
241
|
+
`<path d="M ${cp[0].x} ${cp[0].y} C ${cp[1].x} ${cp[1].y} ${cp[2].x} ${cp[2].y} ${cp[3].x} ${cp[3].y}" />`
|
|
242
|
+
);
|
|
243
|
+
} else if (k === 3) {
|
|
244
|
+
paths.push(
|
|
245
|
+
`<path d="M ${cp[0].x} ${cp[0].y} Q ${cp[1].x} ${cp[1].y} ${cp[2].x} ${cp[2].y}" />`
|
|
246
|
+
);
|
|
247
|
+
}
|
|
248
|
+
controlPointIndex += m;
|
|
249
|
+
knotIndex += m;
|
|
250
|
+
}
|
|
251
|
+
return paths;
|
|
252
|
+
};
|
|
253
|
+
const bezier = (entity) => {
|
|
254
|
+
let bbox = new Box2();
|
|
255
|
+
for (const p of entity.controlPoints) {
|
|
256
|
+
bbox = bbox.expandByPoint(p);
|
|
257
|
+
}
|
|
258
|
+
const k = entity.degree + 1;
|
|
259
|
+
const piecewise = toPiecewiseBezier(k, entity.controlPoints, entity.knots);
|
|
260
|
+
const paths = piecewiseToPaths(k, piecewise.knots, piecewise.controlPoints);
|
|
261
|
+
const element = `<g>${paths.join("")}</g>`;
|
|
262
|
+
return transformBoundingBoxAndElement(bbox, element, entity.transforms ?? []);
|
|
263
|
+
};
|
|
264
|
+
const entityToBoundsAndElement = (entity, dimStyles) => {
|
|
265
|
+
switch (entity.type) {
|
|
266
|
+
case "CIRCLE":
|
|
267
|
+
return circle(entity);
|
|
268
|
+
case "ELLIPSE":
|
|
269
|
+
return ellipse(entity);
|
|
270
|
+
case "ARC":
|
|
271
|
+
return arc(entity);
|
|
272
|
+
case "TEXT":
|
|
273
|
+
return text(entity);
|
|
274
|
+
case "MTEXT":
|
|
275
|
+
return mtext(entity);
|
|
276
|
+
case "DIMENSION": {
|
|
277
|
+
const dimEntity = entity;
|
|
278
|
+
const styleName = typeof dimEntity.styleName === "string" ? dimEntity.styleName : void 0;
|
|
279
|
+
const dimStyle = styleName && dimStyles ? dimStyles[styleName] : void 0;
|
|
280
|
+
return dimension(dimEntity, dimStyle);
|
|
281
|
+
}
|
|
282
|
+
case "SPLINE": {
|
|
283
|
+
const splineEntity = entity;
|
|
284
|
+
const hasWeights = splineEntity.weights?.some((w) => w !== 1);
|
|
285
|
+
if ((splineEntity.degree === 2 || splineEntity.degree === 3) && !hasWeights) {
|
|
286
|
+
try {
|
|
287
|
+
return bezier(splineEntity);
|
|
288
|
+
} catch (err) {
|
|
289
|
+
const error = err;
|
|
290
|
+
logger.warn("bezier conversion failed, using polyline:", error.message);
|
|
291
|
+
return polyline(entity);
|
|
292
|
+
}
|
|
293
|
+
} else {
|
|
294
|
+
return polyline(entity);
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
case "LINE":
|
|
298
|
+
case "POLYLINE": {
|
|
299
|
+
return polyline(entity);
|
|
300
|
+
}
|
|
301
|
+
case "LWPOLYLINE": {
|
|
302
|
+
return lwpolyline(entity);
|
|
303
|
+
}
|
|
304
|
+
default:
|
|
305
|
+
logger.warn("entity type not supported in SVG rendering:", entity.type);
|
|
306
|
+
return null;
|
|
307
|
+
}
|
|
308
|
+
};
|
|
309
|
+
function toSVG(parsed) {
|
|
310
|
+
const entities = denormalise(parsed);
|
|
311
|
+
const dimStyles = parsed.tables.dimStyles;
|
|
312
|
+
const { bbox, elements } = entities.reduce(
|
|
313
|
+
(acc, entity) => {
|
|
314
|
+
const rgb = getRGBForEntity(parsed.tables.layers, entity);
|
|
315
|
+
const boundsAndElement = entityToBoundsAndElement(entity, dimStyles);
|
|
316
|
+
if (boundsAndElement) {
|
|
317
|
+
const { bbox: bbox2, element } = boundsAndElement;
|
|
318
|
+
if (bbox2.valid) {
|
|
319
|
+
acc.bbox.expandByPoint(bbox2.min);
|
|
320
|
+
acc.bbox.expandByPoint(bbox2.max);
|
|
321
|
+
}
|
|
322
|
+
acc.elements.push(
|
|
323
|
+
`<g stroke="${rgbToColorAttribute(rgb)}">${element}</g>`
|
|
324
|
+
);
|
|
325
|
+
}
|
|
326
|
+
return acc;
|
|
327
|
+
},
|
|
328
|
+
{
|
|
329
|
+
bbox: new Box2(),
|
|
330
|
+
elements: []
|
|
331
|
+
}
|
|
332
|
+
);
|
|
333
|
+
const viewBox = bbox.valid ? {
|
|
334
|
+
x: bbox.min.x,
|
|
335
|
+
y: -bbox.max.y,
|
|
336
|
+
width: bbox.max.x - bbox.min.x,
|
|
337
|
+
height: bbox.max.y - bbox.min.y
|
|
338
|
+
} : {
|
|
339
|
+
x: 0,
|
|
340
|
+
y: 0,
|
|
341
|
+
width: 0,
|
|
342
|
+
height: 0
|
|
343
|
+
};
|
|
344
|
+
return `<?xml version="1.0"?>
|
|
345
|
+
<svg
|
|
346
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
347
|
+
xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1"
|
|
348
|
+
preserveAspectRatio="xMinYMin meet"
|
|
349
|
+
viewBox="${viewBox.x} ${viewBox.y} ${viewBox.width} ${viewBox.height}"
|
|
350
|
+
width="100%" height="100%"
|
|
351
|
+
>
|
|
352
|
+
<g stroke="#000000" stroke-width="0.1%" fill="none" transform="matrix(1,0,0,-1,0,0)">
|
|
353
|
+
${elements.join("\n")}
|
|
354
|
+
</g>
|
|
355
|
+
</svg>`;
|
|
356
|
+
}
|
|
357
|
+
export {
|
|
358
|
+
toSVG as default,
|
|
359
|
+
piecewiseToPaths
|
|
360
|
+
};
|
|
361
|
+
//# sourceMappingURL=toSVG.js.map
|
package/lib/toSVG.js.map
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/toSVG.ts"],
|
|
4
|
+
"sourcesContent": ["import { Box2 } from 'vecks'\n\nimport denormalise from './denormalise'\nimport dimensionToSVG from './dimensionToSVG'\nimport entityToPolyline from './entityToPolyline'\nimport getRGBForEntity from './getRGBForEntity'\nimport logger from './util/logger'\nimport rgbToColorAttribute from './util/rgbToColorAttribute'\nimport rotate from './util/rotate'\nimport toPiecewiseBezier, { multiplicity } from './util/toPiecewiseBezier'\nimport transformBoundingBoxAndElement from './util/transformBoundingBoxAndElement'\n\nimport type {\n ArcEntity,\n CircleEntity,\n DimensionEntity,\n EllipseEntity,\n Entity,\n MTextEntity,\n ParsedDXF,\n SplineEntity,\n TextEntity,\n} from './types'\nimport type { BoundsAndElement } from './types/svg'\n\nconst addFlipXIfApplicable = (\n entity: Entity,\n { bbox, element }: BoundsAndElement,\n): BoundsAndElement => {\n if (entity.extrusionZ === -1) {\n return {\n bbox: new Box2()\n .expandByPoint({ x: -bbox.min.x, y: bbox.min.y })\n .expandByPoint({ x: -bbox.max.x, y: bbox.max.y }),\n element: `<g transform=\"matrix(-1 0 0 1 0 0)\">\n ${element}\n </g>`,\n }\n } else {\n return { bbox, element }\n }\n}\n\n/**\n * Create a <path /> element. Interpolates curved entities.\n */\nconst polyline = (entity: Entity): BoundsAndElement => {\n const vertices = entityToPolyline(entity as any)\n const bbox = vertices.reduce(\n (acc, [x, y]) => acc.expandByPoint({ x, y }),\n new Box2(),\n )\n const d = vertices.reduce((acc, point, i) => {\n acc += i === 0 ? 'M' : 'L'\n acc += point[0] + ',' + point[1]\n return acc\n }, '')\n // Empirically it appears that flipping horizontally does not apply to polyline\n return transformBoundingBoxAndElement(\n bbox,\n `<path d=\"${d}\" />`,\n entity.transforms ?? [],\n )\n}\n\n/**\n * Create a <path /> element. Interpolates curved entities.\n * lwpolyline is the same as polyline but addFlipXIfApplicable does apply\n */\nconst lwpolyline = (entity: Entity): BoundsAndElement => {\n const vertices = entityToPolyline(entity as any)\n const bbox0 = vertices.reduce(\n (acc, [x, y]) => acc.expandByPoint({ x, y }),\n new Box2(),\n )\n const d = vertices.reduce((acc, point, i) => {\n acc += i === 0 ? 'M' : 'L'\n acc += point[0] + ',' + point[1]\n return acc\n }, '')\n const element0 = `<path d=\"${d}\" />`\n const { bbox, element } = addFlipXIfApplicable(entity, {\n bbox: bbox0,\n element: element0,\n })\n return transformBoundingBoxAndElement(\n bbox,\n element,\n entity.transforms ?? [],\n )\n}\n\n\n/**\n * Create a <circle /> element for the CIRCLE entity.\n */\nconst circle = (entity: CircleEntity): BoundsAndElement => {\n const bbox0 = new Box2()\n .expandByPoint({\n x: entity.x + entity.r,\n y: entity.y + entity.r,\n })\n .expandByPoint({\n x: entity.x - entity.r,\n y: entity.y - entity.r,\n })\n const element0 = `<circle cx=\"${entity.x}\" cy=\"${entity.y}\" r=\"${entity.r}\" />`\n const { bbox, element } = addFlipXIfApplicable(entity, {\n bbox: bbox0,\n element: element0,\n })\n return transformBoundingBoxAndElement(bbox, element, entity.transforms ?? [])\n}\n\ninterface EllipticArcParams {\n cx: number\n cy: number\n majorX: number\n majorY: number\n axisRatio: number\n startAngle: number\n endAngle: number\n flipX?: boolean\n}\n\n/**\n * Create a a <path d=\"A...\" /> or <ellipse /> element for the ARC or ELLIPSE\n * DXF entity (<ellipse /> if start and end point are the same).\n */\nconst ellipseOrArc = (params: EllipticArcParams): BoundsAndElement => {\n const { cx, cy, majorX, majorY, axisRatio, startAngle, endAngle } = params\n const rx = Math.hypot(majorX, majorY)\n const ry = axisRatio * rx\n const rotationAngle = -Math.atan2(-majorY, majorX)\n\n const bbox = bboxEllipseOrArc(params)\n\n if (\n Math.abs(startAngle - endAngle) < 1e-9 ||\n Math.abs(startAngle - endAngle + Math.PI * 2) < 1e-9\n ) {\n // Use a native <ellipse> when start and end angles are the same, and\n // arc paths with same start and end points don't render (at least on Safari)\n const element = `<g transform=\"rotate(${\n (rotationAngle / Math.PI) * 180\n } ${cx}, ${cy})\">\n <ellipse cx=\"${cx}\" cy=\"${cy}\" rx=\"${rx}\" ry=\"${ry}\" />\n </g>`\n return { bbox, element }\n } else {\n const startOffset = rotate(\n {\n x: Math.cos(startAngle) * rx,\n y: Math.sin(startAngle) * ry,\n },\n rotationAngle,\n )\n const startPoint = {\n x: cx + startOffset.x,\n y: cy + startOffset.y,\n }\n const endOffset = rotate(\n {\n x: Math.cos(endAngle) * rx,\n y: Math.sin(endAngle) * ry,\n },\n rotationAngle,\n )\n const endPoint = {\n x: cx + endOffset.x,\n y: cy + endOffset.y,\n }\n const adjustedEndAngle =\n endAngle < startAngle ? endAngle + Math.PI * 2 : endAngle\n const largeArcFlag = adjustedEndAngle - startAngle < Math.PI ? 0 : 1\n const d = `M ${startPoint.x} ${startPoint.y} A ${rx} ${ry} ${\n (rotationAngle / Math.PI) * 180\n } ${largeArcFlag} 1 ${endPoint.x} ${endPoint.y}`\n const element = `<path d=\"${d}\" />`\n return { bbox, element }\n }\n}\n\n/**\n * Compute the bounding box of an elliptical arc, given the DXF entity parameters\n */\n\nconst bboxEllipseOrArc = (params: EllipticArcParams): Box2 => {\n const { cx, cy, majorX, majorY, axisRatio } = params\n let { startAngle, endAngle } = params\n\n // The bounding box will be defined by the starting point of the ellipse, and ending point,\n // and any extrema on the ellipse that are between startAngle and endAngle.\n // The extrema are found by setting either the x or y component of the ellipse's\n // tangent vector to zero and solving for the angle.\n\n // Ensure start and end angles are > 0 and well-ordered\n while (startAngle < 0) startAngle += Math.PI * 2\n while (endAngle <= startAngle) endAngle += Math.PI * 2\n\n // When rotated, the extrema of the ellipse will be found at these angles\n const angles = []\n\n if (Math.abs(majorX) < 1e-12 || Math.abs(majorY) < 1e-12) {\n // Special case for majorX or majorY = 0\n for (let i = 0; i < 4; i++) {\n angles.push((i / 2) * Math.PI)\n }\n } else {\n // reference https://github.com/bjnortier/dxf/issues/47#issuecomment-545915042\n angles[0] = Math.atan((-majorY * axisRatio) / majorX) - Math.PI // Ensure angles < 0\n angles[1] = Math.atan((majorX * axisRatio) / majorY) - Math.PI\n angles[2] = angles[0] - Math.PI\n angles[3] = angles[1] - Math.PI\n }\n\n // Remove angles not falling between start and end\n for (let i = 4; i >= 0; i--) {\n while (angles[i] < startAngle) angles[i] += Math.PI * 2\n if (angles[i] > endAngle) {\n angles.splice(i, 1)\n }\n }\n\n // Also to consider are the starting and ending points:\n angles.push(startAngle, endAngle)\n\n // Compute points lying on the unit circle at these angles\n const pts = angles.map((a) => ({\n x: Math.cos(a),\n y: Math.sin(a),\n }))\n\n // Transformation matrix, formed by the major and minor axes\n const M = [\n [majorX, -majorY * axisRatio],\n [majorY, majorX * axisRatio],\n ]\n\n // Rotate, scale, and translate points\n const rotatedPts = pts.map((p) => ({\n x: p.x * M[0][0] + p.y * M[0][1] + cx,\n y: p.x * M[1][0] + p.y * M[1][1] + cy,\n }))\n\n // Compute extents of bounding box\n const bbox = rotatedPts.reduce((acc, p) => {\n acc.expandByPoint(p)\n return acc\n }, new Box2())\n\n return bbox\n}\n\n/**\n * An ELLIPSE is defined by the major axis, convert to X and Y radius with\n * a rotation angle\n */\nconst ellipse = (entity: EllipseEntity): BoundsAndElement => {\n const { bbox: bbox0, element: element0 } = ellipseOrArc({\n cx: entity.x,\n cy: entity.y,\n majorX: entity.majorX,\n majorY: entity.majorY,\n axisRatio: entity.axisRatio,\n startAngle: entity.startAngle,\n endAngle: entity.endAngle,\n })\n const { bbox, element } = addFlipXIfApplicable(entity, {\n bbox: bbox0,\n element: element0,\n })\n return transformBoundingBoxAndElement(bbox, element, entity.transforms ?? [])\n}\n\n/**\n * An ARC is an ellipse with equal radii\n */\nconst arc = (entity: ArcEntity): BoundsAndElement => {\n const { bbox: bbox0, element: element0 } = ellipseOrArc({\n cx: entity.x,\n cy: entity.y,\n majorX: entity.r,\n majorY: 0,\n axisRatio: 1,\n startAngle: entity.startAngle,\n endAngle: entity.endAngle,\n flipX: entity.extrusionZ === -1,\n })\n const { bbox, element } = addFlipXIfApplicable(entity, {\n bbox: bbox0,\n element: element0,\n })\n return transformBoundingBoxAndElement(bbox, element, entity.transforms ?? [])\n}\n\n/**\n * Create a <text /> element for TEXT entity\n */\nconst text = (entity: TextEntity): BoundsAndElement => {\n const x = entity.x ?? 0\n const y = entity.y ?? 0\n const height = entity.textHeight ?? 1\n const rotation = entity.rotation ?? 0\n const content = entity.string ?? ''\n\n // Estimate text bounding box (approximate)\n const textWidth = content.length * height * 0.6\n const bbox0 = new Box2()\n .expandByPoint({ x, y })\n .expandByPoint({ x: x + textWidth, y: y + height })\n\n const rotationDegrees = (rotation * 180) / Math.PI\n const element0 = `<text x=\"${x}\" y=\"${y}\" font-size=\"${height}\" transform=\"rotate(${-rotationDegrees} ${x} ${y}) scale(1,-1) translate(0 ${-2 * y})\">${content}</text>`\n\n const { bbox, element } = addFlipXIfApplicable(entity, {\n bbox: bbox0,\n element: element0,\n })\n return transformBoundingBoxAndElement(bbox, element, entity.transforms ?? [])\n}\n\n/**\n * Create a <text /> element for MTEXT entity\n */\nconst mtext = (entity: MTextEntity): BoundsAndElement => {\n const x = entity.x ?? 0\n const y = entity.y ?? 0\n const height = entity.nominalTextHeight ?? entity.textHeight ?? 1\n const content = entity.string ?? ''\n\n // Estimate text bounding box (approximate)\n const textWidth = (entity.refRectangleWidth ?? content.length * height * 0.6)\n const bbox0 = new Box2()\n .expandByPoint({ x, y })\n .expandByPoint({ x: x + textWidth, y: y + height })\n\n // Calculate rotation from x-axis direction\n const rotation = entity.xAxisX !== undefined && entity.xAxisY !== undefined\n ? Math.atan2(entity.xAxisY, entity.xAxisX)\n : 0\n const rotationDegrees = (rotation * 180) / Math.PI\n\n const element0 = `<text x=\"${x}\" y=\"${y}\" font-size=\"${height}\" transform=\"rotate(${-rotationDegrees} ${x} ${y}) scale(1,-1) translate(0 ${-2 * y})\">${content}</text>`\n\n const { bbox, element } = addFlipXIfApplicable(entity, {\n bbox: bbox0,\n element: element0,\n })\n return transformBoundingBoxAndElement(bbox, element, entity.transforms ?? [])\n}\n\n/**\n * Create dimension visualization with DIMSTYLE support\n */\nconst dimension = (\n entity: DimensionEntity,\n dimStyle?: any,\n): BoundsAndElement => {\n const result = dimensionToSVG(entity, dimStyle)\n return transformBoundingBoxAndElement(\n result.bbox,\n result.element,\n entity.transforms ?? [],\n )\n}\n\nexport const piecewiseToPaths = (\n k: number,\n knots: number[],\n controlPoints: Array<{ x: number; y: number }>,\n): string[] => {\n const paths: string[] = []\n let controlPointIndex = 0\n let knotIndex = k\n while (knotIndex < knots.length - k + 1) {\n const m = multiplicity(knots, knotIndex)\n const cp = controlPoints.slice(controlPointIndex, controlPointIndex + k)\n if (k === 4) {\n paths.push(\n `<path d=\"M ${cp[0].x} ${cp[0].y} C ${cp[1].x} ${cp[1].y} ${cp[2].x} ${cp[2].y} ${cp[3].x} ${cp[3].y}\" />`,\n )\n } else if (k === 3) {\n paths.push(\n `<path d=\"M ${cp[0].x} ${cp[0].y} Q ${cp[1].x} ${cp[1].y} ${cp[2].x} ${cp[2].y}\" />`,\n )\n }\n controlPointIndex += m\n knotIndex += m\n }\n return paths\n}\n\nconst bezier = (entity: SplineEntity): BoundsAndElement => {\n let bbox = new Box2()\n for (const p of entity.controlPoints) {\n bbox = bbox.expandByPoint(p)\n }\n const k = entity.degree + 1\n const piecewise = toPiecewiseBezier(k, entity.controlPoints, entity.knots)\n const paths = piecewiseToPaths(k, piecewise.knots, piecewise.controlPoints)\n const element = `<g>${paths.join('')}</g>`\n return transformBoundingBoxAndElement(bbox, element, entity.transforms ?? [])\n}\n\n/**\n * Switch the appropriate function on entity type. CIRCLE, ARC and ELLIPSE\n * produce native SVG elements, the rest produce interpolated polylines.\n */\nconst entityToBoundsAndElement = (\n entity: Entity,\n dimStyles?: { [name: string]: any },\n): BoundsAndElement | null => {\n switch (entity.type) {\n case 'CIRCLE':\n return circle(entity as CircleEntity)\n case 'ELLIPSE':\n return ellipse(entity as EllipseEntity)\n case 'ARC':\n return arc(entity as ArcEntity)\n case 'TEXT':\n return text(entity as TextEntity)\n case 'MTEXT':\n return mtext(entity as MTextEntity)\n case 'DIMENSION': {\n const dimEntity = entity as DimensionEntity\n const styleName = typeof dimEntity.styleName === 'string'\n ? dimEntity.styleName\n : undefined\n const dimStyle = styleName && dimStyles\n ? dimStyles[styleName]\n : undefined\n return dimension(dimEntity, dimStyle)\n }\n case 'SPLINE': {\n const splineEntity = entity as SplineEntity\n const hasWeights = splineEntity.weights?.some((w: number) => w !== 1)\n if ((splineEntity.degree === 2 || splineEntity.degree === 3) && !hasWeights) {\n try {\n return bezier(splineEntity)\n } catch (err) {\n const error = err as Error\n logger.warn('bezier conversion failed, using polyline:', error.message)\n return polyline(entity)\n }\n } else {\n return polyline(entity)\n }\n }\n case 'LINE':\n case 'POLYLINE': {\n return polyline(entity)\n }\n case 'LWPOLYLINE': {\n return lwpolyline(entity)\n }\n default:\n logger.warn('entity type not supported in SVG rendering:', entity.type)\n return null\n }\n}\n\nexport default function toSVG(parsed: ParsedDXF): string {\n const entities = denormalise(parsed)\n const dimStyles = parsed.tables.dimStyles\n const { bbox, elements } = entities.reduce(\n (\n acc: { bbox: Box2; elements: string[] },\n entity: Entity,\n ): { bbox: Box2; elements: string[] } => {\n const rgb = getRGBForEntity(parsed.tables.layers, entity)\n const boundsAndElement = entityToBoundsAndElement(entity, dimStyles)\n // Ignore entities that don't produce SVG elements or have unsupported types\n if (boundsAndElement) {\n const { bbox, element } = boundsAndElement\n // Ignore invalid bounding boxes\n if (bbox.valid) {\n acc.bbox.expandByPoint(bbox.min)\n acc.bbox.expandByPoint(bbox.max)\n }\n acc.elements.push(\n `<g stroke=\"${rgbToColorAttribute(rgb)}\">${element}</g>`,\n )\n }\n return acc\n },\n {\n bbox: new Box2(),\n elements: [],\n },\n )\n\n const viewBox = bbox.valid\n ? {\n x: bbox.min.x,\n y: -bbox.max.y,\n width: bbox.max.x - bbox.min.x,\n height: bbox.max.y - bbox.min.y,\n }\n : {\n x: 0,\n y: 0,\n width: 0,\n height: 0,\n }\n return `<?xml version=\"1.0\"?>\n<svg\n xmlns=\"http://www.w3.org/2000/svg\"\n xmlns:xlink=\"http://www.w3.org/1999/xlink\" version=\"1.1\"\n preserveAspectRatio=\"xMinYMin meet\"\n viewBox=\"${viewBox.x} ${viewBox.y} ${viewBox.width} ${viewBox.height}\"\n width=\"100%\" height=\"100%\"\n>\n <g stroke=\"#000000\" stroke-width=\"0.1%\" fill=\"none\" transform=\"matrix(1,0,0,-1,0,0)\">\n ${elements.join('\\n')}\n </g>\n</svg>`\n}\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,Y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 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __copyProps = (to, from, except, desc) => {
|
|
7
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
+
for (let key of __getOwnPropNames(from))
|
|
9
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
+
}
|
|
12
|
+
return to;
|
|
13
|
+
};
|
|
14
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
|
+
var arc_entity_exports = {};
|
|
16
|
+
module.exports = __toCommonJS(arc_entity_exports);
|
|
17
|
+
//# sourceMappingURL=arc-entity.cjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/types/arc-entity.ts"],
|
|
4
|
+
"sourcesContent": ["// ARC entity type\n\nimport type { PositionalEntity } from './base-entity'\n\nexport interface ArcEntity extends PositionalEntity {\n type: 'ARC'\n r: number\n startAngle: number\n endAngle: number\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;AAAA;AAAA;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=arc-entity.js.map
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __copyProps = (to, from, except, desc) => {
|
|
7
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
+
for (let key of __getOwnPropNames(from))
|
|
9
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
+
}
|
|
12
|
+
return to;
|
|
13
|
+
};
|
|
14
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
|
+
var base_entity_exports = {};
|
|
16
|
+
module.exports = __toCommonJS(base_entity_exports);
|
|
17
|
+
//# sourceMappingURL=base-entity.cjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/types/base-entity.ts"],
|
|
4
|
+
"sourcesContent": ["// Base entity interface that all DXF entities extend from\n\nimport type { Point3D, Transform } from './common'\n\nexport interface BaseEntity {\n type: string\n handle?: string\n layer?: string\n lineTypeName?: string\n lineTypeScale?: number\n visible?: boolean\n colorNumber?: number\n paperSpace?: number\n viewportOn?: number\n extrusionDirection?: Point3D\n extrusionZ?: number\n transforms?: Transform[]\n}\n\n/** Base for entities with positional coordinates (x, y, z) */\nexport interface PositionalEntity extends BaseEntity {\n x: number\n y: number\n z?: number\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;AAAA;AAAA;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=base-entity.js.map
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __copyProps = (to, from, except, desc) => {
|
|
7
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
+
for (let key of __getOwnPropNames(from))
|
|
9
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
+
}
|
|
12
|
+
return to;
|
|
13
|
+
};
|
|
14
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
|
+
var circle_entity_exports = {};
|
|
16
|
+
module.exports = __toCommonJS(circle_entity_exports);
|
|
17
|
+
//# sourceMappingURL=circle-entity.cjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/types/circle-entity.ts"],
|
|
4
|
+
"sourcesContent": ["// CIRCLE entity type\n\nimport type { PositionalEntity } from './base-entity'\n\nexport interface CircleEntity extends PositionalEntity {\n type: 'CIRCLE'\n r: number\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;AAAA;AAAA;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=circle-entity.js.map
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __copyProps = (to, from, except, desc) => {
|
|
7
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
+
for (let key of __getOwnPropNames(from))
|
|
9
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
+
}
|
|
12
|
+
return to;
|
|
13
|
+
};
|
|
14
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
|
+
var common_exports = {};
|
|
16
|
+
module.exports = __toCommonJS(common_exports);
|
|
17
|
+
//# sourceMappingURL=common.cjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/types/common.ts"],
|
|
4
|
+
"sourcesContent": ["// Common geometric types\n\n/** 2D Point as tuple [x, y] */\nexport type PointTuple = [number, number]\n\nexport interface Point2D {\n x: number\n y: number\n}\n\nexport interface Point3D extends Point2D {\n z: number\n}\n\nexport interface RGB {\n r: number\n g: number\n b: number\n}\n\nexport type ColorRGB = [number, number, number]\n\nexport interface Transform {\n x?: number\n y?: number\n scaleX?: number\n scaleY?: number\n scaleZ?: number\n rotation?: number\n extrusionX?: number\n extrusionY?: number\n extrusionZ?: number\n}\n\n/** Transform with all properties required */\n// eslint-disable-next-line @typescript-eslint/no-empty-object-type\nexport interface ZeroTransform extends Required<Transform> {}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;AAAA;AAAA;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=common.js.map
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __copyProps = (to, from, except, desc) => {
|
|
7
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
+
for (let key of __getOwnPropNames(from))
|
|
9
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
+
}
|
|
12
|
+
return to;
|
|
13
|
+
};
|
|
14
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
|
+
var dimension_entity_exports = {};
|
|
16
|
+
module.exports = __toCommonJS(dimension_entity_exports);
|
|
17
|
+
//# sourceMappingURL=dimension-entity.cjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/types/dimension-entity.ts"],
|
|
4
|
+
"sourcesContent": ["// DIMENSION entity type\n\nimport type { BaseEntity } from './base-entity'\nimport type { Point3D } from './common'\n\nexport interface DimensionEntity extends BaseEntity {\n type: 'DIMENSION'\n block?: string\n start: Point3D\n measureStart: Point3D\n measureEnd: Point3D\n textMidpoint: Point3D\n rotation?: number\n horizonRotation?: number\n extensionRotation?: number\n textRotation?: number\n attachementPoint: number\n dimensionType: number\n extrudeDirection?: Point3D\n text?: string\n styleName?: string\n [key: string]: unknown\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;AAAA;AAAA;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=dimension-entity.js.map
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __copyProps = (to, from, except, desc) => {
|
|
7
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
+
for (let key of __getOwnPropNames(from))
|
|
9
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
+
}
|
|
12
|
+
return to;
|
|
13
|
+
};
|
|
14
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
|
+
var dxf_exports = {};
|
|
16
|
+
module.exports = __toCommonJS(dxf_exports);
|
|
17
|
+
//# sourceMappingURL=dxf.cjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/types/dxf.ts"],
|
|
4
|
+
"sourcesContent": ["// DXF parsing and structure types\n\nimport type { Entity } from './entity'\nimport type { ParsedObjects } from './tables'\n\nexport interface LayerTable {\n name: string\n frozen?: boolean\n colorNumber?: number\n [key: string]: unknown\n}\n\nexport interface DimStyleTable {\n name: string\n dimAsz?: number\n dimTxt?: number\n dimScale?: number\n dimGap?: number\n dimExo?: number\n dimExe?: number\n dimClrd?: number\n dimClre?: number\n dimClrt?: number\n dimLwd?: number\n dimLwe?: number\n dimBlk?: string // Arrow block name (342)\n dimBlk1?: string // First arrow block (343)\n dimBlk2?: string // Second arrow block (344)\n [key: string]: unknown\n}\n\nexport interface Tables {\n layers: {\n [name: string]: LayerTable\n }\n dimStyles?: {\n [name: string]: DimStyleTable\n }\n [key: string]: any\n}\n\nexport interface Block {\n name: string\n entities: Entity[]\n x: number\n y: number\n z?: number\n}\n\nexport interface Blocks {\n [name: string]: Block\n}\n\nexport type BlockArray = Block[]\n\nexport interface ParsedDXF {\n header?: any\n tables: Tables\n blocks: BlockArray\n entities: Entity[]\n objects?: ParsedObjects\n}\n\nexport type DXFTuple = [number, string | number]\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;AAAA;AAAA;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/lib/types/dxf.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=dxf.js.map
|