@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
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
// Common geometric types
|
|
2
|
+
|
|
3
|
+
/** 2D Point as tuple [x, y] */
|
|
4
|
+
export type PointTuple = [number, number]
|
|
5
|
+
|
|
6
|
+
export interface Point2D {
|
|
7
|
+
x: number
|
|
8
|
+
y: number
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export interface Point3D extends Point2D {
|
|
12
|
+
z: number
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export interface RGB {
|
|
16
|
+
r: number
|
|
17
|
+
g: number
|
|
18
|
+
b: number
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export type ColorRGB = [number, number, number]
|
|
22
|
+
|
|
23
|
+
export interface Transform {
|
|
24
|
+
x?: number
|
|
25
|
+
y?: number
|
|
26
|
+
scaleX?: number
|
|
27
|
+
scaleY?: number
|
|
28
|
+
scaleZ?: number
|
|
29
|
+
rotation?: number
|
|
30
|
+
extrusionX?: number
|
|
31
|
+
extrusionY?: number
|
|
32
|
+
extrusionZ?: number
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/** Transform with all properties required */
|
|
36
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
|
|
37
|
+
export interface ZeroTransform extends Required<Transform> {}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
// DIMENSION entity type
|
|
2
|
+
|
|
3
|
+
import type { BaseEntity } from './base-entity'
|
|
4
|
+
import type { Point3D } from './common'
|
|
5
|
+
|
|
6
|
+
export interface DimensionEntity extends BaseEntity {
|
|
7
|
+
type: 'DIMENSION'
|
|
8
|
+
block?: string
|
|
9
|
+
start: Point3D
|
|
10
|
+
measureStart: Point3D
|
|
11
|
+
measureEnd: Point3D
|
|
12
|
+
textMidpoint: Point3D
|
|
13
|
+
rotation?: number
|
|
14
|
+
horizonRotation?: number
|
|
15
|
+
extensionRotation?: number
|
|
16
|
+
textRotation?: number
|
|
17
|
+
attachementPoint: number
|
|
18
|
+
dimensionType: number
|
|
19
|
+
extrudeDirection?: Point3D
|
|
20
|
+
text?: string
|
|
21
|
+
styleName?: string
|
|
22
|
+
[key: string]: unknown
|
|
23
|
+
}
|
package/src/types/dxf.ts
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
// DXF parsing and structure types
|
|
2
|
+
|
|
3
|
+
import type { Entity } from './entity'
|
|
4
|
+
import type { ParsedObjects } from './tables'
|
|
5
|
+
|
|
6
|
+
export interface LayerTable {
|
|
7
|
+
name: string
|
|
8
|
+
frozen?: boolean
|
|
9
|
+
colorNumber?: number
|
|
10
|
+
[key: string]: unknown
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export interface DimStyleTable {
|
|
14
|
+
name: string
|
|
15
|
+
dimAsz?: number
|
|
16
|
+
dimTxt?: number
|
|
17
|
+
dimScale?: number
|
|
18
|
+
dimGap?: number
|
|
19
|
+
dimExo?: number
|
|
20
|
+
dimExe?: number
|
|
21
|
+
dimClrd?: number
|
|
22
|
+
dimClre?: number
|
|
23
|
+
dimClrt?: number
|
|
24
|
+
dimLwd?: number
|
|
25
|
+
dimLwe?: number
|
|
26
|
+
dimBlk?: string // Arrow block name (342)
|
|
27
|
+
dimBlk1?: string // First arrow block (343)
|
|
28
|
+
dimBlk2?: string // Second arrow block (344)
|
|
29
|
+
[key: string]: unknown
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export interface Tables {
|
|
33
|
+
layers: {
|
|
34
|
+
[name: string]: LayerTable
|
|
35
|
+
}
|
|
36
|
+
dimStyles?: {
|
|
37
|
+
[name: string]: DimStyleTable
|
|
38
|
+
}
|
|
39
|
+
[key: string]: any
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export interface Block {
|
|
43
|
+
name: string
|
|
44
|
+
entities: Entity[]
|
|
45
|
+
x: number
|
|
46
|
+
y: number
|
|
47
|
+
z?: number
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export interface Blocks {
|
|
51
|
+
[name: string]: Block
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export type BlockArray = Block[]
|
|
55
|
+
|
|
56
|
+
export interface ParsedDXF {
|
|
57
|
+
header?: any
|
|
58
|
+
tables: Tables
|
|
59
|
+
blocks: BlockArray
|
|
60
|
+
entities: Entity[]
|
|
61
|
+
objects?: ParsedObjects
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export type DXFTuple = [number, string | number]
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
// ELLIPSE entity type
|
|
2
|
+
|
|
3
|
+
import type { PositionalEntity } from './base-entity'
|
|
4
|
+
|
|
5
|
+
export interface EllipseEntity extends PositionalEntity {
|
|
6
|
+
type: 'ELLIPSE'
|
|
7
|
+
majorX: number
|
|
8
|
+
majorY: number
|
|
9
|
+
majorZ?: number
|
|
10
|
+
axisRatio: number
|
|
11
|
+
startAngle: number
|
|
12
|
+
endAngle: number
|
|
13
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
// Union type for all entity types
|
|
2
|
+
|
|
3
|
+
import type { ArcEntity } from './arc-entity'
|
|
4
|
+
import type { BaseEntity } from './base-entity'
|
|
5
|
+
import type { CircleEntity } from './circle-entity'
|
|
6
|
+
import type { DimensionEntity } from './dimension-entity'
|
|
7
|
+
import type { EllipseEntity } from './ellipse-entity'
|
|
8
|
+
import type { HatchEntity } from './hatch-entity'
|
|
9
|
+
import type { InsertEntity } from './insert-entity'
|
|
10
|
+
import type { LineEntity } from './line-entity'
|
|
11
|
+
import type { MTextEntity } from './mtext-entity'
|
|
12
|
+
import type { PointEntity } from './point-entity'
|
|
13
|
+
import type { PolylineEntity } from './polyline-entity'
|
|
14
|
+
import type { SolidEntity } from './solid-entity'
|
|
15
|
+
import type { SplineEntity } from './spline-entity'
|
|
16
|
+
import type { TextEntity } from './text-entity'
|
|
17
|
+
|
|
18
|
+
export type Entity =
|
|
19
|
+
| LineEntity
|
|
20
|
+
| CircleEntity
|
|
21
|
+
| ArcEntity
|
|
22
|
+
| EllipseEntity
|
|
23
|
+
| TextEntity
|
|
24
|
+
| MTextEntity
|
|
25
|
+
| PointEntity
|
|
26
|
+
| PolylineEntity
|
|
27
|
+
| SplineEntity
|
|
28
|
+
| DimensionEntity
|
|
29
|
+
| SolidEntity
|
|
30
|
+
| InsertEntity
|
|
31
|
+
| HatchEntity
|
|
32
|
+
| BaseEntity
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
// Handler-internal types (não exportados na API pública)
|
|
2
|
+
|
|
3
|
+
import type { Point2D } from './common'
|
|
4
|
+
|
|
5
|
+
/** Common properties extracted from DXF tuples */
|
|
6
|
+
export interface CommonEntityProperties {
|
|
7
|
+
handle?: string
|
|
8
|
+
lineTypeName?: string
|
|
9
|
+
layer?: string
|
|
10
|
+
lineTypeScale?: number
|
|
11
|
+
visible?: boolean
|
|
12
|
+
colorNumber?: number
|
|
13
|
+
paperSpace?: number
|
|
14
|
+
viewportOn?: number
|
|
15
|
+
viewport?: number
|
|
16
|
+
extrusionX?: number
|
|
17
|
+
extrusionY?: number
|
|
18
|
+
extrusionZ?: number
|
|
19
|
+
layout?: string
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/** Simple codes extraction result */
|
|
23
|
+
export interface SimpleCodes {
|
|
24
|
+
[code: number]: string | number
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/** Bit combinations result for dimensions */
|
|
28
|
+
export interface BitCombinationsResult {
|
|
29
|
+
attachmentPoint?: number
|
|
30
|
+
[key: string]: number | undefined
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/** Polyline vertex with bulge - extends Point2D */
|
|
34
|
+
export interface PolylineVertex extends Point2D {
|
|
35
|
+
z?: number
|
|
36
|
+
bulge?: number
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/** Control point for splines - extends Point2D */
|
|
40
|
+
export interface ControlPoint extends Point2D {
|
|
41
|
+
z?: number
|
|
42
|
+
weight?: number
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/** Vertex for polylines - internal handler use */
|
|
46
|
+
export interface HandlerVertex extends Point2D {
|
|
47
|
+
z?: number
|
|
48
|
+
bulge?: number
|
|
49
|
+
startWidth?: number
|
|
50
|
+
endWidth?: number
|
|
51
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
// Handler types for entity processing
|
|
2
|
+
|
|
3
|
+
import type { DXFTuple } from './dxf'
|
|
4
|
+
import type { Entity } from './entity'
|
|
5
|
+
|
|
6
|
+
export interface EntityHandler {
|
|
7
|
+
TYPE: string
|
|
8
|
+
process: (tuples: DXFTuple[]) => Entity
|
|
9
|
+
assign?: (entity: any, type: number, value: any) => any
|
|
10
|
+
}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
// HATCH entity type
|
|
2
|
+
|
|
3
|
+
import type { BaseEntity } from './base-entity'
|
|
4
|
+
import type { Point3D } from './common'
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Hatch pattern information
|
|
8
|
+
*/
|
|
9
|
+
export interface HatchPattern {
|
|
10
|
+
/** Pattern line count */
|
|
11
|
+
lineCount?: number
|
|
12
|
+
/** Pattern angle */
|
|
13
|
+
angle?: number
|
|
14
|
+
/** Pattern X offset */
|
|
15
|
+
x?: number
|
|
16
|
+
/** Pattern Y offset */
|
|
17
|
+
y?: number
|
|
18
|
+
/** Pattern X spacing offset */
|
|
19
|
+
offsetX?: number
|
|
20
|
+
/** Pattern Y spacing offset */
|
|
21
|
+
offsetY?: number
|
|
22
|
+
/** Dash count */
|
|
23
|
+
dashCount?: number
|
|
24
|
+
/** Pattern line lengths */
|
|
25
|
+
length: Array<string | number>
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Hatch boundary loop
|
|
30
|
+
*/
|
|
31
|
+
export interface HatchLoop {
|
|
32
|
+
/** Loop type flags */
|
|
33
|
+
type?: number
|
|
34
|
+
/** Entity count in loop */
|
|
35
|
+
count?: number
|
|
36
|
+
/** Edge type (for non-polyline) */
|
|
37
|
+
edgeType?: number
|
|
38
|
+
/** Has bulge flag (for polyline) */
|
|
39
|
+
hasBulge?: number
|
|
40
|
+
/** Source object count */
|
|
41
|
+
sourceObjects?: number
|
|
42
|
+
/** Loop entities */
|
|
43
|
+
entities: any[]
|
|
44
|
+
/** Reference handles */
|
|
45
|
+
references: Array<string | number>
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Hatch boundary definition
|
|
50
|
+
*/
|
|
51
|
+
export interface HatchBoundary {
|
|
52
|
+
/** Total boundary loop count */
|
|
53
|
+
count?: number
|
|
54
|
+
/** Boundary loops */
|
|
55
|
+
loops: HatchLoop[]
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Hatch seed point
|
|
60
|
+
*/
|
|
61
|
+
export interface HatchSeed {
|
|
62
|
+
x: number
|
|
63
|
+
y: number
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Hatch seeds collection
|
|
68
|
+
*/
|
|
69
|
+
export interface HatchSeeds {
|
|
70
|
+
/** Seed point count */
|
|
71
|
+
count: number
|
|
72
|
+
/** Seed points */
|
|
73
|
+
seeds: HatchSeed[]
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Hatch color/gradient information
|
|
78
|
+
*/
|
|
79
|
+
export interface HatchColor {
|
|
80
|
+
/** Color count */
|
|
81
|
+
count?: number
|
|
82
|
+
/** Color rotation */
|
|
83
|
+
rotation?: string | number
|
|
84
|
+
/** Gradient definition */
|
|
85
|
+
gradient?: string | number
|
|
86
|
+
/** Color tint value */
|
|
87
|
+
tint?: string | number
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
export interface HatchEntity extends BaseEntity {
|
|
91
|
+
type: 'HATCH'
|
|
92
|
+
/** Pattern name */
|
|
93
|
+
patternName?: string | number
|
|
94
|
+
/** Elevation point */
|
|
95
|
+
elevation?: Partial<Point3D>
|
|
96
|
+
/** Extrusion direction vector */
|
|
97
|
+
extrusionDir?: Point3D
|
|
98
|
+
/** Fill color index */
|
|
99
|
+
fillColor?: string | number
|
|
100
|
+
/** Fill type (SOLID or PATTERN) */
|
|
101
|
+
fillType?: 'SOLID' | 'PATTERN'
|
|
102
|
+
/** Hatch pattern information */
|
|
103
|
+
pattern?: HatchPattern
|
|
104
|
+
/** Hatch boundary definition */
|
|
105
|
+
boundary?: HatchBoundary
|
|
106
|
+
/** Hatch seed points */
|
|
107
|
+
seeds?: HatchSeeds
|
|
108
|
+
/** Hatch style (0=Normal, 1=Outer, 2=Ignore) */
|
|
109
|
+
style?: number
|
|
110
|
+
/** Hatch type (0=User-defined, 1=Predefined, 2=Custom) */
|
|
111
|
+
hatchType?: number
|
|
112
|
+
/** Shadow pattern angle */
|
|
113
|
+
shadowPatternAngle?: number
|
|
114
|
+
/** Pattern spacing */
|
|
115
|
+
spacing?: number
|
|
116
|
+
/** Double hatch flag */
|
|
117
|
+
double?: boolean
|
|
118
|
+
/** Solid or gradient fill type */
|
|
119
|
+
solidOrGradient?: 'SOLID' | 'GRADIENT'
|
|
120
|
+
/** Color/gradient information */
|
|
121
|
+
color?: HatchColor
|
|
122
|
+
|
|
123
|
+
/** Legacy: paths array (kept for compatibility) */
|
|
124
|
+
paths?: any[]
|
|
125
|
+
/** Legacy: fill color RGB (kept for compatibility) */
|
|
126
|
+
// fillColor already defined above with different type
|
|
127
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
// Helper class interface
|
|
2
|
+
|
|
3
|
+
import type { ParsedDXF } from './dxf'
|
|
4
|
+
import type { Entity } from './entity'
|
|
5
|
+
import type { ToPolylinesOptions, ToSVGOptions } from './options'
|
|
6
|
+
|
|
7
|
+
export interface HelperInterface {
|
|
8
|
+
parsed: ParsedDXF
|
|
9
|
+
denormalised: Entity[]
|
|
10
|
+
toSVG(options?: ToSVGOptions): string
|
|
11
|
+
toPolylines(options?: ToPolylinesOptions): any[]
|
|
12
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
// Barrel export for all DXF types
|
|
2
|
+
|
|
3
|
+
// Common types
|
|
4
|
+
export * from './common'
|
|
5
|
+
|
|
6
|
+
// Base entity
|
|
7
|
+
export * from './base-entity'
|
|
8
|
+
|
|
9
|
+
// Entity types
|
|
10
|
+
export * from './arc-entity'
|
|
11
|
+
export * from './circle-entity'
|
|
12
|
+
export * from './dimension-entity'
|
|
13
|
+
export * from './ellipse-entity'
|
|
14
|
+
export * from './hatch-entity'
|
|
15
|
+
export * from './insert-entity'
|
|
16
|
+
export * from './line-entity'
|
|
17
|
+
export * from './mtext-entity'
|
|
18
|
+
export * from './ole2frame-entity'
|
|
19
|
+
export * from './point-entity'
|
|
20
|
+
export * from './polyline-entity'
|
|
21
|
+
export * from './solid-entity'
|
|
22
|
+
export * from './spline-entity'
|
|
23
|
+
export * from './text-entity'
|
|
24
|
+
export * from './viewport-entity'
|
|
25
|
+
|
|
26
|
+
// Union type
|
|
27
|
+
export * from './entity'
|
|
28
|
+
|
|
29
|
+
// DXF structures
|
|
30
|
+
export * from './dxf'
|
|
31
|
+
|
|
32
|
+
// Tables
|
|
33
|
+
export * from './tables'
|
|
34
|
+
|
|
35
|
+
// Handlers
|
|
36
|
+
export * from './handler'
|
|
37
|
+
|
|
38
|
+
// Options
|
|
39
|
+
export * from './options'
|
|
40
|
+
|
|
41
|
+
// Helper
|
|
42
|
+
export * from './helper'
|
|
43
|
+
|
|
44
|
+
// Conversion types
|
|
45
|
+
export * from './layer-groups'
|
|
46
|
+
export * from './polylines'
|
|
47
|
+
export * from './svg'
|
|
48
|
+
|
|
49
|
+
// Utility types
|
|
50
|
+
export * from './util-types'
|
|
51
|
+
|
|
52
|
+
// Handler internal types
|
|
53
|
+
export * from './handler-internal'
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
// INSERT entity type (block references)
|
|
2
|
+
|
|
3
|
+
import type { PositionalEntity } from './base-entity'
|
|
4
|
+
|
|
5
|
+
export interface InsertEntity extends PositionalEntity {
|
|
6
|
+
type: 'INSERT'
|
|
7
|
+
block: string
|
|
8
|
+
scaleX?: number
|
|
9
|
+
scaleY?: number
|
|
10
|
+
scaleZ?: number
|
|
11
|
+
rotation?: number
|
|
12
|
+
columnCount?: number
|
|
13
|
+
rowCount?: number
|
|
14
|
+
columnSpacing?: number
|
|
15
|
+
rowSpacing?: number
|
|
16
|
+
extrusionX?: number
|
|
17
|
+
extrusionY?: number
|
|
18
|
+
// extrusionZ inherited from BaseEntity via PositionalEntity
|
|
19
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
// MTEXT entity type
|
|
2
|
+
|
|
3
|
+
import type { BaseEntity } from './base-entity'
|
|
4
|
+
|
|
5
|
+
export interface MTextEntity extends BaseEntity {
|
|
6
|
+
type: 'MTEXT'
|
|
7
|
+
string: string
|
|
8
|
+
x?: number
|
|
9
|
+
y?: number
|
|
10
|
+
z?: number
|
|
11
|
+
nominalTextHeight?: number
|
|
12
|
+
textHeight?: number
|
|
13
|
+
refRectangleWidth?: number
|
|
14
|
+
attachmentPoint?: number
|
|
15
|
+
drawingDirection?: number
|
|
16
|
+
styleName?: string
|
|
17
|
+
xAxisX?: number
|
|
18
|
+
xAxisY?: number
|
|
19
|
+
xAxisZ?: number
|
|
20
|
+
horizontalWidth?: number
|
|
21
|
+
verticalHeight?: number
|
|
22
|
+
lineSpacingStyle?: number
|
|
23
|
+
lineSpacingFactor?: number
|
|
24
|
+
backgroundFill?: number
|
|
25
|
+
fillBoxStyle?: number
|
|
26
|
+
bgFillColor?: number
|
|
27
|
+
bgFillTransparency?: number
|
|
28
|
+
columnType?: number
|
|
29
|
+
columnCount?: number
|
|
30
|
+
columnFlowReversed?: boolean
|
|
31
|
+
columnAutoheight?: boolean
|
|
32
|
+
columnWidth?: number
|
|
33
|
+
columnGutter?: number
|
|
34
|
+
columnHeights?: number
|
|
35
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
// OLE2Frame entity type
|
|
2
|
+
|
|
3
|
+
import type { BaseEntity } from './base-entity'
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* OLE2Frame entity
|
|
7
|
+
* Represents an embedded OLE2 object frame
|
|
8
|
+
*/
|
|
9
|
+
export interface Ole2FrameEntity extends BaseEntity {
|
|
10
|
+
type: 'OLE2FRAME'
|
|
11
|
+
/** OLE version number */
|
|
12
|
+
version?: string | number
|
|
13
|
+
/** End of object name/description */
|
|
14
|
+
name?: string | number
|
|
15
|
+
/** Upper-left corner X coordinate (WCS) */
|
|
16
|
+
upperLeftX?: string | number
|
|
17
|
+
/** Upper-left corner Y coordinate (WCS) */
|
|
18
|
+
upperLeftY?: string | number
|
|
19
|
+
/** Upper-left corner Z coordinate (WCS) */
|
|
20
|
+
upperLeftZ?: string | number
|
|
21
|
+
/** Lower-right corner X coordinate (WCS) */
|
|
22
|
+
lowerRightX?: string | number
|
|
23
|
+
/** Lower-right corner Y coordinate (WCS) */
|
|
24
|
+
lowerRightY?: string | number
|
|
25
|
+
/** Lower-right corner Z coordinate (WCS) */
|
|
26
|
+
lowerRightZ?: string | number
|
|
27
|
+
/** Object type (1=Link, 2=Embedded, 3=Static) */
|
|
28
|
+
objectType?: string | number
|
|
29
|
+
/** Tile mode descriptor (0=Model space, 1=Paper space) */
|
|
30
|
+
tile?: string | number
|
|
31
|
+
/** Length of binary data */
|
|
32
|
+
length?: string | number
|
|
33
|
+
/** Binary data (concatenated from multiple 310 codes) */
|
|
34
|
+
data: string
|
|
35
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// Options types for various operations
|
|
2
|
+
|
|
3
|
+
export interface ToPolylinesOptions {
|
|
4
|
+
interpolationsPerSplineSegment?: number
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export interface ToSVGOptions {
|
|
8
|
+
width?: number
|
|
9
|
+
height?: number
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export interface Config {
|
|
13
|
+
verbose?: boolean
|
|
14
|
+
interpolationsPerSplineSegment: number
|
|
15
|
+
layers: string[]
|
|
16
|
+
}
|
|
17
|
+
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
// POLYLINE and LWPOLYLINE entity types
|
|
2
|
+
|
|
3
|
+
import type { BaseEntity } from './base-entity'
|
|
4
|
+
import type { Point2D } from './common'
|
|
5
|
+
|
|
6
|
+
/** Vertex extends Point2D with optional z and additional properties */
|
|
7
|
+
export interface Vertex extends Partial<Point2D> {
|
|
8
|
+
z?: number
|
|
9
|
+
bulge?: number
|
|
10
|
+
faces?: number[]
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export interface PolylineEntity extends BaseEntity {
|
|
14
|
+
type: 'POLYLINE' | 'LWPOLYLINE'
|
|
15
|
+
vertices: Vertex[]
|
|
16
|
+
closed?: boolean
|
|
17
|
+
polygonMesh?: boolean
|
|
18
|
+
polyfaceMesh?: boolean
|
|
19
|
+
thickness?: number
|
|
20
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
// Polyline conversion types
|
|
2
|
+
|
|
3
|
+
import type { Box2 } from 'vecks'
|
|
4
|
+
import type { ColorRGB, PointTuple } from './common'
|
|
5
|
+
|
|
6
|
+
/** Polyline with color information */
|
|
7
|
+
export interface Polyline {
|
|
8
|
+
vertices: PointTuple[]
|
|
9
|
+
rgb?: ColorRGB
|
|
10
|
+
color?: number
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
/** Result of toPolylines conversion */
|
|
14
|
+
export interface PolylineResult {
|
|
15
|
+
bbox: Box2
|
|
16
|
+
polylines: Polyline[]
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/** Options for entityToPolyline conversion */
|
|
20
|
+
export interface EntityToPolylineOptions {
|
|
21
|
+
interpolationsPerSplineSegment?: number
|
|
22
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
// SPLINE entity type
|
|
2
|
+
|
|
3
|
+
import type { BaseEntity } from './base-entity'
|
|
4
|
+
import type { Point3D } from './common'
|
|
5
|
+
|
|
6
|
+
export interface SplineEntity extends BaseEntity {
|
|
7
|
+
type: 'SPLINE'
|
|
8
|
+
controlPoints: Point3D[]
|
|
9
|
+
knots: number[]
|
|
10
|
+
degree: number
|
|
11
|
+
weights?: number[]
|
|
12
|
+
}
|
package/src/types/svg.ts
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
// SVG-specific types
|
|
2
|
+
|
|
3
|
+
import type { Box2 } from 'vecks'
|
|
4
|
+
|
|
5
|
+
/** Bounding box with SVG element */
|
|
6
|
+
export interface BoundsAndElement {
|
|
7
|
+
bbox: Box2
|
|
8
|
+
element: string
|
|
9
|
+
x?: number
|
|
10
|
+
y?: number
|
|
11
|
+
x2?: number
|
|
12
|
+
y2?: number
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/** Ellipse parameters for SVG */
|
|
16
|
+
export interface EllipseParams {
|
|
17
|
+
cx: number
|
|
18
|
+
cy: number
|
|
19
|
+
rx: number
|
|
20
|
+
ry: number
|
|
21
|
+
rotation: number
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/** Layer information */
|
|
25
|
+
export interface Layer {
|
|
26
|
+
name: string
|
|
27
|
+
colorNumber?: number
|
|
28
|
+
color?: number
|
|
29
|
+
frozen?: boolean
|
|
30
|
+
[key: string]: unknown
|
|
31
|
+
}
|