@mlightcad/libredwg-converter 3.5.25 → 3.5.27
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/dist/libredwg-converter.js +195 -188
- package/dist/libredwg-converter.umd.cjs +1 -1
- package/dist/libredwg-parser-worker.js +3088 -3048
- package/lib/AcDbEntitiyConverter.d.ts.map +1 -1
- package/lib/AcDbEntitiyConverter.js +45 -4
- package/lib/AcDbEntitiyConverter.js.map +1 -1
- package/package.json +3 -3
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import { AcDbFace as
|
|
2
|
-
class
|
|
1
|
+
import { AcDbFace as m, AcGeVector3d as D, AcDbArc as k, transformOcsPointToWcs as w, AcDbCircle as F, AcDbEllipse as R, AcDbLine as V, AcGePoint3d as T, AcDbSpline as b, AcDbPoint as N, AcDbTrace as B, AcDbPolyline as z, AcGePoint2d as P, AcDbPolygonMesh as j, AcDbPolyFaceMesh as W, AcDbPoly2dType as A, AcDb2dPolyline as H, AcDbPoly3dType as y, AcDb3dPolyline as X, AcDbHatch as G, AcGePolyline2d as U, AcGeLine2d as Y, AcGeCircArc2d as _, AcGeVector2d as Z, AcGeEllipseArc2d as K, AcGeSpline3d as E, AcGeLoop2d as M, AcDbHatchObjectType as q, AcDbTable as J, AcDbText as Q, AcDbMText as $, AcDbLeader as ee, AcDbAlignedDimension as ne, AcDbRotatedDimension as oe, AcDb3PointAngularDimension as te, AcDbOrdinateDimension as se, AcDbRadialDimension as re, AcDbDiametricDimension as ie, AcDbRasterImage as ce, AcDbWipeout as ae, AcDbViewport as le, AcDbRay as de, AcDbXline as pe, AcDbAttributeFlags as I, AcDbAttributeMTextFlag as C, AcDbAttribute as L, AcDbAttributeDefinition as fe, AcDbBlockReference as ue, AcCmTransparency as he, AcDbDatabaseConverter as ge, createWorkerApi as De, AcDbLinetypeTableRecord as Ae, AcDbTextStyleTableRecord as Ie, DEFAULT_TEXT_STYLE as S, AcDbDimStyleTableRecord as ye, AcCmColor as we, AcDbLayerTableRecord as Te, AcDbViewportTableRecord as be, AcDbBlockTableRecord as Pe, AcDbBatchProcessing as Ee, ByLayer as Me, AcDbLayout as Ce, AcDbRasterImageDef as Le } from "@mlightcad/data-model";
|
|
2
|
+
class x {
|
|
3
3
|
convert(e) {
|
|
4
4
|
const n = this.createEntity(e);
|
|
5
5
|
return n && this.processCommonAttrs(e, n), n;
|
|
6
6
|
}
|
|
7
7
|
createEntity(e) {
|
|
8
|
-
return e.type == "3DFACE" ? this.convertFace(e) : e.type == "ARC" ? this.convertArc(e) : e.type == "ATTDEF" ? this.convertAttributeDefinition(e) : e.type == "CIRCLE" ? this.convertCirle(e) : e.type == "DIMENSION" ? this.convertDimension(e) : e.type == "ELLIPSE" ? this.convertEllipse(e) : e.type == "HATCH" ? this.convertHatch(e) : e.type == "IMAGE" ? this.convertImage(e) : e.type == "LEADER" ? this.convertLeader(e) : e.type == "LINE" ? this.convertLine(e) : e.type == "LWPOLYLINE" ? this.convertLWPolyline(e) : e.type == "MTEXT" ? this.convertMText(e) : e.type == "POINT" ? this.convertPoint(e) : e.type == "POLYLINE2D" ? this.convertPolyline2d(e) : e.type == "POLYLINE3D" ? this.convertPolyline3d(e) : e.type == "RAY" ? this.convertRay(e) : e.type == "SPLINE" ? this.convertSpline(e) : e.type == "ACAD_TABLE" ? this.convertTable(e) : e.type == "TEXT" ? this.convertText(e) : e.type == "SOLID" ? this.convertSolid(e) : e.type == "VIEWPORT" ? this.convertViewport(e) : e.type == "WIPEOUT" ? this.convertWipeout(e) : e.type == "XLINE" ? this.convertXline(e) : e.type == "INSERT" ? this.convertBlockReference(e) : null;
|
|
8
|
+
return e.type == "3DFACE" ? this.convertFace(e) : e.type == "ARC" ? this.convertArc(e) : e.type == "ATTDEF" ? this.convertAttributeDefinition(e) : e.type == "ATTRIB" ? this.convertAttribute(e) : e.type == "CIRCLE" ? this.convertCirle(e) : e.type == "DIMENSION" ? this.convertDimension(e) : e.type == "ELLIPSE" ? this.convertEllipse(e) : e.type == "HATCH" ? this.convertHatch(e) : e.type == "IMAGE" ? this.convertImage(e) : e.type == "LEADER" ? this.convertLeader(e) : e.type == "LINE" ? this.convertLine(e) : e.type == "LWPOLYLINE" ? this.convertLWPolyline(e) : e.type == "MTEXT" ? this.convertMText(e) : e.type == "POINT" ? this.convertPoint(e) : e.type == "POLYLINE2D" ? this.convertPolyline2d(e) : e.type == "POLYLINE3D" ? this.convertPolyline3d(e) : e.type == "RAY" ? this.convertRay(e) : e.type == "SPLINE" ? this.convertSpline(e) : e.type == "ACAD_TABLE" ? this.convertTable(e) : e.type == "TEXT" ? this.convertText(e) : e.type == "SOLID" ? this.convertSolid(e) : e.type == "VIEWPORT" ? this.convertViewport(e) : e.type == "WIPEOUT" ? this.convertWipeout(e) : e.type == "XLINE" ? this.convertXline(e) : e.type == "INSERT" ? this.convertBlockReference(e) : null;
|
|
9
9
|
}
|
|
10
10
|
convertFace(e) {
|
|
11
|
-
const n = new
|
|
11
|
+
const n = new m();
|
|
12
12
|
return e.corner1 && n.setVertexAt(0, e.corner1), e.corner2 && n.setVertexAt(1, e.corner2), e.corner3 && n.setVertexAt(2, e.corner3), e.corner4 && n.setVertexAt(3, e.corner4), n.setEdgeInvisibilities(e.flag), n;
|
|
13
13
|
}
|
|
14
14
|
convertArc(e) {
|
|
15
15
|
const n = e.extrusionDirection ?? D.Z_AXIS;
|
|
16
|
-
return new
|
|
16
|
+
return new k(
|
|
17
17
|
w(e.center, n),
|
|
18
18
|
e.radius,
|
|
19
19
|
e.startAngle,
|
|
@@ -23,29 +23,29 @@ class S {
|
|
|
23
23
|
}
|
|
24
24
|
convertCirle(e) {
|
|
25
25
|
const n = e.extrusionDirection ?? D.Z_AXIS;
|
|
26
|
-
return new
|
|
26
|
+
return new F(
|
|
27
27
|
w(e.center, n),
|
|
28
28
|
e.radius,
|
|
29
29
|
n
|
|
30
30
|
);
|
|
31
31
|
}
|
|
32
32
|
convertEllipse(e) {
|
|
33
|
-
const n = new D(e.majorAxisEndPoint),
|
|
33
|
+
const n = new D(e.majorAxisEndPoint), s = n.length();
|
|
34
34
|
return new R(
|
|
35
35
|
e.center,
|
|
36
36
|
e.extrusionDirection ?? D.Z_AXIS,
|
|
37
37
|
n,
|
|
38
|
-
|
|
39
|
-
|
|
38
|
+
s,
|
|
39
|
+
s * e.axisRatio,
|
|
40
40
|
e.startAngle,
|
|
41
41
|
e.endAngle
|
|
42
42
|
);
|
|
43
43
|
}
|
|
44
44
|
convertLine(e) {
|
|
45
|
-
const n = e.startPoint,
|
|
46
|
-
return new
|
|
45
|
+
const n = e.startPoint, s = e.endPoint;
|
|
46
|
+
return new V(
|
|
47
47
|
new T(n.x, n.y, n.z),
|
|
48
|
-
new T(
|
|
48
|
+
new T(s.x, s.y, s.z)
|
|
49
49
|
);
|
|
50
50
|
}
|
|
51
51
|
convertSpline(e) {
|
|
@@ -70,32 +70,32 @@ class S {
|
|
|
70
70
|
return null;
|
|
71
71
|
}
|
|
72
72
|
convertPoint(e) {
|
|
73
|
-
const n = new
|
|
73
|
+
const n = new N();
|
|
74
74
|
return n.position = e.position, n;
|
|
75
75
|
}
|
|
76
76
|
convertSolid(e) {
|
|
77
|
-
const n = new
|
|
77
|
+
const n = new B();
|
|
78
78
|
return n.setPointAt(0, { ...e.corner1, z: 0 }), n.setPointAt(1, { ...e.corner2, z: 0 }), n.setPointAt(2, { ...e.corner3, z: 0 }), n.setPointAt(
|
|
79
79
|
3,
|
|
80
80
|
e.corner4 ? { ...e.corner4, z: 0 } : { ...e.corner3, z: 0 }
|
|
81
81
|
), n.thickness = e.thickness, n;
|
|
82
82
|
}
|
|
83
83
|
convertLWPolyline(e) {
|
|
84
|
-
const n = new
|
|
84
|
+
const n = new z();
|
|
85
85
|
n.closed = !!(e.flag & 512);
|
|
86
|
-
const
|
|
87
|
-
return e.vertices.forEach((o,
|
|
86
|
+
const s = e.constantWidth ?? -1;
|
|
87
|
+
return e.vertices.forEach((o, t) => {
|
|
88
88
|
n.addVertexAt(
|
|
89
|
-
|
|
89
|
+
t,
|
|
90
90
|
new P(o.x, o.y),
|
|
91
91
|
o.bulge,
|
|
92
|
-
o.startWidth ??
|
|
93
|
-
o.endWidth ??
|
|
92
|
+
o.startWidth ?? s,
|
|
93
|
+
o.endWidth ?? s
|
|
94
94
|
);
|
|
95
95
|
}), n;
|
|
96
96
|
}
|
|
97
97
|
convertPolyline2d(e) {
|
|
98
|
-
const n = !!(e.flag & 1),
|
|
98
|
+
const n = !!(e.flag & 1), s = !!(e.flag & 16), o = !!(e.flag & 64), t = !!(e.flag & 32), r = [], l = [], c = [];
|
|
99
99
|
if (e.vertices.map((i) => {
|
|
100
100
|
if (!(i.flag & 16))
|
|
101
101
|
if (o && i.flag & 128)
|
|
@@ -104,7 +104,7 @@ class S {
|
|
|
104
104
|
x: i.x,
|
|
105
105
|
y: i.y,
|
|
106
106
|
z: i.z
|
|
107
|
-
}),
|
|
107
|
+
}), l.push(i.bulge ?? 0);
|
|
108
108
|
else {
|
|
109
109
|
const d = [];
|
|
110
110
|
i.polyfaceIndex0 != null && i.polyfaceIndex0 != 0 && d.push(Math.abs(i.polyfaceIndex0) - 1), i.polyfaceIndex1 != null && i.polyfaceIndex1 != 0 && d.push(Math.abs(i.polyfaceIndex1) - 1), i.polyfaceIndex2 != null && i.polyfaceIndex2 != 0 && d.push(Math.abs(i.polyfaceIndex2) - 1), i.polyfaceIndex3 != null && i.polyfaceIndex3 != 0 && d.push(Math.abs(i.polyfaceIndex3) - 1), d.length >= 3 && c.push(d);
|
|
@@ -114,53 +114,53 @@ class S {
|
|
|
114
114
|
x: i.x,
|
|
115
115
|
y: i.y,
|
|
116
116
|
z: i.z
|
|
117
|
-
}),
|
|
118
|
-
}),
|
|
117
|
+
}), l.push(i.bulge ?? 0);
|
|
118
|
+
}), s) {
|
|
119
119
|
const i = e.meshMVertexCount ?? 2, d = e.meshNVertexCount ?? 2;
|
|
120
|
-
return new
|
|
120
|
+
return new j(i, d, r, n, t);
|
|
121
121
|
} else {
|
|
122
122
|
if (o)
|
|
123
123
|
return new W(r, c);
|
|
124
124
|
{
|
|
125
125
|
let i = A.SimplePoly;
|
|
126
|
-
return e.flag & 2 ? i = A.FitCurvePoly : e.flag & 4 && (e.smoothType == 6 ? i = A.CubicSplinePoly : e.smoothType == 5 && (i = A.QuadSplinePoly)), new
|
|
126
|
+
return e.flag & 2 ? i = A.FitCurvePoly : e.flag & 4 && (e.smoothType == 6 ? i = A.CubicSplinePoly : e.smoothType == 5 && (i = A.QuadSplinePoly)), new H(
|
|
127
127
|
i,
|
|
128
128
|
r,
|
|
129
129
|
0,
|
|
130
130
|
n,
|
|
131
131
|
e.startWidth,
|
|
132
132
|
e.endWidth,
|
|
133
|
-
|
|
133
|
+
l
|
|
134
134
|
);
|
|
135
135
|
}
|
|
136
136
|
}
|
|
137
137
|
}
|
|
138
138
|
convertPolyline3d(e) {
|
|
139
|
-
const n = !!(e.flag & 1),
|
|
140
|
-
e.vertices.map((
|
|
141
|
-
|
|
142
|
-
x:
|
|
143
|
-
y:
|
|
144
|
-
z:
|
|
139
|
+
const n = !!(e.flag & 1), s = [];
|
|
140
|
+
e.vertices.map((t) => {
|
|
141
|
+
t.flag & 16 || s.push({
|
|
142
|
+
x: t.x,
|
|
143
|
+
y: t.y,
|
|
144
|
+
z: t.z
|
|
145
145
|
});
|
|
146
146
|
});
|
|
147
147
|
let o = y.SimplePoly;
|
|
148
|
-
return e.flag & 4 && (e.smoothType == 6 ? o = y.CubicSplinePoly : e.smoothType == 5 && (o = y.QuadSplinePoly)), new
|
|
148
|
+
return e.flag & 4 && (e.smoothType == 6 ? o = y.CubicSplinePoly : e.smoothType == 5 && (o = y.QuadSplinePoly)), new X(o, s, n);
|
|
149
149
|
}
|
|
150
150
|
convertHatch(e) {
|
|
151
151
|
var o;
|
|
152
|
-
const n = new
|
|
153
|
-
|
|
152
|
+
const n = new G();
|
|
153
|
+
if ((o = e.definitionLines) == null || o.forEach((t) => {
|
|
154
154
|
n.definitionLines.push({
|
|
155
|
-
angle:
|
|
156
|
-
base:
|
|
157
|
-
offset:
|
|
158
|
-
dashLengths:
|
|
155
|
+
angle: t.angle,
|
|
156
|
+
base: t.base,
|
|
157
|
+
offset: t.offset,
|
|
158
|
+
dashLengths: t.numberOfDashLengths > 0 ? t.dashLengths : []
|
|
159
159
|
});
|
|
160
|
-
}), n.isSolidFill = e.solidFill == 1, n.hatchStyle = e.hatchStyle, n.patternName = e.patternName, n.patternType = e.patternType, n.patternAngle = e.patternAngle == null ? 0 : e.patternAngle, n.patternScale = e.patternScale == null ? 0 : e.patternScale, e.boundaryPaths.forEach((
|
|
161
|
-
if (
|
|
162
|
-
const
|
|
163
|
-
c.closed =
|
|
160
|
+
}), n.isSolidFill = e.solidFill == 1, n.hatchStyle = e.hatchStyle, n.patternName = e.patternName, n.patternType = e.patternType, n.patternAngle = e.patternAngle == null ? 0 : e.patternAngle, n.patternScale = e.patternScale == null ? 0 : e.patternScale, e.boundaryPaths.forEach((t) => {
|
|
161
|
+
if (t.boundaryPathTypeFlag & 2) {
|
|
162
|
+
const l = t, c = new U();
|
|
163
|
+
c.closed = l.isClosed, l.vertices.forEach((i, d) => {
|
|
164
164
|
c.addVertexAt(d, {
|
|
165
165
|
x: i.x,
|
|
166
166
|
y: i.y,
|
|
@@ -168,46 +168,46 @@ class S {
|
|
|
168
168
|
});
|
|
169
169
|
}), n.add(c);
|
|
170
170
|
} else {
|
|
171
|
-
const
|
|
172
|
-
|
|
171
|
+
const l = t, c = [];
|
|
172
|
+
l.edges.forEach((d) => {
|
|
173
173
|
if (d != null) {
|
|
174
174
|
if (d.type == 1) {
|
|
175
|
-
const
|
|
176
|
-
c.push(new
|
|
175
|
+
const a = d;
|
|
176
|
+
c.push(new Y(a.start, a.end));
|
|
177
177
|
} else if (d.type == 2) {
|
|
178
|
-
const
|
|
178
|
+
const a = d;
|
|
179
179
|
c.push(
|
|
180
|
-
new
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
!
|
|
180
|
+
new _(
|
|
181
|
+
a.center,
|
|
182
|
+
a.radius,
|
|
183
|
+
a.startAngle,
|
|
184
|
+
a.endAngle,
|
|
185
|
+
!a.isCCW
|
|
186
186
|
)
|
|
187
187
|
);
|
|
188
188
|
} else if (d.type == 3) {
|
|
189
|
-
const
|
|
190
|
-
new
|
|
189
|
+
const a = d;
|
|
190
|
+
new Z().subVectors(a.end, a.center);
|
|
191
191
|
const p = Math.sqrt(
|
|
192
|
-
Math.pow(
|
|
193
|
-
), f = p *
|
|
194
|
-
let u =
|
|
195
|
-
const
|
|
196
|
-
|
|
197
|
-
new
|
|
198
|
-
{ ...
|
|
192
|
+
Math.pow(a.end.x, 2) + Math.pow(a.end.y, 2)
|
|
193
|
+
), f = p * a.lengthOfMinorAxis;
|
|
194
|
+
let u = a.startAngle, g = a.endAngle;
|
|
195
|
+
const O = Math.atan2(a.end.y, a.end.x);
|
|
196
|
+
a.isCCW || (u = Math.PI * 2 - u, g = Math.PI * 2 - g), c.push(
|
|
197
|
+
new K(
|
|
198
|
+
{ ...a.center, z: 0 },
|
|
199
199
|
p,
|
|
200
200
|
f,
|
|
201
201
|
u,
|
|
202
202
|
g,
|
|
203
|
-
!
|
|
204
|
-
|
|
203
|
+
!a.isCCW,
|
|
204
|
+
O
|
|
205
205
|
)
|
|
206
206
|
);
|
|
207
207
|
} else if (d.type == 4) {
|
|
208
|
-
const
|
|
209
|
-
if (
|
|
210
|
-
const h =
|
|
208
|
+
const a = d;
|
|
209
|
+
if (a.numberOfControlPoints > 0 && a.numberOfKnots > 0) {
|
|
210
|
+
const h = a.controlPoints.map(
|
|
211
211
|
(u) => ({
|
|
212
212
|
x: u.x,
|
|
213
213
|
y: u.y,
|
|
@@ -215,16 +215,16 @@ class S {
|
|
|
215
215
|
})
|
|
216
216
|
);
|
|
217
217
|
let p = !0;
|
|
218
|
-
const f =
|
|
218
|
+
const f = a.controlPoints.map((u) => (u.weight == null && (p = !1), u.weight || 1));
|
|
219
219
|
c.push(
|
|
220
220
|
new E(
|
|
221
221
|
h,
|
|
222
|
-
|
|
222
|
+
a.knots,
|
|
223
223
|
p ? f : void 0
|
|
224
224
|
)
|
|
225
225
|
);
|
|
226
|
-
} else if (
|
|
227
|
-
const h =
|
|
226
|
+
} else if (a.numberOfFitData > 0) {
|
|
227
|
+
const h = a.fitDatum.map((p) => ({
|
|
228
228
|
x: p.x,
|
|
229
229
|
y: p.y,
|
|
230
230
|
z: 0
|
|
@@ -237,93 +237,100 @@ class S {
|
|
|
237
237
|
const i = M.buildFromEdges(c);
|
|
238
238
|
i.length == 0 && c.length > 0 ? n.add(new M(c)) : i.forEach((d) => n.add(d));
|
|
239
239
|
}
|
|
240
|
-
}),
|
|
240
|
+
}), e.gradientFlag) {
|
|
241
|
+
const t = e;
|
|
242
|
+
if (n.hatchObjectType = q.GradientObject, n.gradientName = t.gradientName, n.gradientAngle = t.gradientRotation ?? 0, n.gradientShift = t.gradientDefinition ?? 0, n.gradientOneColorMode = t.gradientColorFlag == 1, n.shadeTintValue = t.colorTint ?? 0, t.gradientColors) {
|
|
243
|
+
const r = t.gradientColors.length;
|
|
244
|
+
r > 1 ? (n.gradientStartColor = t.gradientColors[0].rgb, n.gradientEndColor = t.gradientColors[1].rgb) : r > 0 && (n.gradientStartColor = t.gradientColors[0].rgb);
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
return n;
|
|
241
248
|
}
|
|
242
249
|
convertTable(e) {
|
|
243
|
-
const n = new
|
|
250
|
+
const n = new J(
|
|
244
251
|
e.name,
|
|
245
252
|
e.rowCount,
|
|
246
253
|
e.columnCount
|
|
247
254
|
);
|
|
248
255
|
return n.tableStyleId = e.tableStyleId, n.owningBlockRecordId = e.blockRecordHandle, e.directionVector && (n.horizontalDirection = new D(e.directionVector)), n.attachmentPoint = e.attachmentPoint, n.position.copy(e.startPoint), n.tableValueFlag = e.tableValue, n.tableOverrideFlag = e.overrideFlag, n.borderColorOverrideFlag = e.borderColorOverrideFlag, n.borderLineweightOverrideFlag = e.borderLineWeightOverrideFlag, n.borderVisibilityOverrideFlag = e.borderVisibilityOverrideFlag, e.columnWidthArr.forEach(
|
|
249
|
-
(
|
|
256
|
+
(s, o) => n.setColumnWidth(o, s)
|
|
250
257
|
), e.rowHeightArr.forEach(
|
|
251
|
-
(
|
|
252
|
-
), e.cells.forEach((
|
|
253
|
-
n.setCell(o,
|
|
258
|
+
(s, o) => n.setRowHeight(o, s)
|
|
259
|
+
), e.cells.forEach((s, o) => {
|
|
260
|
+
n.setCell(o, s);
|
|
254
261
|
}), n;
|
|
255
262
|
}
|
|
256
263
|
convertText(e) {
|
|
257
|
-
const n = new
|
|
264
|
+
const n = new Q();
|
|
258
265
|
return n.textString = e.text, n.styleName = e.styleName, n.height = e.textHeight, n.position.copy(e.startPoint), n.rotation = e.rotation, n.oblique = e.obliqueAngle ?? 0, n.thickness = e.thickness, n.horizontalMode = e.halign, n.verticalMode = e.valign, n.widthFactor = e.xScale ?? 1, n;
|
|
259
266
|
}
|
|
260
267
|
convertMText(e) {
|
|
261
|
-
const n = new
|
|
268
|
+
const n = new $();
|
|
262
269
|
return n.contents = e.text, e.styleName != null && (n.styleName = e.styleName), n.height = e.textHeight, n.width = e.rectWidth, n.rotation = e.rotation || 0, n.location = e.insertionPoint, n.attachmentPoint = e.attachmentPoint, e.direction && (n.direction = new D(e.direction)), n.drawingDirection = e.drawingDirection, n;
|
|
263
270
|
}
|
|
264
271
|
convertLeader(e) {
|
|
265
|
-
const n = new
|
|
266
|
-
return e.vertices.forEach((
|
|
267
|
-
n.appendVertex(
|
|
272
|
+
const n = new ee();
|
|
273
|
+
return e.vertices.forEach((s) => {
|
|
274
|
+
n.appendVertex(s);
|
|
268
275
|
}), n.hasArrowHead = e.isArrowheadEnabled, n.hasHookLine = e.isHooklineExists, n.isSplined = e.isSpline, n.dimensionStyle = e.styleName, n.annoType = e.leaderCreationFlag, n;
|
|
269
276
|
}
|
|
270
277
|
convertDimension(e) {
|
|
271
278
|
if (e.subclassMarker == "AcDbAlignedDimension") {
|
|
272
|
-
const n = e,
|
|
279
|
+
const n = e, s = new ne(
|
|
273
280
|
n.subDefinitionPoint1,
|
|
274
281
|
n.subDefinitionPoint2,
|
|
275
282
|
n.definitionPoint
|
|
276
283
|
);
|
|
277
|
-
return n.insertionPoint && (
|
|
284
|
+
return n.insertionPoint && (s.dimBlockPosition = {
|
|
278
285
|
x: n.insertionPoint.x,
|
|
279
286
|
y: n.insertionPoint.y,
|
|
280
287
|
z: 0
|
|
281
|
-
}),
|
|
288
|
+
}), s.rotation = n.rotationAngle, this.processDimensionCommonAttrs(e, s), s;
|
|
282
289
|
} else if (e.subclassMarker == "AcDbRotatedDimension") {
|
|
283
|
-
const n = e,
|
|
290
|
+
const n = e, s = new oe(
|
|
284
291
|
n.subDefinitionPoint1,
|
|
285
292
|
n.subDefinitionPoint2,
|
|
286
293
|
n.definitionPoint
|
|
287
294
|
);
|
|
288
|
-
return n.insertionPoint && (
|
|
295
|
+
return n.insertionPoint && (s.dimBlockPosition = {
|
|
289
296
|
x: n.insertionPoint.x,
|
|
290
297
|
y: n.insertionPoint.y,
|
|
291
298
|
z: 0
|
|
292
|
-
}),
|
|
299
|
+
}), s.rotation = n.rotationAngle, this.processDimensionCommonAttrs(e, s), s;
|
|
293
300
|
} else if (e.subclassMarker == "AcDb3PointAngularDimension") {
|
|
294
|
-
const n = e,
|
|
301
|
+
const n = e, s = new te(
|
|
295
302
|
n.centerPoint,
|
|
296
303
|
n.subDefinitionPoint1,
|
|
297
304
|
n.subDefinitionPoint2,
|
|
298
305
|
n.definitionPoint
|
|
299
306
|
);
|
|
300
|
-
return this.processDimensionCommonAttrs(e,
|
|
307
|
+
return this.processDimensionCommonAttrs(e, s), s;
|
|
301
308
|
} else if (e.subclassMarker == "AcDbOrdinateDimension") {
|
|
302
|
-
const n = e,
|
|
309
|
+
const n = e, s = new se(
|
|
303
310
|
n.subDefinitionPoint1,
|
|
304
311
|
n.subDefinitionPoint2
|
|
305
312
|
);
|
|
306
|
-
return this.processDimensionCommonAttrs(e,
|
|
313
|
+
return this.processDimensionCommonAttrs(e, s), s;
|
|
307
314
|
} else if (e.subclassMarker == "AcDbRadialDimension") {
|
|
308
|
-
const n = e,
|
|
315
|
+
const n = e, s = new re(
|
|
309
316
|
n.definitionPoint,
|
|
310
317
|
n.centerPoint,
|
|
311
318
|
n.leaderLength
|
|
312
319
|
);
|
|
313
|
-
return this.processDimensionCommonAttrs(e,
|
|
320
|
+
return this.processDimensionCommonAttrs(e, s), s;
|
|
314
321
|
} else if (e.subclassMarker == "AcDbDiametricDimension") {
|
|
315
|
-
const n = e,
|
|
322
|
+
const n = e, s = new ie(
|
|
316
323
|
n.definitionPoint,
|
|
317
324
|
n.centerPoint,
|
|
318
325
|
n.leaderLength
|
|
319
326
|
);
|
|
320
|
-
return this.processDimensionCommonAttrs(e,
|
|
327
|
+
return this.processDimensionCommonAttrs(e, s), s;
|
|
321
328
|
}
|
|
322
329
|
return null;
|
|
323
330
|
}
|
|
324
331
|
processImage(e, n) {
|
|
325
|
-
n.position.copy(e.position), n.brightness = e.brightness, n.contrast = e.contrast, n.fade = e.fade, n.imageSize.copy(e.imageSize), n.imageDefId = e.imageDefHandle, n.isClipped = e.clipping > 0, n.isShownClipped = (e.flags | 4) > 0, n.isImageShown = (e.flags | 3) > 0, n.isImageTransparent = (e.flags | 8) > 0, e.clippingBoundaryPath.forEach((
|
|
326
|
-
n.clipBoundary.push(new P(
|
|
332
|
+
n.position.copy(e.position), n.brightness = e.brightness, n.contrast = e.contrast, n.fade = e.fade, n.imageSize.copy(e.imageSize), n.imageDefId = e.imageDefHandle, n.isClipped = e.clipping > 0, n.isShownClipped = (e.flags | 4) > 0, n.isImageShown = (e.flags | 3) > 0, n.isImageTransparent = (e.flags | 8) > 0, e.clippingBoundaryPath.forEach((s) => {
|
|
333
|
+
n.clipBoundary.push(new P(s));
|
|
327
334
|
}), n.clipBoundaryType = e.clippingBoundaryType, n.width = Math.sqrt(
|
|
328
335
|
e.uPixel.x ** 2 + e.uPixel.y ** 2 + e.uPixel.z ** 2
|
|
329
336
|
) * e.imageSize.x, n.height = Math.sqrt(
|
|
@@ -331,42 +338,42 @@ class S {
|
|
|
331
338
|
) * e.imageSize.y, n.rotation = Math.atan2(e.uPixel.y, e.uPixel.x);
|
|
332
339
|
}
|
|
333
340
|
convertImage(e) {
|
|
334
|
-
const n = new
|
|
341
|
+
const n = new ce();
|
|
335
342
|
return this.processImage(e, n), n;
|
|
336
343
|
}
|
|
337
344
|
convertWipeout(e) {
|
|
338
|
-
const n = new
|
|
345
|
+
const n = new ae();
|
|
339
346
|
return this.processImage(e, n), n;
|
|
340
347
|
}
|
|
341
348
|
convertViewport(e) {
|
|
342
|
-
const n = new
|
|
349
|
+
const n = new le();
|
|
343
350
|
return n.number = e.viewportId, n.centerPoint.copy(e.viewportCenter), n.height = e.height, n.width = e.width, n.viewCenter.copy(e.displayCenter), n.viewHeight = e.viewHeight, n;
|
|
344
351
|
}
|
|
345
352
|
convertRay(e) {
|
|
346
|
-
const n = new
|
|
353
|
+
const n = new de();
|
|
347
354
|
return n.basePoint.copy(e.firstPoint), n.unitDir.copy(e.unitDirection), n;
|
|
348
355
|
}
|
|
349
356
|
convertXline(e) {
|
|
350
|
-
const n = new
|
|
357
|
+
const n = new pe();
|
|
351
358
|
return n.basePoint.copy(e.firstPoint), n.unitDir.copy(e.unitDirection), n;
|
|
352
359
|
}
|
|
353
360
|
convertAttributeCommon(e, n) {
|
|
354
|
-
const
|
|
355
|
-
n.textString =
|
|
361
|
+
const s = e.text;
|
|
362
|
+
n.textString = s.text, n.styleName = s.styleName, n.height = s.textHeight, n.position.copy(s.startPoint), n.rotation = s.rotation, n.oblique = s.obliqueAngle ?? 0, n.thickness = s.thickness, n.horizontalMode = s.halign, n.verticalMode = s.valign, n.widthFactor = s.xScale ?? 1, n.tag = e.tag, n.fieldLength = e.fieldLength, n.isInvisible = (e.flags & I.Invisible) !== 0, n.isConst = (e.flags & I.Const) !== 0, n.isVerifiable = (e.flags & I.Verifiable) !== 0, n.isPreset = (e.flags & I.Preset) !== 0, n.lockPositionInBlock = e.lockPositionFlag, n.isReallyLocked = e.isReallyLocked, n.isMTextAttribute = (e.mtextFlag & C.MultiLine) !== 0, n.isConstMTextAttribute = (e.mtextFlag & C.ConstMultiLine) !== 0;
|
|
356
363
|
}
|
|
357
364
|
convertAttribute(e) {
|
|
358
|
-
const n = new
|
|
365
|
+
const n = new L();
|
|
359
366
|
return this.convertAttributeCommon(e, n), n;
|
|
360
367
|
}
|
|
361
368
|
convertAttributeDefinition(e) {
|
|
362
|
-
const n = new
|
|
369
|
+
const n = new fe();
|
|
363
370
|
return this.convertAttributeCommon(e, n), n.prompt = e.prompt, n;
|
|
364
371
|
}
|
|
365
372
|
convertBlockReference(e) {
|
|
366
|
-
const n = new
|
|
367
|
-
return e.insertionPoint && n.position.copy(e.insertionPoint), n.scaleFactors.x = e.xScale, n.scaleFactors.y = e.yScale, n.scaleFactors.z = e.zScale, n.rotation = e.rotation, n.normal.copy(e.extrusionDirection), e.attribs && e.attribs.forEach((
|
|
368
|
-
const o = this.
|
|
369
|
-
n.appendAttributes(o);
|
|
373
|
+
const n = new ue(e.name);
|
|
374
|
+
return e.insertionPoint && n.position.copy(e.insertionPoint), n.scaleFactors.x = e.xScale, n.scaleFactors.y = e.yScale, n.scaleFactors.z = e.zScale, n.rotation = e.rotation, n.normal.copy(e.extrusionDirection), e.handle != null && (n.objectId = e.handle), e.attribs && e.attribs.forEach((s) => {
|
|
375
|
+
const o = this.convert(s);
|
|
376
|
+
o instanceof L && n.appendAttributes(o);
|
|
370
377
|
}), n;
|
|
371
378
|
}
|
|
372
379
|
processDimensionCommonAttrs(e, n) {
|
|
@@ -374,25 +381,25 @@ class S {
|
|
|
374
381
|
}
|
|
375
382
|
processCommonAttrs(e, n) {
|
|
376
383
|
if (n.layer = e.layer || "0", n.objectId = e.handle, e.ownerBlockRecordSoftId != null && (n.ownerId = e.ownerBlockRecordSoftId), e.lineType != null && (n.lineType = e.lineType), e.lineweight != null && (n.lineWeight = e.lineweight), e.lineTypeScale != null && (n.linetypeScale = e.lineTypeScale), e.color != null && n.color.setRGBValue(e.color), e.colorIndex != null && (e.color == null || e.colorIndex === 7) && (n.color.colorIndex = e.colorIndex), e.colorName && (n.color.colorName = e.colorName), e.isVisible != null && (n.visibility = e.isVisible), e.transparency != null) {
|
|
377
|
-
const
|
|
378
|
-
|
|
384
|
+
const s = new he();
|
|
385
|
+
s.method = e.transparencyType, (s.isByBlock || s.isByBlock) && (s.alpha = e.transparency), n.transparency = s;
|
|
379
386
|
}
|
|
380
387
|
}
|
|
381
388
|
}
|
|
382
|
-
const
|
|
383
|
-
class
|
|
389
|
+
const Se = "*MODEL_SPACE";
|
|
390
|
+
class ve extends ge {
|
|
384
391
|
constructor(e = {}) {
|
|
385
392
|
super(e), e.useWorker = !0, e.parserWorkerUrl || (e.parserWorkerUrl = "/assets/libredwg-parser-worker.js");
|
|
386
393
|
}
|
|
387
394
|
async parse(e, n) {
|
|
388
|
-
const
|
|
389
|
-
if (
|
|
390
|
-
const
|
|
391
|
-
workerUrl:
|
|
395
|
+
const s = this.config, o = this.getParserWorkerTimeout(e, n);
|
|
396
|
+
if (s.useWorker && s.parserWorkerUrl) {
|
|
397
|
+
const t = De({
|
|
398
|
+
workerUrl: s.parserWorkerUrl,
|
|
392
399
|
timeout: o,
|
|
393
400
|
maxConcurrentWorkers: 1
|
|
394
|
-
}), r = await
|
|
395
|
-
if (
|
|
401
|
+
}), r = await t.execute(e);
|
|
402
|
+
if (t.destroy(), r.success)
|
|
396
403
|
return r.data;
|
|
397
404
|
throw new Error(
|
|
398
405
|
`Failed to parse drawing due to error: '${r.error}'`
|
|
@@ -405,60 +412,60 @@ class xe extends he {
|
|
|
405
412
|
e.tables.BLOCK_RECORD.entries.forEach((r) => {
|
|
406
413
|
n.set(r.name, r);
|
|
407
414
|
});
|
|
408
|
-
const
|
|
415
|
+
const s = /* @__PURE__ */ new Map(), o = (r) => {
|
|
409
416
|
if (r) {
|
|
410
|
-
const
|
|
411
|
-
return
|
|
417
|
+
const l = r.lastIndexOf(".");
|
|
418
|
+
return l >= 0 ? r.substring(0, l).toLowerCase() : r.toLowerCase();
|
|
412
419
|
}
|
|
413
420
|
};
|
|
414
421
|
e.tables.STYLE.entries.forEach((r) => {
|
|
415
|
-
const
|
|
422
|
+
const l = [];
|
|
416
423
|
let c = o(r.font);
|
|
417
|
-
c &&
|
|
424
|
+
c && l.push(c), c = o(r.bigFont), c && l.push(c), s.set(r.name, l);
|
|
418
425
|
});
|
|
419
|
-
const
|
|
420
|
-
return this.getFontsInBlock(e.entities, n,
|
|
426
|
+
const t = /* @__PURE__ */ new Set();
|
|
427
|
+
return this.getFontsInBlock(e.entities, n, s, t), Array.from(t);
|
|
421
428
|
}
|
|
422
|
-
getFontsInBlock(e, n,
|
|
423
|
-
const
|
|
429
|
+
getFontsInBlock(e, n, s, o) {
|
|
430
|
+
const t = /\\f(.*?)\|/g;
|
|
424
431
|
e.forEach((r) => {
|
|
425
432
|
if (r.type == "MTEXT") {
|
|
426
|
-
const
|
|
427
|
-
[...
|
|
433
|
+
const l = r;
|
|
434
|
+
[...l.text.matchAll(t)].forEach((i) => {
|
|
428
435
|
o.add(i[1].toLowerCase());
|
|
429
436
|
});
|
|
430
|
-
const c =
|
|
437
|
+
const c = s.get(l.styleName);
|
|
431
438
|
c == null || c.forEach((i) => o.add(i));
|
|
432
439
|
} else if (r.type == "TEXT") {
|
|
433
|
-
const
|
|
440
|
+
const l = r, c = s.get(l.styleName);
|
|
434
441
|
c == null || c.forEach((i) => o.add(i));
|
|
435
442
|
} else if (r.type == "INSERT") {
|
|
436
|
-
const
|
|
437
|
-
c && this.getFontsInBlock(c.entities, n,
|
|
443
|
+
const l = r, c = n.get(l.name);
|
|
444
|
+
c && this.getFontsInBlock(c.entities, n, s, o);
|
|
438
445
|
}
|
|
439
446
|
});
|
|
440
447
|
}
|
|
441
448
|
processLineTypes(e, n) {
|
|
442
449
|
e.tables.LTYPE.entries.forEach((o) => {
|
|
443
|
-
const
|
|
450
|
+
const t = {
|
|
444
451
|
name: o.name,
|
|
445
452
|
description: o.description,
|
|
446
453
|
standardFlag: o.standardFlag,
|
|
447
454
|
totalPatternLength: o.totalPatternLength,
|
|
448
455
|
pattern: o.pattern
|
|
449
|
-
}, r = new
|
|
456
|
+
}, r = new Ae(t);
|
|
450
457
|
this.processCommonTableEntryAttrs(o, r), r.name = o.name, n.tables.linetypeTable.add(r);
|
|
451
458
|
});
|
|
452
459
|
}
|
|
453
460
|
processTextStyles(e, n) {
|
|
454
461
|
e.tables.STYLE.entries.forEach((o) => {
|
|
455
|
-
const
|
|
456
|
-
this.processCommonTableEntryAttrs(o,
|
|
462
|
+
const t = new Ie(o);
|
|
463
|
+
this.processCommonTableEntryAttrs(o, t), n.tables.textStyleTable.add(t);
|
|
457
464
|
});
|
|
458
465
|
}
|
|
459
466
|
processDimStyles(e, n) {
|
|
460
467
|
e.tables.DIMSTYLE.entries.forEach((o) => {
|
|
461
|
-
const
|
|
468
|
+
const t = {
|
|
462
469
|
name: o.name,
|
|
463
470
|
ownerId: o.ownerHandle,
|
|
464
471
|
dimpost: o.DIMPOST || "",
|
|
@@ -520,28 +527,28 @@ class xe extends he {
|
|
|
520
527
|
dimfit: o.DIMFIT || 0,
|
|
521
528
|
dimupt: o.DIMUPT,
|
|
522
529
|
dimatfit: o.DIMATFIT,
|
|
523
|
-
dimtxsty:
|
|
530
|
+
dimtxsty: S,
|
|
524
531
|
dimldrblk: "",
|
|
525
532
|
dimblk: o.DIMBLK || "",
|
|
526
533
|
dimblk1: o.DIMBLK1 || "",
|
|
527
534
|
dimblk2: o.DIMBLK2 || "",
|
|
528
535
|
dimlwd: o.DIMLWD,
|
|
529
536
|
dimlwe: o.DIMLWE
|
|
530
|
-
}, r = new
|
|
537
|
+
}, r = new ye(t);
|
|
531
538
|
this.processCommonTableEntryAttrs(o, r), n.tables.dimStyleTable.add(r);
|
|
532
539
|
});
|
|
533
540
|
}
|
|
534
541
|
processLayers(e, n) {
|
|
535
542
|
e.tables.LAYER.entries.forEach((o) => {
|
|
536
|
-
const
|
|
537
|
-
|
|
538
|
-
const r = new
|
|
543
|
+
const t = new we();
|
|
544
|
+
t.colorIndex = o.colorIndex;
|
|
545
|
+
const r = new Te({
|
|
539
546
|
name: o.name,
|
|
540
547
|
standardFlags: o.standardFlag,
|
|
541
548
|
linetype: o.lineType,
|
|
542
549
|
lineWeight: o.lineweight,
|
|
543
550
|
isOff: o.off,
|
|
544
|
-
color:
|
|
551
|
+
color: t,
|
|
545
552
|
isPlottable: o.plotFlag != 0
|
|
546
553
|
});
|
|
547
554
|
this.processCommonTableEntryAttrs(o, r), n.tables.layerTable.add(r);
|
|
@@ -549,54 +556,54 @@ class xe extends he {
|
|
|
549
556
|
}
|
|
550
557
|
processViewports(e, n) {
|
|
551
558
|
e.tables.VPORT.entries.forEach((o) => {
|
|
552
|
-
const
|
|
553
|
-
this.processCommonTableEntryAttrs(o,
|
|
559
|
+
const t = new be();
|
|
560
|
+
this.processCommonTableEntryAttrs(o, t), o.circleSides && (t.circleSides = o.circleSides), t.standardFlag = o.standardFlag, t.center.copy(o.center), t.lowerLeftCorner.copy(o.lowerLeftCorner), t.upperRightCorner.copy(o.upperRightCorner), o.snapBasePoint && t.snapBase.copy(o.snapBasePoint), o.snapRotationAngle && (t.snapAngle = o.snapRotationAngle), o.snapSpacing && t.snapIncrements.copy(o.snapSpacing), o.majorGridLines && (t.gridMajor = o.majorGridLines), o.gridSpacing && t.gridIncrements.copy(o.gridSpacing), o.backgroundObjectId && (t.backgroundObjectId = o.backgroundObjectId), t.gsView.center.copy(o.center), t.gsView.viewDirectionFromTarget.copy(o.viewDirectionFromTarget), t.gsView.viewTarget.copy(o.viewTarget), o.lensLength && (t.gsView.lensLength = o.lensLength), o.frontClippingPlane && (t.gsView.frontClippingPlane = o.frontClippingPlane), o.backClippingPlane && (t.gsView.backClippingPlane = o.backClippingPlane), o.viewHeight && (t.gsView.viewHeight = o.viewHeight), o.viewTwistAngle && (t.gsView.viewTwistAngle = o.viewTwistAngle), o.frozenLayers && (t.gsView.frozenLayers = o.frozenLayers), o.styleSheet && (t.gsView.styleSheet = o.styleSheet), o.renderMode && (t.gsView.renderMode = o.renderMode), o.viewMode && (t.gsView.viewMode = o.viewMode), o.ucsIconSetting && (t.gsView.ucsIconSetting = o.ucsIconSetting), o.ucsOrigin && t.gsView.ucsOrigin.copy(o.ucsOrigin), o.ucsXAxis && t.gsView.ucsXAxis.copy(o.ucsXAxis), o.ucsYAxis && t.gsView.ucsYAxis.copy(o.ucsYAxis), o.orthographicType && (t.gsView.orthographicType = o.orthographicType), o.shadePlotSetting && (t.gsView.shadePlotSetting = o.shadePlotSetting), o.shadePlotObjectId && (t.gsView.shadePlotObjectId = o.shadePlotObjectId), o.visualStyleObjectId && (t.gsView.visualStyleObjectId = o.visualStyleObjectId), o.isDefaultLightingOn && (t.gsView.isDefaultLightingOn = o.isDefaultLightingOn), o.defaultLightingType && (t.gsView.defaultLightingType = o.defaultLightingType), o.brightness && (t.gsView.brightness = o.brightness), o.contrast && (t.gsView.contrast = o.contrast), o.ambientColor && (t.gsView.ambientColor = o.ambientColor), n.tables.viewportTable.add(t);
|
|
554
561
|
});
|
|
555
562
|
}
|
|
556
563
|
processBlockTables(e, n) {
|
|
557
564
|
e.tables.BLOCK_RECORD.entries.forEach((o) => {
|
|
558
|
-
let
|
|
559
|
-
|
|
565
|
+
let t = n.tables.blockTable.getAt(o.name);
|
|
566
|
+
t || (t = new Pe(), t.objectId = o.handle, t.name = o.name, t.ownerId = o.ownerHandle, t.origin.copy(o.basePoint), t.layoutId = o.layout, t.blockInsertUnits = o.insertionUnits, t.explodability = o.explodability, t.blockScaling = o.scalability, o.bmpPreview && (t.bmpPreview = o.bmpPreview), n.tables.blockTable.add(t)), !t.isModelSapce && o.entities && o.entities.length > 0 && this.processEntitiesInBlock(o.entities, t);
|
|
560
567
|
});
|
|
561
568
|
}
|
|
562
569
|
processBlocks(e, n) {
|
|
563
570
|
}
|
|
564
571
|
async processEntitiesInBlock(e, n) {
|
|
565
|
-
const
|
|
572
|
+
const s = new x(), o = e.length, t = [];
|
|
566
573
|
for (let r = 0; r < o; r++) {
|
|
567
|
-
const
|
|
568
|
-
c &&
|
|
574
|
+
const l = e[r], c = s.convert(l);
|
|
575
|
+
c && t.push(c);
|
|
569
576
|
}
|
|
570
|
-
n.appendEntity(
|
|
577
|
+
n.appendEntity(t);
|
|
571
578
|
}
|
|
572
|
-
async processEntities(e, n,
|
|
573
|
-
const r = new
|
|
574
|
-
let
|
|
575
|
-
e.tables.BLOCK_RECORD.entries.forEach((
|
|
576
|
-
this.isModelSpace(
|
|
579
|
+
async processEntities(e, n, s, o, t) {
|
|
580
|
+
const r = new x();
|
|
581
|
+
let l = [];
|
|
582
|
+
e.tables.BLOCK_RECORD.entries.forEach((a) => {
|
|
583
|
+
this.isModelSpace(a.name) && (l = a.entities);
|
|
577
584
|
});
|
|
578
|
-
const c =
|
|
585
|
+
const c = l.length, i = new Ee(
|
|
579
586
|
c,
|
|
580
587
|
100 - o.value,
|
|
581
|
-
|
|
588
|
+
s
|
|
582
589
|
);
|
|
583
|
-
this.config.convertByEntityType && (
|
|
590
|
+
this.config.convertByEntityType && (l = this.groupAndFlattenByType(l));
|
|
584
591
|
const d = n.tables.blockTable.modelSpace;
|
|
585
|
-
await i.processChunk(async (
|
|
592
|
+
await i.processChunk(async (a, h) => {
|
|
586
593
|
const p = [];
|
|
587
|
-
for (let f =
|
|
588
|
-
const u =
|
|
594
|
+
for (let f = a; f < h; f++) {
|
|
595
|
+
const u = l[f], g = r.convert(u);
|
|
589
596
|
g && p.push(g);
|
|
590
597
|
}
|
|
591
|
-
if (d.appendEntity(p),
|
|
598
|
+
if (d.appendEntity(p), t) {
|
|
592
599
|
let f = o.value + h / c * (100 - o.value);
|
|
593
|
-
f > 100 && (f = 100), await
|
|
600
|
+
f > 100 && (f = 100), await t(f, "ENTITY", "IN-PROGRESS");
|
|
594
601
|
}
|
|
595
602
|
});
|
|
596
603
|
}
|
|
597
604
|
processHeader(e, n) {
|
|
598
|
-
const
|
|
599
|
-
|
|
605
|
+
const s = e.header;
|
|
606
|
+
s.CECOLOR && (s.CECOLOR.index >= 0 && s.CECOLOR.index <= 256 ? n.cecolor.colorIndex = s.CECOLOR.index : n.cecolor.setRGBValue(s.CECOLOR.rgb)), n.angBase = s.ANGBASE ?? 0, n.angDir = s.ANGDIR ?? 0, n.aunits = s.AUNITS ?? 0, n.celtype = s.CELTYPE ?? Me, n.celtscale = s.CELTSCALE ?? 1, n.ltscale = s.LTSCALE ?? 1, s.EXTMAX && (n.extmax = s.EXTMAX), s.EXTMIN && (n.extmin = s.EXTMIN), n.insunits = s.INSUNITS ?? 1, n.pdmode = s.PDMODE ?? 0, n.pdsize = s.PDSIZE ?? 0, n.textstyle = s.TEXTSTYLE ?? S;
|
|
600
607
|
}
|
|
601
608
|
processCommonTableEntryAttrs(e, n) {
|
|
602
609
|
n.name = e.name, n.objectId = e.handle, e.ownerHandle != null && (n.ownerId = e.ownerHandle);
|
|
@@ -605,40 +612,40 @@ class xe extends he {
|
|
|
605
612
|
this.processLayouts(e, n), this.processImageDefs(e, n);
|
|
606
613
|
}
|
|
607
614
|
processLayouts(e, n) {
|
|
608
|
-
const
|
|
609
|
-
e.objects.LAYOUT.forEach((
|
|
610
|
-
const r = new
|
|
611
|
-
r.layoutName =
|
|
612
|
-
const
|
|
613
|
-
r.objectId =
|
|
614
|
-
for (const c of
|
|
615
|
+
const s = n.objects.layout;
|
|
616
|
+
e.objects.LAYOUT.forEach((t) => {
|
|
617
|
+
const r = new Ce();
|
|
618
|
+
r.layoutName = t.layoutName, r.tabOrder = t.tabOrder;
|
|
619
|
+
const l = n.tables.blockTable.newIterator();
|
|
620
|
+
r.objectId = t.handle;
|
|
621
|
+
for (const c of l)
|
|
615
622
|
if (c.layoutId === r.objectId) {
|
|
616
623
|
r.blockTableRecordId = c.objectId;
|
|
617
624
|
break;
|
|
618
625
|
}
|
|
619
|
-
r.blockTableRecordId ||
|
|
626
|
+
r.blockTableRecordId || t.layoutName === "Model" && (r.blockTableRecordId = n.tables.blockTable.modelSpace.objectId), r.limits.min.copy(t.minLimit), r.limits.max.copy(t.maxLimit), r.extents.min.copy(t.minExtent), r.extents.max.copy(t.maxExtent), t.viewportId && r.viewportArray.push(t.viewportId), this.processCommonObjectAttrs(t, r), s.setAt(r.layoutName, r);
|
|
620
627
|
});
|
|
621
628
|
}
|
|
622
629
|
processImageDefs(e, n) {
|
|
623
|
-
const
|
|
624
|
-
e.objects.IMAGEDEF.forEach((
|
|
630
|
+
const s = n.objects.imageDefinition;
|
|
631
|
+
e.objects.IMAGEDEF.forEach((t) => {
|
|
625
632
|
const r = new Le();
|
|
626
|
-
r.sourceFileName =
|
|
633
|
+
r.sourceFileName = t.fileName, this.processCommonObjectAttrs(t, r), s.setAt(r.objectId, r);
|
|
627
634
|
});
|
|
628
635
|
}
|
|
629
636
|
processCommonObjectAttrs(e, n) {
|
|
630
637
|
n.objectId = e.handle, e.ownerHandle != null && (n.ownerId = e.ownerHandle);
|
|
631
638
|
}
|
|
632
639
|
groupAndFlattenByType(e) {
|
|
633
|
-
const n = {},
|
|
640
|
+
const n = {}, s = [];
|
|
634
641
|
for (const o of e)
|
|
635
|
-
n[o.type] || (n[o.type] = [],
|
|
636
|
-
return
|
|
642
|
+
n[o.type] || (n[o.type] = [], s.push(o.type)), n[o.type].push(o);
|
|
643
|
+
return s.flatMap((o) => n[o]);
|
|
637
644
|
}
|
|
638
645
|
isModelSpace(e) {
|
|
639
|
-
return e && e.toUpperCase() ==
|
|
646
|
+
return e && e.toUpperCase() == Se;
|
|
640
647
|
}
|
|
641
648
|
}
|
|
642
649
|
export {
|
|
643
|
-
|
|
650
|
+
ve as AcDbLibreDwgConverter
|
|
644
651
|
};
|