@linkiez/dxf-renew 7.1.0 → 7.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc.json +1 -16
- package/.yarn/install-state.gz +0 -0
- package/ARCHITECTURE.md +163 -0
- package/CHANGELOG.md +16 -0
- package/README.md +72 -10
- package/{PLAN.md → ROADMAP.md} +227 -35
- package/dist/dxf.js +1090 -344
- package/docs/FIXTURE_VALIDATION_EZDXF.md +1 -1
- package/lib/Helper.cjs +4 -0
- package/lib/Helper.cjs.map +3 -3
- package/lib/Helper.js +4 -0
- package/lib/Helper.js.map +2 -2
- package/lib/entityToPolyline.cjs +95 -0
- package/lib/entityToPolyline.cjs.map +3 -3
- package/lib/entityToPolyline.js +95 -0
- package/lib/entityToPolyline.js.map +2 -2
- package/lib/handlers/entities.cjs +22 -2
- package/lib/handlers/entities.cjs.map +3 -3
- package/lib/handlers/entities.js +22 -2
- package/lib/handlers/entities.js.map +2 -2
- package/lib/handlers/entity/mleader.cjs +69 -0
- package/lib/handlers/entity/mleader.cjs.map +7 -0
- package/lib/handlers/entity/mleader.js +34 -0
- package/lib/handlers/entity/mleader.js.map +7 -0
- package/lib/handlers/entity/mline.cjs +91 -0
- package/lib/handlers/entity/mline.cjs.map +7 -0
- package/lib/handlers/entity/mline.js +56 -0
- package/lib/handlers/entity/mline.js.map +7 -0
- package/lib/handlers/entity/oleframe.cjs +98 -0
- package/lib/handlers/entity/oleframe.cjs.map +7 -0
- package/lib/handlers/entity/oleframe.js +63 -0
- package/lib/handlers/entity/oleframe.js.map +7 -0
- package/lib/handlers/entity/ray.cjs +81 -0
- package/lib/handlers/entity/ray.cjs.map +7 -0
- package/lib/handlers/entity/ray.js +46 -0
- package/lib/handlers/entity/ray.js.map +7 -0
- package/lib/handlers/entity/region.cjs +67 -0
- package/lib/handlers/entity/region.cjs.map +7 -0
- package/lib/handlers/entity/region.js +32 -0
- package/lib/handlers/entity/region.js.map +7 -0
- package/lib/handlers/entity/shape.cjs +95 -0
- package/lib/handlers/entity/shape.cjs.map +7 -0
- package/lib/handlers/entity/shape.js +60 -0
- package/lib/handlers/entity/shape.js.map +7 -0
- package/lib/handlers/entity/table.cjs +71 -0
- package/lib/handlers/entity/table.cjs.map +7 -0
- package/lib/handlers/entity/table.js +36 -0
- package/lib/handlers/entity/table.js.map +7 -0
- package/lib/handlers/entity/trace.cjs +101 -0
- package/lib/handlers/entity/trace.cjs.map +7 -0
- package/lib/handlers/entity/trace.js +66 -0
- package/lib/handlers/entity/trace.js.map +7 -0
- package/lib/handlers/entity/wipeout.cjs +122 -0
- package/lib/handlers/entity/wipeout.cjs.map +7 -0
- package/lib/handlers/entity/wipeout.js +87 -0
- package/lib/handlers/entity/wipeout.js.map +7 -0
- package/lib/handlers/entity/xline.cjs +81 -0
- package/lib/handlers/entity/xline.cjs.map +7 -0
- package/lib/handlers/entity/xline.js +46 -0
- package/lib/handlers/entity/xline.js.map +7 -0
- package/lib/handlers/objects.cjs +43 -1
- package/lib/handlers/objects.cjs.map +2 -2
- package/lib/handlers/objects.js +43 -1
- package/lib/handlers/objects.js.map +2 -2
- package/lib/handlers/tables.cjs +96 -17
- package/lib/handlers/tables.cjs.map +2 -2
- package/lib/handlers/tables.js +96 -17
- package/lib/handlers/tables.js.map +2 -2
- package/lib/index.cjs +5 -2
- package/lib/index.cjs.map +3 -3
- package/lib/index.js +18 -16
- package/lib/index.js.map +3 -3
- package/lib/toJson.cjs +29 -0
- package/lib/toJson.cjs.map +7 -0
- package/lib/toJson.js +9 -0
- package/lib/toJson.js.map +7 -0
- package/lib/toSVG.cjs +34 -3
- package/lib/toSVG.cjs.map +2 -2
- package/lib/toSVG.js +34 -3
- package/lib/toSVG.js.map +2 -2
- package/lib/types/entity.cjs.map +1 -1
- package/lib/types/helper.cjs.map +1 -1
- package/lib/types/index.cjs +20 -0
- package/lib/types/index.cjs.map +2 -2
- package/lib/types/index.js +10 -0
- package/lib/types/index.js.map +2 -2
- package/lib/types/mleader-entity.cjs +17 -0
- package/lib/types/mleader-entity.cjs.map +7 -0
- package/lib/types/mleader-entity.js +1 -0
- package/lib/types/mleader-entity.js.map +7 -0
- package/lib/types/mline-entity.cjs +17 -0
- package/lib/types/mline-entity.cjs.map +7 -0
- package/lib/types/mline-entity.js +1 -0
- package/lib/types/mline-entity.js.map +7 -0
- package/lib/types/oleframe-entity.cjs +17 -0
- package/lib/types/oleframe-entity.cjs.map +7 -0
- package/lib/types/oleframe-entity.js +1 -0
- package/lib/types/oleframe-entity.js.map +7 -0
- package/lib/types/options.cjs.map +1 -1
- package/lib/types/ray-entity.cjs +17 -0
- package/lib/types/ray-entity.cjs.map +7 -0
- package/lib/types/ray-entity.js +1 -0
- package/lib/types/ray-entity.js.map +7 -0
- package/lib/types/region-entity.cjs +17 -0
- package/lib/types/region-entity.cjs.map +7 -0
- package/lib/types/region-entity.js +1 -0
- package/lib/types/region-entity.js.map +7 -0
- package/lib/types/shape-entity.cjs +17 -0
- package/lib/types/shape-entity.cjs.map +7 -0
- package/lib/types/shape-entity.js +1 -0
- package/lib/types/shape-entity.js.map +7 -0
- package/lib/types/table-entity.cjs +17 -0
- package/lib/types/table-entity.cjs.map +7 -0
- package/lib/types/table-entity.js +1 -0
- package/lib/types/table-entity.js.map +7 -0
- package/lib/types/tables.cjs.map +1 -1
- package/lib/types/trace-entity.cjs +17 -0
- package/lib/types/trace-entity.cjs.map +7 -0
- package/lib/types/trace-entity.js +1 -0
- package/lib/types/trace-entity.js.map +7 -0
- package/lib/types/wipeout-entity.cjs +17 -0
- package/lib/types/wipeout-entity.cjs.map +7 -0
- package/lib/types/wipeout-entity.js +1 -0
- package/lib/types/wipeout-entity.js.map +7 -0
- package/lib/types/xline-entity.cjs +17 -0
- package/lib/types/xline-entity.cjs.map +7 -0
- package/lib/types/xline-entity.js +1 -0
- package/lib/types/xline-entity.js.map +7 -0
- package/package.json +5 -19
- package/src/Helper.ts +6 -1
- package/src/entityToPolyline.ts +124 -2
- package/src/handlers/entities.ts +21 -1
- package/src/handlers/entity/mleader.ts +46 -0
- package/src/handlers/entity/mline.ts +74 -0
- package/src/handlers/entity/oleframe.ts +62 -0
- package/src/handlers/entity/ray.ts +52 -0
- package/src/handlers/entity/region.ts +42 -0
- package/src/handlers/entity/shape.ts +73 -0
- package/src/handlers/entity/table.ts +49 -0
- package/src/handlers/entity/trace.ts +72 -0
- package/src/handlers/entity/wipeout.ts +114 -0
- package/src/handlers/entity/xline.ts +52 -0
- package/src/handlers/objects.ts +64 -8
- package/src/handlers/tables.ts +134 -21
- package/src/index.ts +9 -18
- package/src/toJson.ts +8 -0
- package/src/toSVG.ts +45 -3
- package/src/types/entity.ts +20 -0
- package/src/types/helper.ts +2 -1
- package/src/types/index.ts +10 -0
- package/src/types/mleader-entity.ts +8 -0
- package/src/types/mline-entity.ts +12 -0
- package/src/types/oleframe-entity.ts +40 -0
- package/src/types/options.ts +7 -0
- package/src/types/ray-entity.ts +12 -0
- package/src/types/region-entity.ts +11 -0
- package/src/types/shape-entity.ts +19 -0
- package/src/types/table-entity.ts +14 -0
- package/src/types/tables.ts +76 -0
- package/src/types/trace-entity.ts +14 -0
- package/src/types/wipeout-entity.ts +20 -0
- package/src/types/xline-entity.ts +12 -0
- package/docs/DIMENSION_SUMMARY.md +0 -254
- package/docs/DXF_VERSION_SUPPORT.md +0 -45
- package/docs/ENTITY_SVG_ROADMAP.md +0 -96
- package/docs/IMPLEMENTED-2D-ENTITIES.md +0 -54
- package/docs/README.md +0 -22
- package/docs/SVG_RENDERING_INTEGRATION_TESTS.md +0 -119
- package/docs/TEXT-MTEXT-DIMENSION-SUPPORT.md +0 -241
package/dist/dxf.js
CHANGED
|
@@ -2730,6 +2730,7 @@ var dxf = (() => {
|
|
|
2730
2730
|
denormalise: () => denormalise,
|
|
2731
2731
|
groupEntitiesByLayer: () => groupEntitiesByLayer,
|
|
2732
2732
|
parseString: () => parseString,
|
|
2733
|
+
toJson: () => toJson,
|
|
2733
2734
|
toPolylines: () => toPolylines,
|
|
2734
2735
|
toSVG: () => toSVG
|
|
2735
2736
|
});
|
|
@@ -2742,6 +2743,9 @@ var dxf = (() => {
|
|
|
2742
2743
|
};
|
|
2743
2744
|
var config_default = config;
|
|
2744
2745
|
|
|
2746
|
+
// src/denormalise.ts
|
|
2747
|
+
var import_cloneDeep = __toESM(require_cloneDeep(), 1);
|
|
2748
|
+
|
|
2745
2749
|
// src/util/logger.ts
|
|
2746
2750
|
function info(...args) {
|
|
2747
2751
|
if (config_default.verbose) {
|
|
@@ -2762,6 +2766,172 @@ var dxf = (() => {
|
|
|
2762
2766
|
error
|
|
2763
2767
|
};
|
|
2764
2768
|
|
|
2769
|
+
// src/denormalise.ts
|
|
2770
|
+
function adjustLineForBlockBasePoint(entity, block) {
|
|
2771
|
+
const line = entity;
|
|
2772
|
+
line.start.x -= block.x;
|
|
2773
|
+
line.start.y -= block.y;
|
|
2774
|
+
line.end.x -= block.x;
|
|
2775
|
+
line.end.y -= block.y;
|
|
2776
|
+
}
|
|
2777
|
+
function adjustPolylineForBlockBasePoint(entity, block) {
|
|
2778
|
+
const poly = entity;
|
|
2779
|
+
for (const v of poly.vertices) {
|
|
2780
|
+
if (v.x !== void 0) v.x -= block.x;
|
|
2781
|
+
if (v.y !== void 0) v.y -= block.y;
|
|
2782
|
+
}
|
|
2783
|
+
}
|
|
2784
|
+
function adjustCircleForBlockBasePoint(entity, block) {
|
|
2785
|
+
const circle2 = entity;
|
|
2786
|
+
circle2.x -= block.x;
|
|
2787
|
+
circle2.y -= block.y;
|
|
2788
|
+
}
|
|
2789
|
+
function adjustEllipseForBlockBasePoint(entity, block) {
|
|
2790
|
+
const ellipse2 = entity;
|
|
2791
|
+
ellipse2.x -= block.x;
|
|
2792
|
+
ellipse2.y -= block.y;
|
|
2793
|
+
}
|
|
2794
|
+
function adjustArcForBlockBasePoint(entity, block) {
|
|
2795
|
+
const arc2 = entity;
|
|
2796
|
+
arc2.x -= block.x;
|
|
2797
|
+
arc2.y -= block.y;
|
|
2798
|
+
}
|
|
2799
|
+
function adjustSplineForBlockBasePoint(entity, block) {
|
|
2800
|
+
const spline = entity;
|
|
2801
|
+
for (const cp of spline.controlPoints) {
|
|
2802
|
+
cp.x -= block.x;
|
|
2803
|
+
cp.y -= block.y;
|
|
2804
|
+
}
|
|
2805
|
+
}
|
|
2806
|
+
function adjustTextForBlockBasePoint(entity, block) {
|
|
2807
|
+
const text2 = entity;
|
|
2808
|
+
if (text2.x !== void 0) text2.x -= block.x;
|
|
2809
|
+
if (text2.y !== void 0) text2.y -= block.y;
|
|
2810
|
+
if (text2.x2 !== void 0) text2.x2 -= block.x;
|
|
2811
|
+
if (text2.y2 !== void 0) text2.y2 -= block.y;
|
|
2812
|
+
}
|
|
2813
|
+
function adjustMTextForBlockBasePoint(entity, block) {
|
|
2814
|
+
const mtext2 = entity;
|
|
2815
|
+
if (mtext2.x !== void 0) mtext2.x -= block.x;
|
|
2816
|
+
if (mtext2.y !== void 0) mtext2.y -= block.y;
|
|
2817
|
+
}
|
|
2818
|
+
function adjustDimensionForBlockBasePoint(entity, block) {
|
|
2819
|
+
const dim = entity;
|
|
2820
|
+
dim.start.x -= block.x;
|
|
2821
|
+
dim.start.y -= block.y;
|
|
2822
|
+
dim.textMidpoint.x -= block.x;
|
|
2823
|
+
dim.textMidpoint.y -= block.y;
|
|
2824
|
+
dim.measureStart.x -= block.x;
|
|
2825
|
+
dim.measureStart.y -= block.y;
|
|
2826
|
+
dim.measureEnd.x -= block.x;
|
|
2827
|
+
dim.measureEnd.y -= block.y;
|
|
2828
|
+
}
|
|
2829
|
+
var BLOCK_BASEPOINT_ADJUSTERS = {
|
|
2830
|
+
LINE: adjustLineForBlockBasePoint,
|
|
2831
|
+
LWPOLYLINE: adjustPolylineForBlockBasePoint,
|
|
2832
|
+
POLYLINE: adjustPolylineForBlockBasePoint,
|
|
2833
|
+
CIRCLE: adjustCircleForBlockBasePoint,
|
|
2834
|
+
ELLIPSE: adjustEllipseForBlockBasePoint,
|
|
2835
|
+
ARC: adjustArcForBlockBasePoint,
|
|
2836
|
+
SPLINE: adjustSplineForBlockBasePoint,
|
|
2837
|
+
TEXT: adjustTextForBlockBasePoint,
|
|
2838
|
+
MTEXT: adjustMTextForBlockBasePoint,
|
|
2839
|
+
DIMENSION: adjustDimensionForBlockBasePoint
|
|
2840
|
+
};
|
|
2841
|
+
function applyBlockBasePointAdjustment(entity, block) {
|
|
2842
|
+
const adjust = BLOCK_BASEPOINT_ADJUSTERS[entity.type];
|
|
2843
|
+
if (adjust) adjust(entity, block);
|
|
2844
|
+
}
|
|
2845
|
+
function computeRectangularArrayVectors(insert) {
|
|
2846
|
+
const rowCount = insert.rowCount ?? 1;
|
|
2847
|
+
const columnCount = insert.columnCount ?? 1;
|
|
2848
|
+
const rowSpacing = insert.rowSpacing ?? 0;
|
|
2849
|
+
const columnSpacing = insert.columnSpacing ?? 0;
|
|
2850
|
+
const rotation = insert.rotation ?? 0;
|
|
2851
|
+
if (rowCount <= 1 && columnCount <= 1) {
|
|
2852
|
+
return { rowVec: { x: 0, y: 0 }, colVec: { x: 0, y: 0 } };
|
|
2853
|
+
}
|
|
2854
|
+
const cos = Math.cos(rotation * Math.PI / 180);
|
|
2855
|
+
const sin = Math.sin(rotation * Math.PI / 180);
|
|
2856
|
+
return {
|
|
2857
|
+
rowVec: { x: -sin * rowSpacing, y: cos * rowSpacing },
|
|
2858
|
+
colVec: { x: cos * columnSpacing, y: sin * columnSpacing }
|
|
2859
|
+
};
|
|
2860
|
+
}
|
|
2861
|
+
function expandInsert(insert, blocksByName, transforms, gatherEntities) {
|
|
2862
|
+
const block = blocksByName[insert.block];
|
|
2863
|
+
if (!block) {
|
|
2864
|
+
logger_default.error("no block found for insert. block:", insert.block);
|
|
2865
|
+
return [];
|
|
2866
|
+
}
|
|
2867
|
+
const rowCount = insert.rowCount ?? 1;
|
|
2868
|
+
const columnCount = insert.columnCount ?? 1;
|
|
2869
|
+
const { rowVec, colVec } = computeRectangularArrayVectors(insert);
|
|
2870
|
+
const current = [];
|
|
2871
|
+
for (let r = 0; r < rowCount; r++) {
|
|
2872
|
+
for (let c = 0; c < columnCount; c++) {
|
|
2873
|
+
const t = {
|
|
2874
|
+
x: insert.x + rowVec.x * r + colVec.x * c,
|
|
2875
|
+
y: insert.y + rowVec.y * r + colVec.y * c,
|
|
2876
|
+
scaleX: insert.scaleX,
|
|
2877
|
+
scaleY: insert.scaleY,
|
|
2878
|
+
scaleZ: insert.scaleZ,
|
|
2879
|
+
extrusionX: insert.extrusionX,
|
|
2880
|
+
extrusionY: insert.extrusionY,
|
|
2881
|
+
extrusionZ: insert.extrusionZ,
|
|
2882
|
+
rotation: insert.rotation
|
|
2883
|
+
};
|
|
2884
|
+
const transforms2 = transforms.slice(0);
|
|
2885
|
+
transforms2.push(t);
|
|
2886
|
+
const blockEntities = block.entities.map((be) => {
|
|
2887
|
+
const be2 = (0, import_cloneDeep.default)(be);
|
|
2888
|
+
be2.layer = insert.layer;
|
|
2889
|
+
applyBlockBasePointAdjustment(be2, block);
|
|
2890
|
+
return be2;
|
|
2891
|
+
});
|
|
2892
|
+
current.push(...gatherEntities(blockEntities, transforms2));
|
|
2893
|
+
}
|
|
2894
|
+
}
|
|
2895
|
+
return current;
|
|
2896
|
+
}
|
|
2897
|
+
function denormalise(parseResult) {
|
|
2898
|
+
const blocksByName = parseResult.blocks.reduce(
|
|
2899
|
+
(acc, b) => {
|
|
2900
|
+
acc[b.name] = b;
|
|
2901
|
+
return acc;
|
|
2902
|
+
},
|
|
2903
|
+
{}
|
|
2904
|
+
);
|
|
2905
|
+
const gatherEntities = (entities, transforms) => {
|
|
2906
|
+
const current = [];
|
|
2907
|
+
for (const e of entities) {
|
|
2908
|
+
if (e.type === "INSERT") {
|
|
2909
|
+
current.push(
|
|
2910
|
+
...expandInsert(e, blocksByName, transforms, gatherEntities)
|
|
2911
|
+
);
|
|
2912
|
+
} else {
|
|
2913
|
+
const e2 = (0, import_cloneDeep.default)(e);
|
|
2914
|
+
e2.transforms = transforms.slice().reverse();
|
|
2915
|
+
current.push(e2);
|
|
2916
|
+
}
|
|
2917
|
+
}
|
|
2918
|
+
return current;
|
|
2919
|
+
};
|
|
2920
|
+
return gatherEntities(parseResult.entities, []);
|
|
2921
|
+
}
|
|
2922
|
+
|
|
2923
|
+
// src/groupEntitiesByLayer.ts
|
|
2924
|
+
function groupEntitiesByLayer(entities) {
|
|
2925
|
+
return entities.reduce((acc, entity) => {
|
|
2926
|
+
const layer = entity.layer ?? "0";
|
|
2927
|
+
if (!acc[layer]) {
|
|
2928
|
+
acc[layer] = [];
|
|
2929
|
+
}
|
|
2930
|
+
acc[layer].push(entity);
|
|
2931
|
+
return acc;
|
|
2932
|
+
}, {});
|
|
2933
|
+
}
|
|
2934
|
+
|
|
2765
2935
|
// src/handlers/entity/common.ts
|
|
2766
2936
|
function parseCommonEntityProperties(type, value) {
|
|
2767
2937
|
switch (type) {
|
|
@@ -3635,75 +3805,9 @@ var dxf = (() => {
|
|
|
3635
3805
|
};
|
|
3636
3806
|
var dwfUnderlay_default = { TYPE: TYPE9, process: process9 };
|
|
3637
3807
|
|
|
3638
|
-
// src/handlers/entity/pdfUnderlay.ts
|
|
3639
|
-
var TYPE10 = "PDFUNDERLAY";
|
|
3640
|
-
var process10 = (tuples) => {
|
|
3641
|
-
return tuples.reduce(
|
|
3642
|
-
(entity, tuple) => {
|
|
3643
|
-
const type = tuple[0];
|
|
3644
|
-
const value = tuple[1];
|
|
3645
|
-
switch (type) {
|
|
3646
|
-
case 340:
|
|
3647
|
-
entity.underlayDefinitionHandle = String(value);
|
|
3648
|
-
break;
|
|
3649
|
-
case 10:
|
|
3650
|
-
entity.insertionPoint.x = value;
|
|
3651
|
-
break;
|
|
3652
|
-
case 20:
|
|
3653
|
-
entity.insertionPoint.y = value;
|
|
3654
|
-
break;
|
|
3655
|
-
case 30:
|
|
3656
|
-
entity.insertionPoint.z = value;
|
|
3657
|
-
break;
|
|
3658
|
-
case 41:
|
|
3659
|
-
entity.scale.x = value;
|
|
3660
|
-
break;
|
|
3661
|
-
case 42:
|
|
3662
|
-
entity.scale.y = value;
|
|
3663
|
-
break;
|
|
3664
|
-
case 43:
|
|
3665
|
-
entity.scale.z = value;
|
|
3666
|
-
break;
|
|
3667
|
-
case 50:
|
|
3668
|
-
entity.rotation = value;
|
|
3669
|
-
break;
|
|
3670
|
-
case 210:
|
|
3671
|
-
entity.normal.x = value;
|
|
3672
|
-
break;
|
|
3673
|
-
case 220:
|
|
3674
|
-
entity.normal.y = value;
|
|
3675
|
-
break;
|
|
3676
|
-
case 230:
|
|
3677
|
-
entity.normal.z = value;
|
|
3678
|
-
break;
|
|
3679
|
-
case 280:
|
|
3680
|
-
entity.flags = value;
|
|
3681
|
-
break;
|
|
3682
|
-
case 281:
|
|
3683
|
-
entity.contrast = value;
|
|
3684
|
-
break;
|
|
3685
|
-
case 282:
|
|
3686
|
-
entity.fade = value;
|
|
3687
|
-
break;
|
|
3688
|
-
default:
|
|
3689
|
-
Object.assign(entity, parseCommonEntityProperties(type, value));
|
|
3690
|
-
break;
|
|
3691
|
-
}
|
|
3692
|
-
return entity;
|
|
3693
|
-
},
|
|
3694
|
-
{
|
|
3695
|
-
type: TYPE10,
|
|
3696
|
-
insertionPoint: { x: 0, y: 0, z: 0 },
|
|
3697
|
-
scale: { x: 1, y: 1, z: 1 },
|
|
3698
|
-
normal: { x: 0, y: 0, z: 1 }
|
|
3699
|
-
}
|
|
3700
|
-
);
|
|
3701
|
-
};
|
|
3702
|
-
var pdfUnderlay_default = { TYPE: TYPE10, process: process10 };
|
|
3703
|
-
|
|
3704
3808
|
// src/handlers/entity/ellipse.ts
|
|
3705
|
-
var
|
|
3706
|
-
var
|
|
3809
|
+
var TYPE10 = "ELLIPSE";
|
|
3810
|
+
var process10 = (tuples) => {
|
|
3707
3811
|
return tuples.reduce(
|
|
3708
3812
|
(entity, tuple) => {
|
|
3709
3813
|
const type = tuple[0];
|
|
@@ -3743,14 +3847,14 @@ var dxf = (() => {
|
|
|
3743
3847
|
return entity;
|
|
3744
3848
|
},
|
|
3745
3849
|
{
|
|
3746
|
-
type:
|
|
3850
|
+
type: TYPE10
|
|
3747
3851
|
}
|
|
3748
3852
|
);
|
|
3749
3853
|
};
|
|
3750
|
-
var ellipse_default = { TYPE:
|
|
3854
|
+
var ellipse_default = { TYPE: TYPE10, process: process10 };
|
|
3751
3855
|
|
|
3752
3856
|
// src/handlers/entity/hatch.ts
|
|
3753
|
-
var
|
|
3857
|
+
var TYPE11 = "HATCH";
|
|
3754
3858
|
var status = "IDLE";
|
|
3755
3859
|
var drawEntity = {};
|
|
3756
3860
|
var drawType = 0;
|
|
@@ -3758,7 +3862,7 @@ var dxf = (() => {
|
|
|
3758
3862
|
var seed = null;
|
|
3759
3863
|
var loop = { references: [], entities: [] };
|
|
3760
3864
|
var polyPoint = null;
|
|
3761
|
-
var
|
|
3865
|
+
var process11 = (tuples) => {
|
|
3762
3866
|
status = "IDLE";
|
|
3763
3867
|
drawEntity = {};
|
|
3764
3868
|
drawType = 0;
|
|
@@ -3967,7 +4071,7 @@ var dxf = (() => {
|
|
|
3967
4071
|
return entity;
|
|
3968
4072
|
},
|
|
3969
4073
|
{
|
|
3970
|
-
type:
|
|
4074
|
+
type: TYPE11,
|
|
3971
4075
|
elevation: { x: 0, y: 0, z: 0 },
|
|
3972
4076
|
extrusionDir: { x: 0, y: 0, z: 1 },
|
|
3973
4077
|
pattern: {
|
|
@@ -3997,7 +4101,7 @@ var dxf = (() => {
|
|
|
3997
4101
|
}
|
|
3998
4102
|
);
|
|
3999
4103
|
};
|
|
4000
|
-
var hatch_default = { TYPE:
|
|
4104
|
+
var hatch_default = { TYPE: TYPE11, process: process11 };
|
|
4001
4105
|
function createDrawEntity(type) {
|
|
4002
4106
|
if (isPolyline) return {};
|
|
4003
4107
|
switch (type) {
|
|
@@ -4180,8 +4284,8 @@ var dxf = (() => {
|
|
|
4180
4284
|
}
|
|
4181
4285
|
|
|
4182
4286
|
// src/handlers/entity/image.ts
|
|
4183
|
-
var
|
|
4184
|
-
var
|
|
4287
|
+
var TYPE12 = "IMAGE";
|
|
4288
|
+
var process12 = (tuples) => {
|
|
4185
4289
|
return tuples.reduce(
|
|
4186
4290
|
(entity, tuple) => {
|
|
4187
4291
|
const type = tuple[0];
|
|
@@ -4251,7 +4355,7 @@ var dxf = (() => {
|
|
|
4251
4355
|
return entity;
|
|
4252
4356
|
},
|
|
4253
4357
|
{
|
|
4254
|
-
type:
|
|
4358
|
+
type: TYPE12,
|
|
4255
4359
|
insertionPoint: {},
|
|
4256
4360
|
uVector: {},
|
|
4257
4361
|
vVector: {},
|
|
@@ -4260,11 +4364,11 @@ var dxf = (() => {
|
|
|
4260
4364
|
}
|
|
4261
4365
|
);
|
|
4262
4366
|
};
|
|
4263
|
-
var image_default = { TYPE:
|
|
4367
|
+
var image_default = { TYPE: TYPE12, process: process12 };
|
|
4264
4368
|
|
|
4265
4369
|
// src/handlers/entity/insert.ts
|
|
4266
|
-
var
|
|
4267
|
-
var
|
|
4370
|
+
var TYPE13 = "INSERT";
|
|
4371
|
+
var process13 = (tuples) => {
|
|
4268
4372
|
return tuples.reduce(
|
|
4269
4373
|
(entity, tuple) => {
|
|
4270
4374
|
const type = tuple[0];
|
|
@@ -4322,19 +4426,19 @@ var dxf = (() => {
|
|
|
4322
4426
|
return entity;
|
|
4323
4427
|
},
|
|
4324
4428
|
{
|
|
4325
|
-
type:
|
|
4429
|
+
type: TYPE13
|
|
4326
4430
|
}
|
|
4327
4431
|
);
|
|
4328
4432
|
};
|
|
4329
|
-
var insert_default = { TYPE:
|
|
4433
|
+
var insert_default = { TYPE: TYPE13, process: process13 };
|
|
4330
4434
|
|
|
4331
4435
|
// src/handlers/entity/leader.ts
|
|
4332
|
-
var
|
|
4436
|
+
var TYPE14 = "LEADER";
|
|
4333
4437
|
function ensureVector3(entity, key) {
|
|
4334
4438
|
if (!entity[key]) entity[key] = { x: 0, y: 0, z: 0 };
|
|
4335
4439
|
return entity[key];
|
|
4336
4440
|
}
|
|
4337
|
-
var
|
|
4441
|
+
var process14 = (tuples) => {
|
|
4338
4442
|
return tuples.reduce(
|
|
4339
4443
|
(entity, tuple) => {
|
|
4340
4444
|
const type = tuple[0];
|
|
@@ -4429,16 +4533,16 @@ var dxf = (() => {
|
|
|
4429
4533
|
return entity;
|
|
4430
4534
|
},
|
|
4431
4535
|
{
|
|
4432
|
-
type:
|
|
4536
|
+
type: TYPE14,
|
|
4433
4537
|
vertices: []
|
|
4434
4538
|
}
|
|
4435
4539
|
);
|
|
4436
4540
|
};
|
|
4437
|
-
var leader_default = { TYPE:
|
|
4541
|
+
var leader_default = { TYPE: TYPE14, process: process14 };
|
|
4438
4542
|
|
|
4439
4543
|
// src/handlers/entity/line.ts
|
|
4440
|
-
var
|
|
4441
|
-
var
|
|
4544
|
+
var TYPE15 = "LINE";
|
|
4545
|
+
var process15 = (tuples) => {
|
|
4442
4546
|
return tuples.reduce(
|
|
4443
4547
|
(entity, tuple) => {
|
|
4444
4548
|
const type = tuple[0];
|
|
@@ -4472,17 +4576,17 @@ var dxf = (() => {
|
|
|
4472
4576
|
return entity;
|
|
4473
4577
|
},
|
|
4474
4578
|
{
|
|
4475
|
-
type:
|
|
4579
|
+
type: TYPE15,
|
|
4476
4580
|
start: {},
|
|
4477
4581
|
end: {}
|
|
4478
4582
|
}
|
|
4479
4583
|
);
|
|
4480
4584
|
};
|
|
4481
|
-
var line_default = { TYPE:
|
|
4585
|
+
var line_default = { TYPE: TYPE15, process: process15 };
|
|
4482
4586
|
|
|
4483
4587
|
// src/handlers/entity/lwpolyline.ts
|
|
4484
|
-
var
|
|
4485
|
-
var
|
|
4588
|
+
var TYPE16 = "LWPOLYLINE";
|
|
4589
|
+
var process16 = (tuples) => {
|
|
4486
4590
|
let vertex;
|
|
4487
4591
|
return tuples.reduce(
|
|
4488
4592
|
(entity, tuple) => {
|
|
@@ -4515,19 +4619,99 @@ var dxf = (() => {
|
|
|
4515
4619
|
return entity;
|
|
4516
4620
|
},
|
|
4517
4621
|
{
|
|
4518
|
-
type:
|
|
4622
|
+
type: TYPE16,
|
|
4519
4623
|
vertices: []
|
|
4520
4624
|
}
|
|
4521
4625
|
);
|
|
4522
4626
|
};
|
|
4523
|
-
var lwpolyline_default = { TYPE:
|
|
4627
|
+
var lwpolyline_default = { TYPE: TYPE16, process: process16 };
|
|
4524
4628
|
|
|
4525
|
-
// src/handlers/entity/
|
|
4526
|
-
var
|
|
4527
|
-
var
|
|
4629
|
+
// src/handlers/entity/mleader.ts
|
|
4630
|
+
var TYPE17 = "MLEADER";
|
|
4631
|
+
var process17 = (tuples) => {
|
|
4528
4632
|
return tuples.reduce(
|
|
4529
4633
|
(entity, tuple) => {
|
|
4530
|
-
const
|
|
4634
|
+
const code = tuple[0];
|
|
4635
|
+
const value = tuple[1];
|
|
4636
|
+
switch (code) {
|
|
4637
|
+
// Style name
|
|
4638
|
+
case 2:
|
|
4639
|
+
entity.styleName = String(value);
|
|
4640
|
+
break;
|
|
4641
|
+
// Text string (simplified). MLEADER text can also be stored in more complex structures.
|
|
4642
|
+
case 1:
|
|
4643
|
+
entity.text = String(value);
|
|
4644
|
+
break;
|
|
4645
|
+
default:
|
|
4646
|
+
Object.assign(entity, parseCommonEntityProperties(code, value));
|
|
4647
|
+
break;
|
|
4648
|
+
}
|
|
4649
|
+
return entity;
|
|
4650
|
+
},
|
|
4651
|
+
{
|
|
4652
|
+
type: TYPE17
|
|
4653
|
+
}
|
|
4654
|
+
);
|
|
4655
|
+
};
|
|
4656
|
+
var mleader_default = { TYPE: TYPE17, process: process17 };
|
|
4657
|
+
|
|
4658
|
+
// src/handlers/entity/mline.ts
|
|
4659
|
+
var TYPE18 = "MLINE";
|
|
4660
|
+
function ensurePoint3(entity, key) {
|
|
4661
|
+
entity[key] ??= {};
|
|
4662
|
+
return entity[key];
|
|
4663
|
+
}
|
|
4664
|
+
var process18 = (tuples) => {
|
|
4665
|
+
return tuples.reduce(
|
|
4666
|
+
(entity, tuple) => {
|
|
4667
|
+
const code = tuple[0];
|
|
4668
|
+
const value = tuple[1];
|
|
4669
|
+
switch (code) {
|
|
4670
|
+
// Start point
|
|
4671
|
+
case 10:
|
|
4672
|
+
ensurePoint3(entity, "startPoint").x = value;
|
|
4673
|
+
break;
|
|
4674
|
+
case 20:
|
|
4675
|
+
ensurePoint3(entity, "startPoint").y = value;
|
|
4676
|
+
break;
|
|
4677
|
+
case 30:
|
|
4678
|
+
ensurePoint3(entity, "startPoint").z = value;
|
|
4679
|
+
break;
|
|
4680
|
+
// End point
|
|
4681
|
+
case 11:
|
|
4682
|
+
ensurePoint3(entity, "endPoint").x = value;
|
|
4683
|
+
break;
|
|
4684
|
+
case 21:
|
|
4685
|
+
ensurePoint3(entity, "endPoint").y = value;
|
|
4686
|
+
break;
|
|
4687
|
+
case 31:
|
|
4688
|
+
ensurePoint3(entity, "endPoint").z = value;
|
|
4689
|
+
break;
|
|
4690
|
+
case 71:
|
|
4691
|
+
entity.vertexCount = value;
|
|
4692
|
+
break;
|
|
4693
|
+
case 2:
|
|
4694
|
+
entity.styleName = String(value);
|
|
4695
|
+
break;
|
|
4696
|
+
default:
|
|
4697
|
+
Object.assign(entity, parseCommonEntityProperties(code, value));
|
|
4698
|
+
break;
|
|
4699
|
+
}
|
|
4700
|
+
return entity;
|
|
4701
|
+
},
|
|
4702
|
+
{
|
|
4703
|
+
type: TYPE18
|
|
4704
|
+
}
|
|
4705
|
+
);
|
|
4706
|
+
};
|
|
4707
|
+
var mline_default = { TYPE: TYPE18, process: process18 };
|
|
4708
|
+
|
|
4709
|
+
// src/handlers/entity/ole2Frame.ts
|
|
4710
|
+
var TYPE19 = "OLE2FRAME";
|
|
4711
|
+
var process19 = (tuples) => {
|
|
4712
|
+
return tuples.reduce(
|
|
4713
|
+
(entity, tuple) => {
|
|
4714
|
+
const type = tuple[0];
|
|
4531
4715
|
const value = tuple[1];
|
|
4532
4716
|
switch (type) {
|
|
4533
4717
|
case 70:
|
|
@@ -4573,16 +4757,140 @@ var dxf = (() => {
|
|
|
4573
4757
|
return entity;
|
|
4574
4758
|
},
|
|
4575
4759
|
{
|
|
4576
|
-
type:
|
|
4760
|
+
type: TYPE19,
|
|
4761
|
+
data: ""
|
|
4762
|
+
}
|
|
4763
|
+
);
|
|
4764
|
+
};
|
|
4765
|
+
var ole2Frame_default = { TYPE: TYPE19, process: process19 };
|
|
4766
|
+
|
|
4767
|
+
// src/handlers/entity/oleframe.ts
|
|
4768
|
+
var TYPE20 = "OLEFRAME";
|
|
4769
|
+
var process20 = (tuples) => {
|
|
4770
|
+
return tuples.reduce(
|
|
4771
|
+
(entity, tuple) => {
|
|
4772
|
+
const type = tuple[0];
|
|
4773
|
+
const value = tuple[1];
|
|
4774
|
+
switch (type) {
|
|
4775
|
+
case 70:
|
|
4776
|
+
entity.version = value;
|
|
4777
|
+
break;
|
|
4778
|
+
case 3:
|
|
4779
|
+
entity.name = value;
|
|
4780
|
+
break;
|
|
4781
|
+
case 10:
|
|
4782
|
+
entity.upperLeftX = value;
|
|
4783
|
+
break;
|
|
4784
|
+
case 20:
|
|
4785
|
+
entity.upperLeftY = value;
|
|
4786
|
+
break;
|
|
4787
|
+
case 30:
|
|
4788
|
+
entity.upperLeftZ = value;
|
|
4789
|
+
break;
|
|
4790
|
+
case 11:
|
|
4791
|
+
entity.lowerRightX = value;
|
|
4792
|
+
break;
|
|
4793
|
+
case 21:
|
|
4794
|
+
entity.lowerRightY = value;
|
|
4795
|
+
break;
|
|
4796
|
+
case 31:
|
|
4797
|
+
entity.lowerRightZ = value;
|
|
4798
|
+
break;
|
|
4799
|
+
case 71:
|
|
4800
|
+
entity.objectType = value;
|
|
4801
|
+
break;
|
|
4802
|
+
case 72:
|
|
4803
|
+
entity.tile = value;
|
|
4804
|
+
break;
|
|
4805
|
+
case 90:
|
|
4806
|
+
entity.length = value;
|
|
4807
|
+
break;
|
|
4808
|
+
case 310:
|
|
4809
|
+
entity.data += String(value);
|
|
4810
|
+
break;
|
|
4811
|
+
default:
|
|
4812
|
+
Object.assign(entity, parseCommonEntityProperties(type, value));
|
|
4813
|
+
break;
|
|
4814
|
+
}
|
|
4815
|
+
return entity;
|
|
4816
|
+
},
|
|
4817
|
+
{
|
|
4818
|
+
type: TYPE20,
|
|
4577
4819
|
data: ""
|
|
4578
4820
|
}
|
|
4579
4821
|
);
|
|
4580
4822
|
};
|
|
4581
|
-
var
|
|
4823
|
+
var oleframe_default = { TYPE: TYPE20, process: process20 };
|
|
4824
|
+
|
|
4825
|
+
// src/handlers/entity/pdfUnderlay.ts
|
|
4826
|
+
var TYPE21 = "PDFUNDERLAY";
|
|
4827
|
+
var process21 = (tuples) => {
|
|
4828
|
+
return tuples.reduce(
|
|
4829
|
+
(entity, tuple) => {
|
|
4830
|
+
const type = tuple[0];
|
|
4831
|
+
const value = tuple[1];
|
|
4832
|
+
switch (type) {
|
|
4833
|
+
case 340:
|
|
4834
|
+
entity.underlayDefinitionHandle = String(value);
|
|
4835
|
+
break;
|
|
4836
|
+
case 10:
|
|
4837
|
+
entity.insertionPoint.x = value;
|
|
4838
|
+
break;
|
|
4839
|
+
case 20:
|
|
4840
|
+
entity.insertionPoint.y = value;
|
|
4841
|
+
break;
|
|
4842
|
+
case 30:
|
|
4843
|
+
entity.insertionPoint.z = value;
|
|
4844
|
+
break;
|
|
4845
|
+
case 41:
|
|
4846
|
+
entity.scale.x = value;
|
|
4847
|
+
break;
|
|
4848
|
+
case 42:
|
|
4849
|
+
entity.scale.y = value;
|
|
4850
|
+
break;
|
|
4851
|
+
case 43:
|
|
4852
|
+
entity.scale.z = value;
|
|
4853
|
+
break;
|
|
4854
|
+
case 50:
|
|
4855
|
+
entity.rotation = value;
|
|
4856
|
+
break;
|
|
4857
|
+
case 210:
|
|
4858
|
+
entity.normal.x = value;
|
|
4859
|
+
break;
|
|
4860
|
+
case 220:
|
|
4861
|
+
entity.normal.y = value;
|
|
4862
|
+
break;
|
|
4863
|
+
case 230:
|
|
4864
|
+
entity.normal.z = value;
|
|
4865
|
+
break;
|
|
4866
|
+
case 280:
|
|
4867
|
+
entity.flags = value;
|
|
4868
|
+
break;
|
|
4869
|
+
case 281:
|
|
4870
|
+
entity.contrast = value;
|
|
4871
|
+
break;
|
|
4872
|
+
case 282:
|
|
4873
|
+
entity.fade = value;
|
|
4874
|
+
break;
|
|
4875
|
+
default:
|
|
4876
|
+
Object.assign(entity, parseCommonEntityProperties(type, value));
|
|
4877
|
+
break;
|
|
4878
|
+
}
|
|
4879
|
+
return entity;
|
|
4880
|
+
},
|
|
4881
|
+
{
|
|
4882
|
+
type: TYPE21,
|
|
4883
|
+
insertionPoint: { x: 0, y: 0, z: 0 },
|
|
4884
|
+
scale: { x: 1, y: 1, z: 1 },
|
|
4885
|
+
normal: { x: 0, y: 0, z: 1 }
|
|
4886
|
+
}
|
|
4887
|
+
);
|
|
4888
|
+
};
|
|
4889
|
+
var pdfUnderlay_default = { TYPE: TYPE21, process: process21 };
|
|
4582
4890
|
|
|
4583
4891
|
// src/handlers/entity/point.ts
|
|
4584
|
-
var
|
|
4585
|
-
var
|
|
4892
|
+
var TYPE22 = "POINT";
|
|
4893
|
+
var process22 = (tuples) => {
|
|
4586
4894
|
return tuples.reduce(
|
|
4587
4895
|
(entity, tuple) => {
|
|
4588
4896
|
const type = tuple[0];
|
|
@@ -4607,15 +4915,15 @@ var dxf = (() => {
|
|
|
4607
4915
|
return entity;
|
|
4608
4916
|
},
|
|
4609
4917
|
{
|
|
4610
|
-
type:
|
|
4918
|
+
type: TYPE22
|
|
4611
4919
|
}
|
|
4612
4920
|
);
|
|
4613
4921
|
};
|
|
4614
|
-
var point_default = { TYPE:
|
|
4922
|
+
var point_default = { TYPE: TYPE22, process: process22 };
|
|
4615
4923
|
|
|
4616
4924
|
// src/handlers/entity/polyline.ts
|
|
4617
|
-
var
|
|
4618
|
-
var
|
|
4925
|
+
var TYPE23 = "POLYLINE";
|
|
4926
|
+
var process23 = (tuples) => {
|
|
4619
4927
|
return tuples.reduce(
|
|
4620
4928
|
(entity, tuple) => {
|
|
4621
4929
|
const type = tuple[0];
|
|
@@ -4626,8 +4934,131 @@ var dxf = (() => {
|
|
|
4626
4934
|
entity.polygonMesh = (value & 16) === 16;
|
|
4627
4935
|
entity.polyfaceMesh = (value & 64) === 64;
|
|
4628
4936
|
break;
|
|
4629
|
-
case 39:
|
|
4630
|
-
entity.thickness = value;
|
|
4937
|
+
case 39:
|
|
4938
|
+
entity.thickness = value;
|
|
4939
|
+
break;
|
|
4940
|
+
default:
|
|
4941
|
+
Object.assign(entity, parseCommonEntityProperties(type, value));
|
|
4942
|
+
break;
|
|
4943
|
+
}
|
|
4944
|
+
return entity;
|
|
4945
|
+
},
|
|
4946
|
+
{
|
|
4947
|
+
type: TYPE23,
|
|
4948
|
+
vertices: []
|
|
4949
|
+
}
|
|
4950
|
+
);
|
|
4951
|
+
};
|
|
4952
|
+
var polyline_default = { TYPE: TYPE23, process: process23 };
|
|
4953
|
+
|
|
4954
|
+
// src/handlers/entity/ray.ts
|
|
4955
|
+
var TYPE24 = "RAY";
|
|
4956
|
+
var process24 = (tuples) => {
|
|
4957
|
+
return tuples.reduce(
|
|
4958
|
+
(entity, tuple) => {
|
|
4959
|
+
const type = tuple[0];
|
|
4960
|
+
const value = tuple[1];
|
|
4961
|
+
switch (type) {
|
|
4962
|
+
case 10:
|
|
4963
|
+
entity.start.x = value;
|
|
4964
|
+
break;
|
|
4965
|
+
case 20:
|
|
4966
|
+
entity.start.y = value;
|
|
4967
|
+
break;
|
|
4968
|
+
case 30:
|
|
4969
|
+
entity.start.z = value;
|
|
4970
|
+
break;
|
|
4971
|
+
case 11:
|
|
4972
|
+
entity.direction.x = value;
|
|
4973
|
+
break;
|
|
4974
|
+
case 21:
|
|
4975
|
+
entity.direction.y = value;
|
|
4976
|
+
break;
|
|
4977
|
+
case 31:
|
|
4978
|
+
entity.direction.z = value;
|
|
4979
|
+
break;
|
|
4980
|
+
default:
|
|
4981
|
+
Object.assign(entity, parseCommonEntityProperties(type, value));
|
|
4982
|
+
break;
|
|
4983
|
+
}
|
|
4984
|
+
return entity;
|
|
4985
|
+
},
|
|
4986
|
+
{
|
|
4987
|
+
type: TYPE24,
|
|
4988
|
+
start: {},
|
|
4989
|
+
direction: {}
|
|
4990
|
+
}
|
|
4991
|
+
);
|
|
4992
|
+
};
|
|
4993
|
+
var ray_default = { TYPE: TYPE24, process: process24 };
|
|
4994
|
+
|
|
4995
|
+
// src/handlers/entity/region.ts
|
|
4996
|
+
var TYPE25 = "REGION";
|
|
4997
|
+
var process25 = (tuples) => {
|
|
4998
|
+
return tuples.reduce(
|
|
4999
|
+
(entity, tuple) => {
|
|
5000
|
+
const code = tuple[0];
|
|
5001
|
+
const value = tuple[1];
|
|
5002
|
+
switch (code) {
|
|
5003
|
+
// ACIS data text (first line: 1, additional lines: 3)
|
|
5004
|
+
case 1:
|
|
5005
|
+
case 3:
|
|
5006
|
+
entity.acisData ??= [];
|
|
5007
|
+
entity.acisData.push(String(value));
|
|
5008
|
+
break;
|
|
5009
|
+
default:
|
|
5010
|
+
Object.assign(entity, parseCommonEntityProperties(code, value));
|
|
5011
|
+
break;
|
|
5012
|
+
}
|
|
5013
|
+
return entity;
|
|
5014
|
+
},
|
|
5015
|
+
{
|
|
5016
|
+
type: TYPE25
|
|
5017
|
+
}
|
|
5018
|
+
);
|
|
5019
|
+
};
|
|
5020
|
+
var region_default = { TYPE: TYPE25, process: process25 };
|
|
5021
|
+
|
|
5022
|
+
// src/handlers/entity/shape.ts
|
|
5023
|
+
var TYPE26 = "SHAPE";
|
|
5024
|
+
var process26 = (tuples) => {
|
|
5025
|
+
return tuples.reduce(
|
|
5026
|
+
(entity, tuple) => {
|
|
5027
|
+
const type = tuple[0];
|
|
5028
|
+
const value = tuple[1];
|
|
5029
|
+
switch (type) {
|
|
5030
|
+
case 10:
|
|
5031
|
+
entity.insertionPoint.x = value;
|
|
5032
|
+
break;
|
|
5033
|
+
case 20:
|
|
5034
|
+
entity.insertionPoint.y = value;
|
|
5035
|
+
break;
|
|
5036
|
+
case 30:
|
|
5037
|
+
entity.insertionPoint.z = value;
|
|
5038
|
+
break;
|
|
5039
|
+
case 2:
|
|
5040
|
+
entity.name = String(value);
|
|
5041
|
+
break;
|
|
5042
|
+
case 39:
|
|
5043
|
+
entity.thickness = value;
|
|
5044
|
+
break;
|
|
5045
|
+
case 40:
|
|
5046
|
+
entity.size = value;
|
|
5047
|
+
break;
|
|
5048
|
+
case 41:
|
|
5049
|
+
entity.relativeXScale = value;
|
|
5050
|
+
break;
|
|
5051
|
+
case 50:
|
|
5052
|
+
entity.rotation = value;
|
|
5053
|
+
break;
|
|
5054
|
+
case 51:
|
|
5055
|
+
entity.oblique = value;
|
|
5056
|
+
break;
|
|
5057
|
+
case 210:
|
|
5058
|
+
entity.extrusionX = value;
|
|
5059
|
+
break;
|
|
5060
|
+
case 220:
|
|
5061
|
+
entity.extrusionY = value;
|
|
4631
5062
|
break;
|
|
4632
5063
|
default:
|
|
4633
5064
|
Object.assign(entity, parseCommonEntityProperties(type, value));
|
|
@@ -4636,16 +5067,16 @@ var dxf = (() => {
|
|
|
4636
5067
|
return entity;
|
|
4637
5068
|
},
|
|
4638
5069
|
{
|
|
4639
|
-
type:
|
|
4640
|
-
|
|
5070
|
+
type: TYPE26,
|
|
5071
|
+
insertionPoint: {}
|
|
4641
5072
|
}
|
|
4642
5073
|
);
|
|
4643
5074
|
};
|
|
4644
|
-
var
|
|
5075
|
+
var shape_default = { TYPE: TYPE26, process: process26 };
|
|
4645
5076
|
|
|
4646
5077
|
// src/handlers/entity/solid.ts
|
|
4647
|
-
var
|
|
4648
|
-
var
|
|
5078
|
+
var TYPE27 = "SOLID";
|
|
5079
|
+
var process27 = (tuples) => {
|
|
4649
5080
|
return tuples.reduce(
|
|
4650
5081
|
(entity, tuple) => {
|
|
4651
5082
|
const type = tuple[0];
|
|
@@ -4697,16 +5128,16 @@ var dxf = (() => {
|
|
|
4697
5128
|
return entity;
|
|
4698
5129
|
},
|
|
4699
5130
|
{
|
|
4700
|
-
type:
|
|
5131
|
+
type: TYPE27,
|
|
4701
5132
|
corners: [{}, {}, {}, {}]
|
|
4702
5133
|
}
|
|
4703
5134
|
);
|
|
4704
5135
|
};
|
|
4705
|
-
var solid_default = { TYPE:
|
|
5136
|
+
var solid_default = { TYPE: TYPE27, process: process27 };
|
|
4706
5137
|
|
|
4707
5138
|
// src/handlers/entity/spline.ts
|
|
4708
|
-
var
|
|
4709
|
-
var
|
|
5139
|
+
var TYPE28 = "SPLINE";
|
|
5140
|
+
var process28 = (tuples) => {
|
|
4710
5141
|
let controlPoint;
|
|
4711
5142
|
return tuples.reduce(
|
|
4712
5143
|
(entity, tuple) => {
|
|
@@ -4765,17 +5196,48 @@ var dxf = (() => {
|
|
|
4765
5196
|
return entity;
|
|
4766
5197
|
},
|
|
4767
5198
|
{
|
|
4768
|
-
type:
|
|
5199
|
+
type: TYPE28,
|
|
4769
5200
|
controlPoints: [],
|
|
4770
5201
|
knots: []
|
|
4771
5202
|
}
|
|
4772
5203
|
);
|
|
4773
5204
|
};
|
|
4774
|
-
var spline_default = { TYPE:
|
|
5205
|
+
var spline_default = { TYPE: TYPE28, process: process28 };
|
|
5206
|
+
|
|
5207
|
+
// src/handlers/entity/table.ts
|
|
5208
|
+
var TYPE29 = "TABLE";
|
|
5209
|
+
var process29 = (tuples) => {
|
|
5210
|
+
return tuples.reduce(
|
|
5211
|
+
(entity, tuple) => {
|
|
5212
|
+
const code = tuple[0];
|
|
5213
|
+
const value = tuple[1];
|
|
5214
|
+
switch (code) {
|
|
5215
|
+
case 90:
|
|
5216
|
+
entity.rows = value;
|
|
5217
|
+
break;
|
|
5218
|
+
case 91:
|
|
5219
|
+
entity.columns = value;
|
|
5220
|
+
break;
|
|
5221
|
+
case 1:
|
|
5222
|
+
entity.cellText ??= [];
|
|
5223
|
+
entity.cellText.push(String(value));
|
|
5224
|
+
break;
|
|
5225
|
+
default:
|
|
5226
|
+
Object.assign(entity, parseCommonEntityProperties(code, value));
|
|
5227
|
+
break;
|
|
5228
|
+
}
|
|
5229
|
+
return entity;
|
|
5230
|
+
},
|
|
5231
|
+
{
|
|
5232
|
+
type: TYPE29
|
|
5233
|
+
}
|
|
5234
|
+
);
|
|
5235
|
+
};
|
|
5236
|
+
var table_default = { TYPE: TYPE29, process: process29 };
|
|
4775
5237
|
|
|
4776
5238
|
// src/handlers/entity/threeDFace.ts
|
|
4777
|
-
var
|
|
4778
|
-
var
|
|
5239
|
+
var TYPE30 = "3DFACE";
|
|
5240
|
+
var process30 = (tuples) => {
|
|
4779
5241
|
return tuples.reduce(
|
|
4780
5242
|
(entity, tuple) => {
|
|
4781
5243
|
const type = tuple[0];
|
|
@@ -4824,20 +5286,20 @@ var dxf = (() => {
|
|
|
4824
5286
|
return entity;
|
|
4825
5287
|
},
|
|
4826
5288
|
{
|
|
4827
|
-
type:
|
|
5289
|
+
type: TYPE30,
|
|
4828
5290
|
vertices: [{}, {}, {}, {}]
|
|
4829
5291
|
}
|
|
4830
5292
|
);
|
|
4831
5293
|
};
|
|
4832
|
-
var threeDFace_default = { TYPE:
|
|
5294
|
+
var threeDFace_default = { TYPE: TYPE30, process: process30 };
|
|
4833
5295
|
|
|
4834
5296
|
// src/handlers/entity/tolerance.ts
|
|
4835
|
-
var
|
|
5297
|
+
var TYPE31 = "TOLERANCE";
|
|
4836
5298
|
function ensureVector32(entity, key) {
|
|
4837
5299
|
entity[key] ??= { x: 0, y: 0, z: 0 };
|
|
4838
5300
|
return entity[key];
|
|
4839
5301
|
}
|
|
4840
|
-
var
|
|
5302
|
+
var process31 = (tuples) => {
|
|
4841
5303
|
return tuples.reduce(
|
|
4842
5304
|
(entity, tuple) => {
|
|
4843
5305
|
const code = tuple[0];
|
|
@@ -4874,22 +5336,83 @@ var dxf = (() => {
|
|
|
4874
5336
|
return entity;
|
|
4875
5337
|
},
|
|
4876
5338
|
{
|
|
4877
|
-
type:
|
|
5339
|
+
type: TYPE31,
|
|
4878
5340
|
insertionPoint: { x: 0, y: 0, z: 0 }
|
|
4879
5341
|
}
|
|
4880
5342
|
);
|
|
4881
5343
|
};
|
|
4882
|
-
var tolerance_default = { TYPE:
|
|
5344
|
+
var tolerance_default = { TYPE: TYPE31, process: process31 };
|
|
5345
|
+
|
|
5346
|
+
// src/handlers/entity/trace.ts
|
|
5347
|
+
var TYPE32 = "TRACE";
|
|
5348
|
+
var process32 = (tuples) => {
|
|
5349
|
+
return tuples.reduce(
|
|
5350
|
+
(entity, tuple) => {
|
|
5351
|
+
const type = tuple[0];
|
|
5352
|
+
const value = tuple[1];
|
|
5353
|
+
switch (type) {
|
|
5354
|
+
case 10:
|
|
5355
|
+
entity.corners[0].x = value;
|
|
5356
|
+
break;
|
|
5357
|
+
case 20:
|
|
5358
|
+
entity.corners[0].y = value;
|
|
5359
|
+
break;
|
|
5360
|
+
case 30:
|
|
5361
|
+
entity.corners[0].z = value;
|
|
5362
|
+
break;
|
|
5363
|
+
case 11:
|
|
5364
|
+
entity.corners[1].x = value;
|
|
5365
|
+
break;
|
|
5366
|
+
case 21:
|
|
5367
|
+
entity.corners[1].y = value;
|
|
5368
|
+
break;
|
|
5369
|
+
case 31:
|
|
5370
|
+
entity.corners[1].z = value;
|
|
5371
|
+
break;
|
|
5372
|
+
case 12:
|
|
5373
|
+
entity.corners[2].x = value;
|
|
5374
|
+
break;
|
|
5375
|
+
case 22:
|
|
5376
|
+
entity.corners[2].y = value;
|
|
5377
|
+
break;
|
|
5378
|
+
case 32:
|
|
5379
|
+
entity.corners[2].z = value;
|
|
5380
|
+
break;
|
|
5381
|
+
case 13:
|
|
5382
|
+
entity.corners[3].x = value;
|
|
5383
|
+
break;
|
|
5384
|
+
case 23:
|
|
5385
|
+
entity.corners[3].y = value;
|
|
5386
|
+
break;
|
|
5387
|
+
case 33:
|
|
5388
|
+
entity.corners[3].z = value;
|
|
5389
|
+
break;
|
|
5390
|
+
case 39:
|
|
5391
|
+
entity.thickness = value;
|
|
5392
|
+
break;
|
|
5393
|
+
default:
|
|
5394
|
+
Object.assign(entity, parseCommonEntityProperties(type, value));
|
|
5395
|
+
break;
|
|
5396
|
+
}
|
|
5397
|
+
return entity;
|
|
5398
|
+
},
|
|
5399
|
+
{
|
|
5400
|
+
type: TYPE32,
|
|
5401
|
+
corners: [{}, {}, {}, {}]
|
|
5402
|
+
}
|
|
5403
|
+
);
|
|
5404
|
+
};
|
|
5405
|
+
var trace_default = { TYPE: TYPE32, process: process32 };
|
|
4883
5406
|
|
|
4884
5407
|
// src/handlers/entity/vertex.ts
|
|
4885
|
-
var
|
|
5408
|
+
var TYPE33 = "VERTEX";
|
|
4886
5409
|
var ensureFaces = (entity) => {
|
|
4887
5410
|
entity.faces = entity.faces || [];
|
|
4888
5411
|
if ("x" in entity && !entity.x) delete entity.x;
|
|
4889
5412
|
if ("y" in entity && !entity.y) delete entity.y;
|
|
4890
5413
|
if ("z" in entity && !entity.z) delete entity.z;
|
|
4891
5414
|
};
|
|
4892
|
-
var
|
|
5415
|
+
var process33 = (tuples) => {
|
|
4893
5416
|
return tuples.reduce((entity, tuple) => {
|
|
4894
5417
|
const type = tuple[0];
|
|
4895
5418
|
const value = tuple[1];
|
|
@@ -4928,11 +5451,11 @@ var dxf = (() => {
|
|
|
4928
5451
|
return entity;
|
|
4929
5452
|
}, {});
|
|
4930
5453
|
};
|
|
4931
|
-
var vertex_default = { TYPE:
|
|
5454
|
+
var vertex_default = { TYPE: TYPE33, process: process33 };
|
|
4932
5455
|
|
|
4933
5456
|
// src/handlers/entity/viewport.ts
|
|
4934
|
-
var
|
|
4935
|
-
var
|
|
5457
|
+
var TYPE34 = "VIEWPORT";
|
|
5458
|
+
var process34 = (tuples) => {
|
|
4936
5459
|
return tuples.reduce(
|
|
4937
5460
|
(entity, tuple) => {
|
|
4938
5461
|
const type = tuple[0];
|
|
@@ -5030,7 +5553,7 @@ var dxf = (() => {
|
|
|
5030
5553
|
return entity;
|
|
5031
5554
|
},
|
|
5032
5555
|
{
|
|
5033
|
-
type:
|
|
5556
|
+
type: TYPE34,
|
|
5034
5557
|
center: {},
|
|
5035
5558
|
centerDCS: {},
|
|
5036
5559
|
snap: {},
|
|
@@ -5041,26 +5564,156 @@ var dxf = (() => {
|
|
|
5041
5564
|
}
|
|
5042
5565
|
);
|
|
5043
5566
|
};
|
|
5044
|
-
var viewport_default = { TYPE:
|
|
5567
|
+
var viewport_default = { TYPE: TYPE34, process: process34 };
|
|
5568
|
+
|
|
5569
|
+
// src/handlers/entity/wipeout.ts
|
|
5570
|
+
var TYPE35 = "WIPEOUT";
|
|
5571
|
+
var process35 = (tuples) => {
|
|
5572
|
+
let pendingBoundaryX = null;
|
|
5573
|
+
return tuples.reduce(
|
|
5574
|
+
(entity, tuple) => {
|
|
5575
|
+
const type = tuple[0];
|
|
5576
|
+
const value = tuple[1];
|
|
5577
|
+
switch (type) {
|
|
5578
|
+
case 90:
|
|
5579
|
+
entity.classVersion = value;
|
|
5580
|
+
break;
|
|
5581
|
+
case 10:
|
|
5582
|
+
entity.insertionPoint.x = value;
|
|
5583
|
+
break;
|
|
5584
|
+
case 20:
|
|
5585
|
+
entity.insertionPoint.y = value;
|
|
5586
|
+
break;
|
|
5587
|
+
case 30:
|
|
5588
|
+
entity.insertionPoint.z = value;
|
|
5589
|
+
break;
|
|
5590
|
+
case 11:
|
|
5591
|
+
entity.uVector.x = value;
|
|
5592
|
+
break;
|
|
5593
|
+
case 21:
|
|
5594
|
+
entity.uVector.y = value;
|
|
5595
|
+
break;
|
|
5596
|
+
case 31:
|
|
5597
|
+
entity.uVector.z = value;
|
|
5598
|
+
break;
|
|
5599
|
+
case 12:
|
|
5600
|
+
entity.vVector.x = value;
|
|
5601
|
+
break;
|
|
5602
|
+
case 22:
|
|
5603
|
+
entity.vVector.y = value;
|
|
5604
|
+
break;
|
|
5605
|
+
case 32:
|
|
5606
|
+
entity.vVector.z = value;
|
|
5607
|
+
break;
|
|
5608
|
+
case 13:
|
|
5609
|
+
entity.imageSizePixels ??= { u: 0, v: 0 };
|
|
5610
|
+
entity.imageSizePixels.u = value;
|
|
5611
|
+
break;
|
|
5612
|
+
case 23:
|
|
5613
|
+
entity.imageSizePixels ??= { u: 0, v: 0 };
|
|
5614
|
+
entity.imageSizePixels.v = value;
|
|
5615
|
+
break;
|
|
5616
|
+
case 70:
|
|
5617
|
+
entity.displayProperties = value;
|
|
5618
|
+
break;
|
|
5619
|
+
case 280:
|
|
5620
|
+
entity.clippingState = value;
|
|
5621
|
+
break;
|
|
5622
|
+
case 71:
|
|
5623
|
+
entity.clipBoundaryType = value;
|
|
5624
|
+
break;
|
|
5625
|
+
case 14:
|
|
5626
|
+
pendingBoundaryX = value;
|
|
5627
|
+
break;
|
|
5628
|
+
case 24:
|
|
5629
|
+
if (pendingBoundaryX !== null) {
|
|
5630
|
+
entity.clipBoundaryVertices ??= [];
|
|
5631
|
+
entity.clipBoundaryVertices.push({ x: pendingBoundaryX, y: value });
|
|
5632
|
+
pendingBoundaryX = null;
|
|
5633
|
+
}
|
|
5634
|
+
break;
|
|
5635
|
+
default:
|
|
5636
|
+
Object.assign(entity, parseCommonEntityProperties(type, value));
|
|
5637
|
+
break;
|
|
5638
|
+
}
|
|
5639
|
+
return entity;
|
|
5640
|
+
},
|
|
5641
|
+
{
|
|
5642
|
+
type: TYPE35,
|
|
5643
|
+
insertionPoint: {},
|
|
5644
|
+
uVector: {},
|
|
5645
|
+
vVector: {}
|
|
5646
|
+
}
|
|
5647
|
+
);
|
|
5648
|
+
};
|
|
5649
|
+
var wipeout_default = { TYPE: TYPE35, process: process35 };
|
|
5650
|
+
|
|
5651
|
+
// src/handlers/entity/xline.ts
|
|
5652
|
+
var TYPE36 = "XLINE";
|
|
5653
|
+
var process36 = (tuples) => {
|
|
5654
|
+
return tuples.reduce(
|
|
5655
|
+
(entity, tuple) => {
|
|
5656
|
+
const type = tuple[0];
|
|
5657
|
+
const value = tuple[1];
|
|
5658
|
+
switch (type) {
|
|
5659
|
+
case 10:
|
|
5660
|
+
entity.basePoint.x = value;
|
|
5661
|
+
break;
|
|
5662
|
+
case 20:
|
|
5663
|
+
entity.basePoint.y = value;
|
|
5664
|
+
break;
|
|
5665
|
+
case 30:
|
|
5666
|
+
entity.basePoint.z = value;
|
|
5667
|
+
break;
|
|
5668
|
+
case 11:
|
|
5669
|
+
entity.direction.x = value;
|
|
5670
|
+
break;
|
|
5671
|
+
case 21:
|
|
5672
|
+
entity.direction.y = value;
|
|
5673
|
+
break;
|
|
5674
|
+
case 31:
|
|
5675
|
+
entity.direction.z = value;
|
|
5676
|
+
break;
|
|
5677
|
+
default:
|
|
5678
|
+
Object.assign(entity, parseCommonEntityProperties(type, value));
|
|
5679
|
+
break;
|
|
5680
|
+
}
|
|
5681
|
+
return entity;
|
|
5682
|
+
},
|
|
5683
|
+
{
|
|
5684
|
+
type: TYPE36,
|
|
5685
|
+
basePoint: {},
|
|
5686
|
+
direction: {}
|
|
5687
|
+
}
|
|
5688
|
+
);
|
|
5689
|
+
};
|
|
5690
|
+
var xline_default = { TYPE: TYPE36, process: process36 };
|
|
5045
5691
|
|
|
5046
5692
|
// src/handlers/entities.ts
|
|
5047
5693
|
var handlers = [
|
|
5048
5694
|
point_default,
|
|
5049
5695
|
line_default,
|
|
5050
5696
|
lwpolyline_default,
|
|
5697
|
+
mline_default,
|
|
5698
|
+
mleader_default,
|
|
5051
5699
|
polyline_default,
|
|
5052
5700
|
vertex_default,
|
|
5053
5701
|
circle_default,
|
|
5054
5702
|
arc_default,
|
|
5055
5703
|
ellipse_default,
|
|
5056
5704
|
spline_default,
|
|
5705
|
+
table_default,
|
|
5057
5706
|
solid_default,
|
|
5707
|
+
trace_default,
|
|
5058
5708
|
hatch_default,
|
|
5059
5709
|
image_default,
|
|
5060
5710
|
leader_default,
|
|
5711
|
+
ray_default,
|
|
5712
|
+
region_default,
|
|
5061
5713
|
dwfUnderlay_default,
|
|
5062
5714
|
dgnUnderlay_default,
|
|
5063
5715
|
pdfUnderlay_default,
|
|
5716
|
+
shape_default,
|
|
5064
5717
|
mtext_default,
|
|
5065
5718
|
tolerance_default,
|
|
5066
5719
|
attdef_default,
|
|
@@ -5070,7 +5723,10 @@ var dxf = (() => {
|
|
|
5070
5723
|
dimension_default,
|
|
5071
5724
|
threeDFace_default,
|
|
5072
5725
|
viewport_default,
|
|
5073
|
-
ole2Frame_default
|
|
5726
|
+
ole2Frame_default,
|
|
5727
|
+
oleframe_default,
|
|
5728
|
+
xline_default,
|
|
5729
|
+
wipeout_default
|
|
5074
5730
|
].reduce((acc, mod) => {
|
|
5075
5731
|
acc[mod.TYPE] = mod;
|
|
5076
5732
|
return acc;
|
|
@@ -5475,6 +6131,36 @@ var dxf = (() => {
|
|
|
5475
6131
|
}
|
|
5476
6132
|
return reactor;
|
|
5477
6133
|
}
|
|
6134
|
+
function parseDimAssocObject(group) {
|
|
6135
|
+
if (group[0]?.[1] !== "DIMASSOC") return void 0;
|
|
6136
|
+
const tuples = group.slice(1);
|
|
6137
|
+
const dimAssoc = {
|
|
6138
|
+
type: "DIMASSOC",
|
|
6139
|
+
tuples
|
|
6140
|
+
};
|
|
6141
|
+
for (const tuple of tuples) {
|
|
6142
|
+
const type = tuple[0];
|
|
6143
|
+
const value = tuple[1];
|
|
6144
|
+
if (type === 5) dimAssoc.handle = value;
|
|
6145
|
+
if (type === 330) dimAssoc.ownerHandle = value;
|
|
6146
|
+
}
|
|
6147
|
+
return dimAssoc;
|
|
6148
|
+
}
|
|
6149
|
+
function parseFieldObject(group) {
|
|
6150
|
+
if (group[0]?.[1] !== "FIELD") return void 0;
|
|
6151
|
+
const tuples = group.slice(1);
|
|
6152
|
+
const field = {
|
|
6153
|
+
type: "FIELD",
|
|
6154
|
+
tuples
|
|
6155
|
+
};
|
|
6156
|
+
for (const tuple of tuples) {
|
|
6157
|
+
const type = tuple[0];
|
|
6158
|
+
const value = tuple[1];
|
|
6159
|
+
if (type === 5) field.handle = value;
|
|
6160
|
+
if (type === 330) field.ownerHandle = value;
|
|
6161
|
+
}
|
|
6162
|
+
return field;
|
|
6163
|
+
}
|
|
5478
6164
|
var UNDERLAY_DEFINITION_OBJECT_TYPES = /* @__PURE__ */ new Set([
|
|
5479
6165
|
"UNDERLAYDEFINITION",
|
|
5480
6166
|
"PDFDEFINITION",
|
|
@@ -5544,6 +6230,16 @@ var dxf = (() => {
|
|
|
5544
6230
|
const def = parseUnderlayDefinitionObject(group);
|
|
5545
6231
|
const handle = def?.handle ? String(def.handle) : void 0;
|
|
5546
6232
|
if (def && handle) objects.underlayDefinitions[handle] = def;
|
|
6233
|
+
},
|
|
6234
|
+
DIMASSOC: (objects, group) => {
|
|
6235
|
+
const dimAssoc = parseDimAssocObject(group);
|
|
6236
|
+
const handle = dimAssoc?.handle ? String(dimAssoc.handle) : void 0;
|
|
6237
|
+
if (dimAssoc && handle) objects.dimAssocs[handle] = dimAssoc;
|
|
6238
|
+
},
|
|
6239
|
+
FIELD: (objects, group) => {
|
|
6240
|
+
const field = parseFieldObject(group);
|
|
6241
|
+
const handle = field?.handle ? String(field.handle) : void 0;
|
|
6242
|
+
if (field && handle) objects.fields[handle] = field;
|
|
5547
6243
|
}
|
|
5548
6244
|
};
|
|
5549
6245
|
function parseObjects(tuples) {
|
|
@@ -5553,7 +6249,9 @@ var dxf = (() => {
|
|
|
5553
6249
|
xRecords: {},
|
|
5554
6250
|
imageDefs: {},
|
|
5555
6251
|
imageDefReactors: {},
|
|
5556
|
-
underlayDefinitions: {}
|
|
6252
|
+
underlayDefinitions: {},
|
|
6253
|
+
dimAssocs: {},
|
|
6254
|
+
fields: {}
|
|
5557
6255
|
};
|
|
5558
6256
|
const groups = groupObjectsByZero(tuples);
|
|
5559
6257
|
for (const group of groups) {
|
|
@@ -5723,6 +6421,7 @@ var dxf = (() => {
|
|
|
5723
6421
|
const type = tuple[0];
|
|
5724
6422
|
const value = tuple[1];
|
|
5725
6423
|
switch (type) {
|
|
6424
|
+
// NOSONAR
|
|
5726
6425
|
case 2:
|
|
5727
6426
|
vport.name = value;
|
|
5728
6427
|
break;
|
|
@@ -5804,36 +6503,112 @@ var dxf = (() => {
|
|
|
5804
6503
|
case 121:
|
|
5805
6504
|
vport.xAxisY = Number.parseFloat(String(value));
|
|
5806
6505
|
break;
|
|
5807
|
-
case 131:
|
|
5808
|
-
vport.xAxisZ = Number.parseFloat(String(value));
|
|
6506
|
+
case 131:
|
|
6507
|
+
vport.xAxisZ = Number.parseFloat(String(value));
|
|
6508
|
+
break;
|
|
6509
|
+
case 112:
|
|
6510
|
+
vport.xAxisX = Number.parseFloat(String(value));
|
|
6511
|
+
break;
|
|
6512
|
+
case 122:
|
|
6513
|
+
vport.xAxisY = Number.parseFloat(String(value));
|
|
6514
|
+
break;
|
|
6515
|
+
case 132:
|
|
6516
|
+
vport.xAxisZ = Number.parseFloat(String(value));
|
|
6517
|
+
break;
|
|
6518
|
+
case 146:
|
|
6519
|
+
vport.elevation = Number.parseFloat(String(value));
|
|
6520
|
+
break;
|
|
6521
|
+
default:
|
|
6522
|
+
}
|
|
6523
|
+
return vport;
|
|
6524
|
+
},
|
|
6525
|
+
{
|
|
6526
|
+
type: "VPORT",
|
|
6527
|
+
center: {},
|
|
6528
|
+
lowerLeft: {},
|
|
6529
|
+
upperRight: {},
|
|
6530
|
+
snap: {},
|
|
6531
|
+
snapSpacing: {},
|
|
6532
|
+
gridSpacing: {},
|
|
6533
|
+
direction: {},
|
|
6534
|
+
target: {}
|
|
6535
|
+
}
|
|
6536
|
+
);
|
|
6537
|
+
};
|
|
6538
|
+
var appIdHandler = (tuples) => {
|
|
6539
|
+
return tuples.reduce(
|
|
6540
|
+
(appId, tuple) => {
|
|
6541
|
+
const type = tuple[0];
|
|
6542
|
+
const value = tuple[1];
|
|
6543
|
+
switch (type) {
|
|
6544
|
+
case 2:
|
|
6545
|
+
appId.name = value;
|
|
6546
|
+
break;
|
|
6547
|
+
case 70:
|
|
6548
|
+
appId.flags = value;
|
|
6549
|
+
break;
|
|
6550
|
+
default:
|
|
6551
|
+
}
|
|
6552
|
+
return appId;
|
|
6553
|
+
},
|
|
6554
|
+
{ type: "APPID" }
|
|
6555
|
+
);
|
|
6556
|
+
};
|
|
6557
|
+
var blockRecordHandler = (tuples) => {
|
|
6558
|
+
return tuples.reduce(
|
|
6559
|
+
(blockRecord, tuple) => {
|
|
6560
|
+
const type = tuple[0];
|
|
6561
|
+
const value = tuple[1];
|
|
6562
|
+
switch (type) {
|
|
6563
|
+
case 2:
|
|
6564
|
+
blockRecord.name = value;
|
|
6565
|
+
break;
|
|
6566
|
+
case 70:
|
|
6567
|
+
blockRecord.flags = value;
|
|
5809
6568
|
break;
|
|
5810
|
-
|
|
5811
|
-
|
|
6569
|
+
default:
|
|
6570
|
+
}
|
|
6571
|
+
return blockRecord;
|
|
6572
|
+
},
|
|
6573
|
+
{ type: "BLOCK_RECORD" }
|
|
6574
|
+
);
|
|
6575
|
+
};
|
|
6576
|
+
var ucsHandler = (tuples) => {
|
|
6577
|
+
return tuples.reduce(
|
|
6578
|
+
(ucs, tuple) => {
|
|
6579
|
+
const type = tuple[0];
|
|
6580
|
+
const value = tuple[1];
|
|
6581
|
+
switch (type) {
|
|
6582
|
+
case 2:
|
|
6583
|
+
ucs.name = value;
|
|
5812
6584
|
break;
|
|
5813
|
-
case
|
|
5814
|
-
|
|
6585
|
+
case 70:
|
|
6586
|
+
ucs.flags = value;
|
|
5815
6587
|
break;
|
|
5816
|
-
|
|
5817
|
-
|
|
6588
|
+
default:
|
|
6589
|
+
}
|
|
6590
|
+
return ucs;
|
|
6591
|
+
},
|
|
6592
|
+
{ type: "UCS" }
|
|
6593
|
+
);
|
|
6594
|
+
};
|
|
6595
|
+
var viewHandler = (tuples) => {
|
|
6596
|
+
return tuples.reduce(
|
|
6597
|
+
(view, tuple) => {
|
|
6598
|
+
const type = tuple[0];
|
|
6599
|
+
const value = tuple[1];
|
|
6600
|
+
switch (type) {
|
|
6601
|
+
case 2:
|
|
6602
|
+
view.name = value;
|
|
5818
6603
|
break;
|
|
5819
|
-
case
|
|
5820
|
-
|
|
6604
|
+
case 70:
|
|
6605
|
+
view.flags = value;
|
|
5821
6606
|
break;
|
|
5822
6607
|
default:
|
|
5823
6608
|
}
|
|
5824
|
-
return
|
|
6609
|
+
return view;
|
|
5825
6610
|
},
|
|
5826
|
-
{
|
|
5827
|
-
type: "VPORT",
|
|
5828
|
-
center: {},
|
|
5829
|
-
lowerLeft: {},
|
|
5830
|
-
upperRight: {},
|
|
5831
|
-
snap: {},
|
|
5832
|
-
snapSpacing: {},
|
|
5833
|
-
gridSpacing: {},
|
|
5834
|
-
direction: {},
|
|
5835
|
-
target: {}
|
|
5836
|
-
}
|
|
6611
|
+
{ type: "VIEW" }
|
|
5837
6612
|
);
|
|
5838
6613
|
};
|
|
5839
6614
|
var dimStyleHandler = (tuples) => {
|
|
@@ -5842,6 +6617,7 @@ var dxf = (() => {
|
|
|
5842
6617
|
const type = tuple[0];
|
|
5843
6618
|
const value = tuple[1];
|
|
5844
6619
|
switch (type) {
|
|
6620
|
+
// NOSONAR
|
|
5845
6621
|
case 2:
|
|
5846
6622
|
dimStyle.name = value;
|
|
5847
6623
|
break;
|
|
@@ -6092,30 +6868,31 @@ var dxf = (() => {
|
|
|
6092
6868
|
tableTuples.push(tuple);
|
|
6093
6869
|
}
|
|
6094
6870
|
}
|
|
6095
|
-
|
|
6096
|
-
let layersTuples = [];
|
|
6097
|
-
let vPortTuples = [];
|
|
6098
|
-
let ltypeTuples = [];
|
|
6099
|
-
let dimStyleTuples = [];
|
|
6871
|
+
const groupsByName = {};
|
|
6100
6872
|
for (const group of tableGroups) {
|
|
6101
|
-
|
|
6102
|
-
|
|
6103
|
-
|
|
6104
|
-
|
|
6105
|
-
|
|
6106
|
-
|
|
6107
|
-
|
|
6108
|
-
|
|
6109
|
-
|
|
6110
|
-
|
|
6111
|
-
|
|
6112
|
-
|
|
6873
|
+
const name = String(group[0]?.[1] ?? "");
|
|
6874
|
+
if (!name) continue;
|
|
6875
|
+
groupsByName[name] = group;
|
|
6876
|
+
}
|
|
6877
|
+
const stylesTuples = groupsByName.STYLE ?? [];
|
|
6878
|
+
const layersTuples = groupsByName.LAYER ?? [];
|
|
6879
|
+
const vPortTuples = groupsByName.VPORT ?? [];
|
|
6880
|
+
const ltypeTuples = groupsByName.LTYPE ?? [];
|
|
6881
|
+
const dimStyleTuples = groupsByName.DIMSTYLE ?? [];
|
|
6882
|
+
const appIdTuples = groupsByName.APPID ?? [];
|
|
6883
|
+
const blockRecordTuples = groupsByName.BLOCK_RECORD ?? [];
|
|
6884
|
+
const ucsTuples = groupsByName.UCS ?? [];
|
|
6885
|
+
const viewTuples = groupsByName.VIEW ?? [];
|
|
6113
6886
|
return {
|
|
6114
6887
|
layers: tableHandler(layersTuples, "LAYER", layerHandler),
|
|
6115
6888
|
styles: tableHandler(stylesTuples, "STYLE", styleHandler),
|
|
6116
6889
|
vports: tableHandler(vPortTuples, "VPORT", vPortHandler),
|
|
6117
6890
|
ltypes: tableHandler(ltypeTuples, "LTYPE", ltypeHandler),
|
|
6118
|
-
dimStyles: tableHandler(dimStyleTuples, "DIMSTYLE", dimStyleHandler)
|
|
6891
|
+
dimStyles: tableHandler(dimStyleTuples, "DIMSTYLE", dimStyleHandler),
|
|
6892
|
+
appids: tableHandler(appIdTuples, "APPID", appIdHandler),
|
|
6893
|
+
blockRecords: tableHandler(blockRecordTuples, "BLOCK_RECORD", blockRecordHandler),
|
|
6894
|
+
ucs: tableHandler(ucsTuples, "UCS", ucsHandler),
|
|
6895
|
+
views: tableHandler(viewTuples, "VIEW", viewHandler)
|
|
6119
6896
|
};
|
|
6120
6897
|
}
|
|
6121
6898
|
|
|
@@ -6199,171 +6976,11 @@ var dxf = (() => {
|
|
|
6199
6976
|
return result;
|
|
6200
6977
|
}
|
|
6201
6978
|
|
|
6202
|
-
// src/
|
|
6203
|
-
|
|
6204
|
-
|
|
6205
|
-
const
|
|
6206
|
-
|
|
6207
|
-
line.start.y -= block.y;
|
|
6208
|
-
line.end.x -= block.x;
|
|
6209
|
-
line.end.y -= block.y;
|
|
6210
|
-
}
|
|
6211
|
-
function adjustPolylineForBlockBasePoint(entity, block) {
|
|
6212
|
-
const poly = entity;
|
|
6213
|
-
for (const v of poly.vertices) {
|
|
6214
|
-
if (v.x !== void 0) v.x -= block.x;
|
|
6215
|
-
if (v.y !== void 0) v.y -= block.y;
|
|
6216
|
-
}
|
|
6217
|
-
}
|
|
6218
|
-
function adjustCircleForBlockBasePoint(entity, block) {
|
|
6219
|
-
const circle2 = entity;
|
|
6220
|
-
circle2.x -= block.x;
|
|
6221
|
-
circle2.y -= block.y;
|
|
6222
|
-
}
|
|
6223
|
-
function adjustEllipseForBlockBasePoint(entity, block) {
|
|
6224
|
-
const ellipse2 = entity;
|
|
6225
|
-
ellipse2.x -= block.x;
|
|
6226
|
-
ellipse2.y -= block.y;
|
|
6227
|
-
}
|
|
6228
|
-
function adjustArcForBlockBasePoint(entity, block) {
|
|
6229
|
-
const arc2 = entity;
|
|
6230
|
-
arc2.x -= block.x;
|
|
6231
|
-
arc2.y -= block.y;
|
|
6232
|
-
}
|
|
6233
|
-
function adjustSplineForBlockBasePoint(entity, block) {
|
|
6234
|
-
const spline = entity;
|
|
6235
|
-
for (const cp of spline.controlPoints) {
|
|
6236
|
-
cp.x -= block.x;
|
|
6237
|
-
cp.y -= block.y;
|
|
6238
|
-
}
|
|
6239
|
-
}
|
|
6240
|
-
function adjustTextForBlockBasePoint(entity, block) {
|
|
6241
|
-
const text2 = entity;
|
|
6242
|
-
if (text2.x !== void 0) text2.x -= block.x;
|
|
6243
|
-
if (text2.y !== void 0) text2.y -= block.y;
|
|
6244
|
-
if (text2.x2 !== void 0) text2.x2 -= block.x;
|
|
6245
|
-
if (text2.y2 !== void 0) text2.y2 -= block.y;
|
|
6246
|
-
}
|
|
6247
|
-
function adjustMTextForBlockBasePoint(entity, block) {
|
|
6248
|
-
const mtext2 = entity;
|
|
6249
|
-
if (mtext2.x !== void 0) mtext2.x -= block.x;
|
|
6250
|
-
if (mtext2.y !== void 0) mtext2.y -= block.y;
|
|
6251
|
-
}
|
|
6252
|
-
function adjustDimensionForBlockBasePoint(entity, block) {
|
|
6253
|
-
const dim = entity;
|
|
6254
|
-
dim.start.x -= block.x;
|
|
6255
|
-
dim.start.y -= block.y;
|
|
6256
|
-
dim.textMidpoint.x -= block.x;
|
|
6257
|
-
dim.textMidpoint.y -= block.y;
|
|
6258
|
-
dim.measureStart.x -= block.x;
|
|
6259
|
-
dim.measureStart.y -= block.y;
|
|
6260
|
-
dim.measureEnd.x -= block.x;
|
|
6261
|
-
dim.measureEnd.y -= block.y;
|
|
6262
|
-
}
|
|
6263
|
-
var BLOCK_BASEPOINT_ADJUSTERS = {
|
|
6264
|
-
LINE: adjustLineForBlockBasePoint,
|
|
6265
|
-
LWPOLYLINE: adjustPolylineForBlockBasePoint,
|
|
6266
|
-
POLYLINE: adjustPolylineForBlockBasePoint,
|
|
6267
|
-
CIRCLE: adjustCircleForBlockBasePoint,
|
|
6268
|
-
ELLIPSE: adjustEllipseForBlockBasePoint,
|
|
6269
|
-
ARC: adjustArcForBlockBasePoint,
|
|
6270
|
-
SPLINE: adjustSplineForBlockBasePoint,
|
|
6271
|
-
TEXT: adjustTextForBlockBasePoint,
|
|
6272
|
-
MTEXT: adjustMTextForBlockBasePoint,
|
|
6273
|
-
DIMENSION: adjustDimensionForBlockBasePoint
|
|
6274
|
-
};
|
|
6275
|
-
function applyBlockBasePointAdjustment(entity, block) {
|
|
6276
|
-
const adjust = BLOCK_BASEPOINT_ADJUSTERS[entity.type];
|
|
6277
|
-
if (adjust) adjust(entity, block);
|
|
6278
|
-
}
|
|
6279
|
-
function computeRectangularArrayVectors(insert) {
|
|
6280
|
-
const rowCount = insert.rowCount ?? 1;
|
|
6281
|
-
const columnCount = insert.columnCount ?? 1;
|
|
6282
|
-
const rowSpacing = insert.rowSpacing ?? 0;
|
|
6283
|
-
const columnSpacing = insert.columnSpacing ?? 0;
|
|
6284
|
-
const rotation = insert.rotation ?? 0;
|
|
6285
|
-
if (rowCount <= 1 && columnCount <= 1) {
|
|
6286
|
-
return { rowVec: { x: 0, y: 0 }, colVec: { x: 0, y: 0 } };
|
|
6287
|
-
}
|
|
6288
|
-
const cos = Math.cos(rotation * Math.PI / 180);
|
|
6289
|
-
const sin = Math.sin(rotation * Math.PI / 180);
|
|
6290
|
-
return {
|
|
6291
|
-
rowVec: { x: -sin * rowSpacing, y: cos * rowSpacing },
|
|
6292
|
-
colVec: { x: cos * columnSpacing, y: sin * columnSpacing }
|
|
6293
|
-
};
|
|
6294
|
-
}
|
|
6295
|
-
function expandInsert(insert, blocksByName, transforms, gatherEntities) {
|
|
6296
|
-
const block = blocksByName[insert.block];
|
|
6297
|
-
if (!block) {
|
|
6298
|
-
logger_default.error("no block found for insert. block:", insert.block);
|
|
6299
|
-
return [];
|
|
6300
|
-
}
|
|
6301
|
-
const rowCount = insert.rowCount ?? 1;
|
|
6302
|
-
const columnCount = insert.columnCount ?? 1;
|
|
6303
|
-
const { rowVec, colVec } = computeRectangularArrayVectors(insert);
|
|
6304
|
-
const current = [];
|
|
6305
|
-
for (let r = 0; r < rowCount; r++) {
|
|
6306
|
-
for (let c = 0; c < columnCount; c++) {
|
|
6307
|
-
const t = {
|
|
6308
|
-
x: insert.x + rowVec.x * r + colVec.x * c,
|
|
6309
|
-
y: insert.y + rowVec.y * r + colVec.y * c,
|
|
6310
|
-
scaleX: insert.scaleX,
|
|
6311
|
-
scaleY: insert.scaleY,
|
|
6312
|
-
scaleZ: insert.scaleZ,
|
|
6313
|
-
extrusionX: insert.extrusionX,
|
|
6314
|
-
extrusionY: insert.extrusionY,
|
|
6315
|
-
extrusionZ: insert.extrusionZ,
|
|
6316
|
-
rotation: insert.rotation
|
|
6317
|
-
};
|
|
6318
|
-
const transforms2 = transforms.slice(0);
|
|
6319
|
-
transforms2.push(t);
|
|
6320
|
-
const blockEntities = block.entities.map((be) => {
|
|
6321
|
-
const be2 = (0, import_cloneDeep.default)(be);
|
|
6322
|
-
be2.layer = insert.layer;
|
|
6323
|
-
applyBlockBasePointAdjustment(be2, block);
|
|
6324
|
-
return be2;
|
|
6325
|
-
});
|
|
6326
|
-
current.push(...gatherEntities(blockEntities, transforms2));
|
|
6327
|
-
}
|
|
6328
|
-
}
|
|
6329
|
-
return current;
|
|
6330
|
-
}
|
|
6331
|
-
function denormalise(parseResult) {
|
|
6332
|
-
const blocksByName = parseResult.blocks.reduce(
|
|
6333
|
-
(acc, b) => {
|
|
6334
|
-
acc[b.name] = b;
|
|
6335
|
-
return acc;
|
|
6336
|
-
},
|
|
6337
|
-
{}
|
|
6338
|
-
);
|
|
6339
|
-
const gatherEntities = (entities, transforms) => {
|
|
6340
|
-
const current = [];
|
|
6341
|
-
for (const e of entities) {
|
|
6342
|
-
if (e.type === "INSERT") {
|
|
6343
|
-
current.push(
|
|
6344
|
-
...expandInsert(e, blocksByName, transforms, gatherEntities)
|
|
6345
|
-
);
|
|
6346
|
-
} else {
|
|
6347
|
-
const e2 = (0, import_cloneDeep.default)(e);
|
|
6348
|
-
e2.transforms = transforms.slice().reverse();
|
|
6349
|
-
current.push(e2);
|
|
6350
|
-
}
|
|
6351
|
-
}
|
|
6352
|
-
return current;
|
|
6353
|
-
};
|
|
6354
|
-
return gatherEntities(parseResult.entities, []);
|
|
6355
|
-
}
|
|
6356
|
-
|
|
6357
|
-
// src/groupEntitiesByLayer.ts
|
|
6358
|
-
function groupEntitiesByLayer(entities) {
|
|
6359
|
-
return entities.reduce((acc, entity) => {
|
|
6360
|
-
const layer = entity.layer ?? "0";
|
|
6361
|
-
if (!acc[layer]) {
|
|
6362
|
-
acc[layer] = [];
|
|
6363
|
-
}
|
|
6364
|
-
acc[layer].push(entity);
|
|
6365
|
-
return acc;
|
|
6366
|
-
}, {});
|
|
6979
|
+
// src/toJson.ts
|
|
6980
|
+
function toJson(parsed, options = {}) {
|
|
6981
|
+
const shouldPrettyPrint = options.pretty === true;
|
|
6982
|
+
const indentation = shouldPrettyPrint ? options.space ?? 2 : void 0;
|
|
6983
|
+
return JSON.stringify(parsed, null, indentation);
|
|
6367
6984
|
}
|
|
6368
6985
|
|
|
6369
6986
|
// src/toPolylines.ts
|
|
@@ -6655,12 +7272,95 @@ var dxf = (() => {
|
|
|
6655
7272
|
function entityToPolyline(entity, options) {
|
|
6656
7273
|
options = options || {};
|
|
6657
7274
|
let polyline2;
|
|
7275
|
+
const INFINITE_LINE_LENGTH = 1e3;
|
|
7276
|
+
const normalize2 = (x, y) => {
|
|
7277
|
+
const len = Math.hypot(x, y);
|
|
7278
|
+
if (len === 0) return null;
|
|
7279
|
+
return { x: x / len, y: y / len };
|
|
7280
|
+
};
|
|
6658
7281
|
if (entity.type === "LINE") {
|
|
6659
7282
|
polyline2 = [
|
|
6660
7283
|
[entity.start.x, entity.start.y],
|
|
6661
7284
|
[entity.end.x, entity.end.y]
|
|
6662
7285
|
];
|
|
6663
7286
|
}
|
|
7287
|
+
if (entity.type === "LEADER") {
|
|
7288
|
+
if (entity.vertices.length >= 2) {
|
|
7289
|
+
polyline2 = entity.vertices.map((v) => [v.x, v.y]);
|
|
7290
|
+
} else {
|
|
7291
|
+
logger_default.warn("LEADER entity with insufficient vertices");
|
|
7292
|
+
polyline2 = [];
|
|
7293
|
+
}
|
|
7294
|
+
}
|
|
7295
|
+
if (entity.type === "RAY") {
|
|
7296
|
+
const dir = normalize2(entity.direction.x, entity.direction.y);
|
|
7297
|
+
if (dir === null) {
|
|
7298
|
+
logger_default.warn("RAY entity with zero direction vector");
|
|
7299
|
+
polyline2 = [];
|
|
7300
|
+
} else {
|
|
7301
|
+
polyline2 = [
|
|
7302
|
+
[entity.start.x, entity.start.y],
|
|
7303
|
+
[
|
|
7304
|
+
entity.start.x + dir.x * INFINITE_LINE_LENGTH,
|
|
7305
|
+
entity.start.y + dir.y * INFINITE_LINE_LENGTH
|
|
7306
|
+
]
|
|
7307
|
+
];
|
|
7308
|
+
}
|
|
7309
|
+
}
|
|
7310
|
+
if (entity.type === "XLINE") {
|
|
7311
|
+
const dir = normalize2(entity.direction.x, entity.direction.y);
|
|
7312
|
+
if (dir === null) {
|
|
7313
|
+
logger_default.warn("XLINE entity with zero direction vector");
|
|
7314
|
+
polyline2 = [];
|
|
7315
|
+
} else {
|
|
7316
|
+
polyline2 = [
|
|
7317
|
+
[
|
|
7318
|
+
entity.basePoint.x - dir.x * INFINITE_LINE_LENGTH,
|
|
7319
|
+
entity.basePoint.y - dir.y * INFINITE_LINE_LENGTH
|
|
7320
|
+
],
|
|
7321
|
+
[
|
|
7322
|
+
entity.basePoint.x + dir.x * INFINITE_LINE_LENGTH,
|
|
7323
|
+
entity.basePoint.y + dir.y * INFINITE_LINE_LENGTH
|
|
7324
|
+
]
|
|
7325
|
+
];
|
|
7326
|
+
}
|
|
7327
|
+
}
|
|
7328
|
+
if (entity.type === "SHAPE") {
|
|
7329
|
+
const x = entity.insertionPoint?.x ?? 0;
|
|
7330
|
+
const y = entity.insertionPoint?.y ?? 0;
|
|
7331
|
+
const size = entity.size ?? 0;
|
|
7332
|
+
const scaleX = entity.relativeXScale ?? 1;
|
|
7333
|
+
const length = size * scaleX;
|
|
7334
|
+
polyline2 = [
|
|
7335
|
+
[x, y],
|
|
7336
|
+
[x + length, y]
|
|
7337
|
+
];
|
|
7338
|
+
}
|
|
7339
|
+
if (entity.type === "WIPEOUT") {
|
|
7340
|
+
const verts = entity.clipBoundaryVertices;
|
|
7341
|
+
if (!verts || verts.length < 2) {
|
|
7342
|
+
logger_default.warn("WIPEOUT entity with missing clip boundary vertices");
|
|
7343
|
+
polyline2 = [];
|
|
7344
|
+
} else {
|
|
7345
|
+
const insX = entity.insertionPoint?.x ?? 0;
|
|
7346
|
+
const insY = entity.insertionPoint?.y ?? 0;
|
|
7347
|
+
const ux = entity.uVector?.x ?? 1;
|
|
7348
|
+
const uy = entity.uVector?.y ?? 0;
|
|
7349
|
+
const vx = entity.vVector?.x ?? 0;
|
|
7350
|
+
const vy = entity.vVector?.y ?? 1;
|
|
7351
|
+
polyline2 = verts.map((p) => [
|
|
7352
|
+
insX + ux * p.x + vx * p.y,
|
|
7353
|
+
insY + uy * p.x + vy * p.y
|
|
7354
|
+
]);
|
|
7355
|
+
if (polyline2.length > 0) {
|
|
7356
|
+
const first = polyline2[0];
|
|
7357
|
+
const last = polyline2[polyline2.length - 1];
|
|
7358
|
+
if (first[0] !== last[0] || first[1] !== last[1]) {
|
|
7359
|
+
polyline2.push(first);
|
|
7360
|
+
}
|
|
7361
|
+
}
|
|
7362
|
+
}
|
|
7363
|
+
}
|
|
6664
7364
|
if (entity.type === "LWPOLYLINE" || entity.type === "POLYLINE") {
|
|
6665
7365
|
polyline2 = [];
|
|
6666
7366
|
if (entity.polyfaceMesh) {
|
|
@@ -6745,6 +7445,18 @@ var dxf = (() => {
|
|
|
6745
7445
|
entity.weights
|
|
6746
7446
|
);
|
|
6747
7447
|
}
|
|
7448
|
+
if (entity.type === "SOLID" || entity.type === "TRACE") {
|
|
7449
|
+
const corners = entity.corners ?? entity.points;
|
|
7450
|
+
if (corners && corners.length >= 4) {
|
|
7451
|
+
polyline2 = [
|
|
7452
|
+
[corners[0].x, corners[0].y],
|
|
7453
|
+
[corners[1].x, corners[1].y],
|
|
7454
|
+
[corners[2].x, corners[2].y],
|
|
7455
|
+
[corners[3].x, corners[3].y],
|
|
7456
|
+
[corners[0].x, corners[0].y]
|
|
7457
|
+
];
|
|
7458
|
+
}
|
|
7459
|
+
}
|
|
6748
7460
|
if (!polyline2) {
|
|
6749
7461
|
logger_default.warn("unsupported entity for converting to polyline:", entity.type);
|
|
6750
7462
|
return [];
|
|
@@ -8029,6 +8741,22 @@ var dxf = (() => {
|
|
|
8029
8741
|
});
|
|
8030
8742
|
return transformBoundingBoxAndElement(bbox, element, entity.transforms ?? []);
|
|
8031
8743
|
};
|
|
8744
|
+
var shape = (entity) => {
|
|
8745
|
+
const x = entity.insertionPoint?.x ?? 0;
|
|
8746
|
+
const y = entity.insertionPoint?.y ?? 0;
|
|
8747
|
+
const height = entity.size ?? 1;
|
|
8748
|
+
const rotation = entity.rotation ?? 0;
|
|
8749
|
+
const content = entity.name ?? "";
|
|
8750
|
+
const textWidth = content.length * height * 0.6;
|
|
8751
|
+
const bbox0 = new import_vecks5.Box2().expandByPoint({ x, y }).expandByPoint({ x: x + textWidth, y: y + height });
|
|
8752
|
+
const rotationDegrees = rotation * 180 / Math.PI;
|
|
8753
|
+
const element0 = `<text x="${x}" y="${y}" font-size="${height}" transform="rotate(${-rotationDegrees} ${x} ${y}) scale(1,-1) translate(0 ${-2 * y})">${escapeXmlText(content)}</text>`;
|
|
8754
|
+
const { bbox, element } = addFlipXIfApplicable(entity, {
|
|
8755
|
+
bbox: bbox0,
|
|
8756
|
+
element: element0
|
|
8757
|
+
});
|
|
8758
|
+
return transformBoundingBoxAndElement(bbox, element, entity.transforms ?? []);
|
|
8759
|
+
};
|
|
8032
8760
|
var dimension = (entity, dimStyle, options, viewport) => {
|
|
8033
8761
|
const result = dimensionToSVG(entity, dimStyle, options, viewport);
|
|
8034
8762
|
return transformBoundingBoxAndElement(
|
|
@@ -8103,18 +8831,30 @@ var dxf = (() => {
|
|
|
8103
8831
|
}
|
|
8104
8832
|
}
|
|
8105
8833
|
case "LINE":
|
|
8834
|
+
case "RAY":
|
|
8835
|
+
case "XLINE":
|
|
8106
8836
|
case "POLYLINE": {
|
|
8107
8837
|
return polyline(entity);
|
|
8108
8838
|
}
|
|
8839
|
+
case "SOLID":
|
|
8840
|
+
case "TRACE": {
|
|
8841
|
+
return polyline(entity);
|
|
8842
|
+
}
|
|
8109
8843
|
case "LWPOLYLINE": {
|
|
8110
8844
|
return lwpolyline(entity);
|
|
8111
8845
|
}
|
|
8846
|
+
case "WIPEOUT": {
|
|
8847
|
+
return polyline(entity);
|
|
8848
|
+
}
|
|
8112
8849
|
case "LEADER": {
|
|
8113
8850
|
return leader(entity);
|
|
8114
8851
|
}
|
|
8115
8852
|
case "TOLERANCE": {
|
|
8116
8853
|
return tolerance(entity);
|
|
8117
8854
|
}
|
|
8855
|
+
case "SHAPE": {
|
|
8856
|
+
return shape(entity);
|
|
8857
|
+
}
|
|
8118
8858
|
default:
|
|
8119
8859
|
logger_default.warn("entity type not supported in SVG rendering:", entity.type);
|
|
8120
8860
|
return null;
|
|
@@ -8156,9 +8896,12 @@ var dxf = (() => {
|
|
|
8156
8896
|
acc.bbox.expandByPoint(bbox2.min);
|
|
8157
8897
|
acc.bbox.expandByPoint(bbox2.max);
|
|
8158
8898
|
}
|
|
8159
|
-
|
|
8160
|
-
|
|
8161
|
-
|
|
8899
|
+
const color = rgbToColorAttribute(rgb);
|
|
8900
|
+
if (entity.type === "SOLID" || entity.type === "TRACE") {
|
|
8901
|
+
acc.elements.push(`<g fill="${color}" stroke="none">${element}</g>`);
|
|
8902
|
+
} else {
|
|
8903
|
+
acc.elements.push(`<g stroke="${color}">${element}</g>`);
|
|
8904
|
+
}
|
|
8162
8905
|
}
|
|
8163
8906
|
return acc;
|
|
8164
8907
|
},
|
|
@@ -8238,6 +8981,9 @@ var dxf = (() => {
|
|
|
8238
8981
|
toSVG(options) {
|
|
8239
8982
|
return toSVG(this.parsed, options);
|
|
8240
8983
|
}
|
|
8984
|
+
toJson(options) {
|
|
8985
|
+
return toJson(this.parsed, options);
|
|
8986
|
+
}
|
|
8241
8987
|
toPolylines() {
|
|
8242
8988
|
return toPolylines(this.parsed);
|
|
8243
8989
|
}
|