@mlightcad/libredwg-converter 3.5.34 → 3.5.36
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 +171 -167
- package/dist/libredwg-converter.umd.cjs +1 -1
- package/dist/libredwg-parser-worker.js +202 -197
- package/lib/AcDbEntitiyConverter.d.ts.map +1 -1
- package/lib/AcDbEntitiyConverter.js +1 -3
- package/lib/AcDbEntitiyConverter.js.map +1 -1
- package/lib/AcDbLibreDwgConverter.d.ts.map +1 -1
- package/lib/AcDbLibreDwgConverter.js +20 -9
- package/lib/AcDbLibreDwgConverter.js.map +1 -1
- package/package.json +2 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { AcDbFace as j, AcGeVector3d as A, AcDbArc as z, transformOcsPointToWcs as
|
|
2
|
-
class
|
|
1
|
+
import { AcDbFace as j, AcGeVector3d as A, AcDbArc as z, transformOcsPointToWcs as x, AcDbCircle as U, AcDbEllipse as X, AcDbLine as _, AcGePoint3d as M, AcDbSpline as S, AcDbPoint as G, AcDbTrace as Y, AcDbPolyline as Z, AcGePoint2d as m, AcDbPolygonMesh as K, AcDbPolyFaceMesh as q, AcDbPoly2dType as b, AcDb2dPolyline as J, AcDbPoly3dType as I, AcDb3dPolyline as Q, AcDbHatch as $, AcGePolyline2d as ee, AcGeLine2d as te, AcGeCircArc2d as ne, AcGeVector2d as oe, AcGeEllipseArc2d as ie, AcGeSpline3d as v, AcGeLoop2d as O, AcDbHatchObjectType as re, AcDbTable as se, AcDbText as ce, AcDbMText as ae, AcDbLeader as le, AcDbMLine as de, AcDbMLeader as fe, AcDbMLeaderLineType as pe, AcDbMLeaderContentType as T, AcDbAlignedDimension as ue, AcDbRotatedDimension as ge, AcDb3PointAngularDimension as he, AcDbOrdinateDimension as De, AcDbRadialDimension as ye, AcDbDiametricDimension as Ae, AcDbRasterImage as be, AcDbWipeout as Pe, AcDbViewport as Ie, AcDbRay as Te, AcDbXline as Le, AcDbAttributeFlags as P, AcDbAttributeMTextFlag as k, AcDbAttribute as N, AcDbAttributeDefinition as we, AcDbBlockReference as Ee, AcCmColor as B, AcCmTransparency as Ce, AcDbDatabaseConverter as xe, createWorkerApi as Me, AcDbLinetypeTableRecord as Se, AcDbTextStyleTableRecord as me, DEFAULT_TEXT_STYLE as R, AcDbDimStyleTableRecord as ve, AcDbLayerTableRecord as Oe, AcDbViewportTableRecord as ke, VPORT_FALLBACK_CENTER_2D as V, VPORT_FALLBACK_LLC as Ne, VPORT_FALLBACK_URC as Re, VPORT_FALLBACK_VIEW_DIR as Ve, VPORT_FALLBACK_VIEW_TARGET as Fe, AcDbBlockTableRecord as Be, AcDbBatchProcessing as He, ByLayer as We, AcDbLayout as je, AcDbRasterImageDef as ze } from "@mlightcad/data-model";
|
|
2
|
+
class F {
|
|
3
3
|
convert(e) {
|
|
4
4
|
const t = this.createEntity(e);
|
|
5
5
|
return t && this.processCommonAttrs(e, t), t;
|
|
@@ -14,7 +14,7 @@ class V {
|
|
|
14
14
|
convertArc(e) {
|
|
15
15
|
const t = e.extrusionDirection ?? A.Z_AXIS;
|
|
16
16
|
return new z(
|
|
17
|
-
|
|
17
|
+
x(e.center, t),
|
|
18
18
|
e.radius,
|
|
19
19
|
e.startAngle,
|
|
20
20
|
e.endAngle,
|
|
@@ -23,8 +23,8 @@ class V {
|
|
|
23
23
|
}
|
|
24
24
|
convertCirle(e) {
|
|
25
25
|
const t = e.extrusionDirection ?? A.Z_AXIS;
|
|
26
|
-
return new
|
|
27
|
-
|
|
26
|
+
return new U(
|
|
27
|
+
x(e.center, t),
|
|
28
28
|
e.radius,
|
|
29
29
|
t
|
|
30
30
|
);
|
|
@@ -43,15 +43,15 @@ class V {
|
|
|
43
43
|
}
|
|
44
44
|
convertLine(e) {
|
|
45
45
|
const t = e.startPoint, o = e.endPoint;
|
|
46
|
-
return new
|
|
47
|
-
new
|
|
48
|
-
new
|
|
46
|
+
return new _(
|
|
47
|
+
new M(t.x, t.y, t.z),
|
|
48
|
+
new M(o.x, o.y, o.z)
|
|
49
49
|
);
|
|
50
50
|
}
|
|
51
51
|
convertSpline(e) {
|
|
52
52
|
try {
|
|
53
53
|
if (e.numberOfControlPoints > 0 && e.numberOfKnots > 0)
|
|
54
|
-
return new
|
|
54
|
+
return new S(
|
|
55
55
|
e.controlPoints,
|
|
56
56
|
e.knots,
|
|
57
57
|
e.weights,
|
|
@@ -59,7 +59,7 @@ class V {
|
|
|
59
59
|
!!(e.flag & 1)
|
|
60
60
|
);
|
|
61
61
|
if (e.numberOfFitPoints > 0)
|
|
62
|
-
return new
|
|
62
|
+
return new S(
|
|
63
63
|
e.fitPoints,
|
|
64
64
|
"Uniform",
|
|
65
65
|
e.degree,
|
|
@@ -84,9 +84,9 @@ class V {
|
|
|
84
84
|
const t = new Z();
|
|
85
85
|
t.closed = !!(e.flag & 512);
|
|
86
86
|
const o = e.constantWidth ?? -1;
|
|
87
|
-
return e.vertices.forEach((n,
|
|
87
|
+
return e.vertices.forEach((n, i) => {
|
|
88
88
|
t.addVertexAt(
|
|
89
|
-
|
|
89
|
+
i,
|
|
90
90
|
new m(n.x, n.y),
|
|
91
91
|
n.bulge,
|
|
92
92
|
n.startWidth ?? o,
|
|
@@ -95,12 +95,12 @@ class V {
|
|
|
95
95
|
}), t;
|
|
96
96
|
}
|
|
97
97
|
convertPolyline2d(e) {
|
|
98
|
-
const t = !!(e.flag & 1), o = !!(e.flag & 16), n = !!(e.flag & 64),
|
|
98
|
+
const t = !!(e.flag & 1), o = !!(e.flag & 16), n = !!(e.flag & 64), i = !!(e.flag & 32), r = [], a = [], s = [];
|
|
99
99
|
if (e.vertices.map((c) => {
|
|
100
100
|
if (!(c.flag & 16))
|
|
101
101
|
if (n && c.flag & 128)
|
|
102
102
|
if (c.flag & 64)
|
|
103
|
-
|
|
103
|
+
r.push({
|
|
104
104
|
x: c.x,
|
|
105
105
|
y: c.y,
|
|
106
106
|
z: c.z
|
|
@@ -110,22 +110,22 @@ class V {
|
|
|
110
110
|
c.polyfaceIndex0 != null && c.polyfaceIndex0 != 0 && d.push(Math.abs(c.polyfaceIndex0) - 1), c.polyfaceIndex1 != null && c.polyfaceIndex1 != 0 && d.push(Math.abs(c.polyfaceIndex1) - 1), c.polyfaceIndex2 != null && c.polyfaceIndex2 != 0 && d.push(Math.abs(c.polyfaceIndex2) - 1), c.polyfaceIndex3 != null && c.polyfaceIndex3 != 0 && d.push(Math.abs(c.polyfaceIndex3) - 1), d.length >= 3 && s.push(d);
|
|
111
111
|
}
|
|
112
112
|
else
|
|
113
|
-
|
|
113
|
+
r.push({
|
|
114
114
|
x: c.x,
|
|
115
115
|
y: c.y,
|
|
116
116
|
z: c.z
|
|
117
117
|
}), a.push(c.bulge ?? 0);
|
|
118
118
|
}), o) {
|
|
119
119
|
const c = e.meshMVertexCount ?? 2, d = e.meshNVertexCount ?? 2;
|
|
120
|
-
return new
|
|
120
|
+
return new K(c, d, r, t, i);
|
|
121
121
|
} else {
|
|
122
122
|
if (n)
|
|
123
|
-
return new
|
|
123
|
+
return new q(r, s);
|
|
124
124
|
{
|
|
125
125
|
let c = b.SimplePoly;
|
|
126
|
-
return e.flag & 2 ? c = b.FitCurvePoly : e.flag & 4 && (e.smoothType == 6 ? c = b.CubicSplinePoly : e.smoothType == 5 && (c = b.QuadSplinePoly)), new
|
|
126
|
+
return e.flag & 2 ? c = b.FitCurvePoly : e.flag & 4 && (e.smoothType == 6 ? c = b.CubicSplinePoly : e.smoothType == 5 && (c = b.QuadSplinePoly)), new J(
|
|
127
127
|
c,
|
|
128
|
-
|
|
128
|
+
r,
|
|
129
129
|
0,
|
|
130
130
|
t,
|
|
131
131
|
e.startWidth,
|
|
@@ -137,29 +137,29 @@ class V {
|
|
|
137
137
|
}
|
|
138
138
|
convertPolyline3d(e) {
|
|
139
139
|
const t = !!(e.flag & 1), o = [];
|
|
140
|
-
e.vertices.map((
|
|
141
|
-
|
|
142
|
-
x:
|
|
143
|
-
y:
|
|
144
|
-
z:
|
|
140
|
+
e.vertices.map((i) => {
|
|
141
|
+
i.flag & 16 || o.push({
|
|
142
|
+
x: i.x,
|
|
143
|
+
y: i.y,
|
|
144
|
+
z: i.z
|
|
145
145
|
});
|
|
146
146
|
});
|
|
147
|
-
let n =
|
|
148
|
-
return e.flag & 4 && (e.smoothType == 6 ? n =
|
|
147
|
+
let n = I.SimplePoly;
|
|
148
|
+
return e.flag & 4 && (e.smoothType == 6 ? n = I.CubicSplinePoly : e.smoothType == 5 && (n = I.QuadSplinePoly)), new Q(n, o, t);
|
|
149
149
|
}
|
|
150
150
|
convertHatch(e) {
|
|
151
151
|
var n;
|
|
152
|
-
const t = new
|
|
153
|
-
if ((n = e.definitionLines) == null || n.forEach((
|
|
152
|
+
const t = new $();
|
|
153
|
+
if ((n = e.definitionLines) == null || n.forEach((i) => {
|
|
154
154
|
t.definitionLines.push({
|
|
155
|
-
angle:
|
|
156
|
-
base:
|
|
157
|
-
offset:
|
|
158
|
-
dashLengths:
|
|
155
|
+
angle: i.angle,
|
|
156
|
+
base: i.base,
|
|
157
|
+
offset: i.offset,
|
|
158
|
+
dashLengths: i.numberOfDashLengths > 0 ? i.dashLengths : []
|
|
159
159
|
});
|
|
160
|
-
}), t.isSolidFill = e.solidFill == 1, t.hatchStyle = e.hatchStyle, t.patternName = e.patternName, t.patternType = e.patternType, t.patternAngle = e.patternAngle == null ? 0 : e.patternAngle, t.patternScale = e.patternScale == null ? 0 : e.patternScale, e.boundaryPaths.forEach((
|
|
161
|
-
if (
|
|
162
|
-
const a =
|
|
160
|
+
}), t.isSolidFill = e.solidFill == 1, t.hatchStyle = e.hatchStyle, t.patternName = e.patternName, t.patternType = e.patternType, t.patternAngle = e.patternAngle == null ? 0 : e.patternAngle, t.patternScale = e.patternScale == null ? 0 : e.patternScale, e.boundaryPaths.forEach((i) => {
|
|
161
|
+
if (i.boundaryPathTypeFlag & 2) {
|
|
162
|
+
const a = i, s = new ee();
|
|
163
163
|
s.closed = a.isClosed, a.vertices.forEach((c, d) => {
|
|
164
164
|
s.addVertexAt(d, {
|
|
165
165
|
x: c.x,
|
|
@@ -168,16 +168,16 @@ class V {
|
|
|
168
168
|
});
|
|
169
169
|
}), t.add(s);
|
|
170
170
|
} else {
|
|
171
|
-
const a =
|
|
171
|
+
const a = i, s = [];
|
|
172
172
|
a.edges.forEach((d) => {
|
|
173
173
|
if (d != null) {
|
|
174
174
|
if (d.type == 1) {
|
|
175
175
|
const l = d;
|
|
176
|
-
s.push(new
|
|
176
|
+
s.push(new te(l.start, l.end));
|
|
177
177
|
} else if (d.type == 2) {
|
|
178
178
|
const l = d;
|
|
179
179
|
s.push(
|
|
180
|
-
new
|
|
180
|
+
new ne(
|
|
181
181
|
l.center,
|
|
182
182
|
l.radius,
|
|
183
183
|
l.startAngle,
|
|
@@ -187,18 +187,18 @@ class V {
|
|
|
187
187
|
);
|
|
188
188
|
} else if (d.type == 3) {
|
|
189
189
|
const l = d;
|
|
190
|
-
new
|
|
190
|
+
new oe().subVectors(l.end, l.center);
|
|
191
191
|
const p = Math.sqrt(
|
|
192
192
|
Math.pow(l.end.x, 2) + Math.pow(l.end.y, 2)
|
|
193
|
-
),
|
|
194
|
-
let
|
|
193
|
+
), u = p * l.lengthOfMinorAxis;
|
|
194
|
+
let g = l.startAngle, y = l.endAngle;
|
|
195
195
|
const h = Math.atan2(l.end.y, l.end.x);
|
|
196
|
-
l.isCCW || (
|
|
197
|
-
new
|
|
196
|
+
l.isCCW || (g = Math.PI * 2 - g, y = Math.PI * 2 - y), s.push(
|
|
197
|
+
new ie(
|
|
198
198
|
{ ...l.center, z: 0 },
|
|
199
199
|
p,
|
|
200
|
-
g,
|
|
201
200
|
u,
|
|
201
|
+
g,
|
|
202
202
|
y,
|
|
203
203
|
!l.isCCW,
|
|
204
204
|
h
|
|
@@ -208,19 +208,19 @@ class V {
|
|
|
208
208
|
const l = d;
|
|
209
209
|
if (l.numberOfControlPoints > 0 && l.numberOfKnots > 0) {
|
|
210
210
|
const f = l.controlPoints.map(
|
|
211
|
-
(
|
|
212
|
-
x:
|
|
213
|
-
y:
|
|
211
|
+
(g) => ({
|
|
212
|
+
x: g.x,
|
|
213
|
+
y: g.y,
|
|
214
214
|
z: 0
|
|
215
215
|
})
|
|
216
216
|
);
|
|
217
217
|
let p = !0;
|
|
218
|
-
const
|
|
218
|
+
const u = l.controlPoints.map((g) => (g.weight == null && (p = !1), g.weight || 1));
|
|
219
219
|
s.push(
|
|
220
220
|
new v(
|
|
221
221
|
f,
|
|
222
222
|
l.knots,
|
|
223
|
-
p ?
|
|
223
|
+
p ? u : void 0
|
|
224
224
|
)
|
|
225
225
|
);
|
|
226
226
|
} else if (l.numberOfFitData > 0) {
|
|
@@ -234,20 +234,20 @@ class V {
|
|
|
234
234
|
}
|
|
235
235
|
}
|
|
236
236
|
});
|
|
237
|
-
const c =
|
|
238
|
-
c.length == 0 && s.length > 0 ? t.add(new
|
|
237
|
+
const c = O.buildFromEdges(s);
|
|
238
|
+
c.length == 0 && s.length > 0 ? t.add(new O(s)) : c.forEach((d) => t.add(d));
|
|
239
239
|
}
|
|
240
240
|
}), e.gradientFlag) {
|
|
241
|
-
const
|
|
242
|
-
if (t.hatchObjectType = re.GradientObject, t.gradientName =
|
|
243
|
-
const
|
|
244
|
-
|
|
241
|
+
const i = e;
|
|
242
|
+
if (t.hatchObjectType = re.GradientObject, t.gradientName = i.gradientName, t.gradientAngle = i.gradientRotation ?? 0, t.gradientShift = i.gradientDefinition ?? 0, t.gradientOneColorMode = i.gradientColorFlag == 1, t.shadeTintValue = i.colorTint ?? 0, i.gradientColors) {
|
|
243
|
+
const r = i.gradientColors.length;
|
|
244
|
+
r > 1 ? (t.gradientStartColor = i.gradientColors[0].rgb, t.gradientEndColor = i.gradientColors[1].rgb) : r > 0 && (t.gradientStartColor = i.gradientColors[0].rgb);
|
|
245
245
|
}
|
|
246
246
|
}
|
|
247
247
|
return t;
|
|
248
248
|
}
|
|
249
249
|
convertTable(e) {
|
|
250
|
-
const t = new
|
|
250
|
+
const t = new se(
|
|
251
251
|
e.name,
|
|
252
252
|
e.rowCount,
|
|
253
253
|
e.columnCount
|
|
@@ -261,23 +261,23 @@ class V {
|
|
|
261
261
|
}), t;
|
|
262
262
|
}
|
|
263
263
|
convertText(e) {
|
|
264
|
-
const t = new
|
|
264
|
+
const t = new ce();
|
|
265
265
|
t.textString = e.text, t.styleName = e.styleName, t.height = e.textHeight, t.position.copy(e.startPoint);
|
|
266
266
|
const o = !e.endPoint || e.endPoint.x === 0 && e.endPoint.y === 0 && (e.endPoint.z ?? 0) === 0;
|
|
267
267
|
return e.endPoint && !o ? t.alignmentPoint.copy(e.endPoint) : t.alignmentPoint.copy(e.startPoint), t.rotation = e.rotation, t.oblique = e.obliqueAngle ?? 0, t.thickness = e.thickness, t.horizontalMode = e.halign, t.verticalMode = e.valign, t.widthFactor = e.xScale ?? 1, t;
|
|
268
268
|
}
|
|
269
269
|
convertMText(e) {
|
|
270
|
-
const t = new
|
|
270
|
+
const t = new ae();
|
|
271
271
|
return t.contents = e.text, e.styleName != null && (t.styleName = e.styleName), t.height = e.textHeight, t.width = e.rectWidth, t.rotation = e.rotation || 0, t.location = e.insertionPoint, t.attachmentPoint = e.attachmentPoint, e.direction && (t.direction = new A(e.direction)), t.drawingDirection = e.drawingDirection, t;
|
|
272
272
|
}
|
|
273
273
|
convertLeader(e) {
|
|
274
|
-
const t = new
|
|
274
|
+
const t = new le();
|
|
275
275
|
return e.vertices.forEach((o) => {
|
|
276
276
|
t.appendVertex(o);
|
|
277
277
|
}), t.hasArrowHead = e.isArrowheadEnabled, t.hasHookLine = e.isHooklineExists, t.isSplined = e.isSpline, t.dimensionStyle = e.styleName, t.annoType = e.leaderCreationFlag, t;
|
|
278
278
|
}
|
|
279
279
|
convertMLine(e) {
|
|
280
|
-
const t = new
|
|
280
|
+
const t = new de();
|
|
281
281
|
return t.styleName = e.mlineStyle || "STANDARD", t.scale = e.scale, t.flags = e.flags, t.justification = e.justification, t.startPosition = e.startPoint, t.normal = e.extrusionDirection ?? A.Z_AXIS, t.styleCount = e.numberOfLines ?? 0, t.segments = (e.vertices ?? []).map((o) => ({
|
|
282
282
|
position: o.vertex,
|
|
283
283
|
direction: o.vertexDirection,
|
|
@@ -291,25 +291,25 @@ class V {
|
|
|
291
291
|
})), t;
|
|
292
292
|
}
|
|
293
293
|
convertMLeader(e) {
|
|
294
|
-
var p,
|
|
295
|
-
const t = new
|
|
294
|
+
var p, u, g, y;
|
|
295
|
+
const t = new fe(), o = e;
|
|
296
296
|
t.leaderLineType = this.readNumber(o, [
|
|
297
297
|
"multileaderType",
|
|
298
298
|
"leaderLineType",
|
|
299
299
|
"leaderType"
|
|
300
|
-
]) ??
|
|
301
|
-
const n = this.readNumber(o, ["contentType"]) ?? (e.textContent ?
|
|
300
|
+
]) ?? pe.StraightLeader;
|
|
301
|
+
const n = this.readNumber(o, ["contentType"]) ?? (e.textContent ? T.MTextContent : e.blockContent ? T.BlockContent : T.NoneContent);
|
|
302
302
|
t.contentType = n, t.doglegEnabled = this.readBoolean(o, ["doglegEnabled", "enableDogleg"]) ?? !1, t.doglegLength = this.readNumber(o, ["doglegLength"]) ?? 0, e.landingPoint && (t.landingPoint = e.landingPoint), e.doglegVector && (t.doglegVector = e.doglegVector);
|
|
303
|
-
const
|
|
303
|
+
const i = this.readString(o, [
|
|
304
304
|
"mleaderStyleId",
|
|
305
305
|
"mLeaderStyleId",
|
|
306
306
|
"mleaderStyleHandle",
|
|
307
307
|
"styleHandle",
|
|
308
308
|
"styleName"
|
|
309
309
|
]);
|
|
310
|
-
|
|
311
|
-
const
|
|
312
|
-
|
|
310
|
+
i && (t.mleaderStyleId = i);
|
|
311
|
+
const r = this.readPoint(o, ["normal", "extrusionDirection"]);
|
|
312
|
+
r && (t.normal = r);
|
|
313
313
|
const a = e.textContent, s = this.readString(a ?? {}, ["styleName", "textStyleName"]) ?? this.readString(o, ["textStyleName", "textStyle", "styleName"]);
|
|
314
314
|
s && (t.textStyleName = s), t.textHeight = this.readNumber(a ?? {}, ["textHeight", "height"]) ?? this.readNumber(o, [
|
|
315
315
|
"textHeight",
|
|
@@ -350,7 +350,7 @@ class V {
|
|
|
350
350
|
]);
|
|
351
351
|
h != null && D && (t.mtextContent = { text: h, anchorPoint: D });
|
|
352
352
|
}
|
|
353
|
-
if ((
|
|
353
|
+
if ((u = e.blockContent) != null && u.blockHandle && e.blockContent.position)
|
|
354
354
|
t.blockContent = {
|
|
355
355
|
blockHandle: e.blockContent.blockHandle,
|
|
356
356
|
position: e.blockContent.position
|
|
@@ -369,21 +369,21 @@ class V {
|
|
|
369
369
|
position: D
|
|
370
370
|
});
|
|
371
371
|
}
|
|
372
|
-
return (
|
|
373
|
-
var
|
|
372
|
+
return (g = e.leaders) == null || g.forEach((h) => {
|
|
373
|
+
var L;
|
|
374
374
|
const D = t.addLeader({
|
|
375
375
|
landingPoint: h.landingPoint ?? e.landingPoint,
|
|
376
376
|
doglegVector: h.doglegVector ?? e.doglegVector,
|
|
377
377
|
doglegLength: h.doglegLength ?? e.doglegLength
|
|
378
378
|
});
|
|
379
|
-
(
|
|
379
|
+
(L = h.leaderLines) == null || L.forEach((w) => {
|
|
380
380
|
var E;
|
|
381
|
-
const
|
|
381
|
+
const W = t.addLeaderLine(
|
|
382
382
|
D,
|
|
383
|
-
|
|
383
|
+
w.vertices ?? []
|
|
384
384
|
);
|
|
385
|
-
(E =
|
|
386
|
-
t.addBreak(D,
|
|
385
|
+
(E = w.breaks) == null || E.forEach((C) => {
|
|
386
|
+
t.addBreak(D, W, C.start, C.end);
|
|
387
387
|
});
|
|
388
388
|
});
|
|
389
389
|
}), t.numberOfLeaders === 0 && ((y = this.readLeaderLineArray(o)) == null || y.forEach((h) => {
|
|
@@ -397,7 +397,7 @@ class V {
|
|
|
397
397
|
}
|
|
398
398
|
convertDimension(e) {
|
|
399
399
|
if (e.subclassMarker == "AcDbAlignedDimension") {
|
|
400
|
-
const t = e, o = new
|
|
400
|
+
const t = e, o = new ue(
|
|
401
401
|
t.subDefinitionPoint1,
|
|
402
402
|
t.subDefinitionPoint2,
|
|
403
403
|
t.definitionPoint
|
|
@@ -419,7 +419,7 @@ class V {
|
|
|
419
419
|
z: 0
|
|
420
420
|
}), o.rotation = t.rotationAngle, this.processDimensionCommonAttrs(e, o), o;
|
|
421
421
|
} else if (e.subclassMarker == "AcDb3PointAngularDimension") {
|
|
422
|
-
const t = e, o = new
|
|
422
|
+
const t = e, o = new he(
|
|
423
423
|
t.centerPoint,
|
|
424
424
|
t.subDefinitionPoint1,
|
|
425
425
|
t.subDefinitionPoint2,
|
|
@@ -427,20 +427,20 @@ class V {
|
|
|
427
427
|
);
|
|
428
428
|
return this.processDimensionCommonAttrs(e, o), o;
|
|
429
429
|
} else if (e.subclassMarker == "AcDbOrdinateDimension") {
|
|
430
|
-
const t = e, o = new
|
|
430
|
+
const t = e, o = new De(
|
|
431
431
|
t.subDefinitionPoint1,
|
|
432
432
|
t.subDefinitionPoint2
|
|
433
433
|
);
|
|
434
434
|
return this.processDimensionCommonAttrs(e, o), o;
|
|
435
435
|
} else if (e.subclassMarker == "AcDbRadialDimension") {
|
|
436
|
-
const t = e, o = new
|
|
436
|
+
const t = e, o = new ye(
|
|
437
437
|
t.definitionPoint,
|
|
438
438
|
t.centerPoint,
|
|
439
439
|
t.leaderLength
|
|
440
440
|
);
|
|
441
441
|
return this.processDimensionCommonAttrs(e, o), o;
|
|
442
442
|
} else if (e.subclassMarker == "AcDbDiametricDimension") {
|
|
443
|
-
const t = e, o = new
|
|
443
|
+
const t = e, o = new Ae(
|
|
444
444
|
t.definitionPoint,
|
|
445
445
|
t.centerPoint,
|
|
446
446
|
t.leaderLength
|
|
@@ -459,11 +459,11 @@ class V {
|
|
|
459
459
|
) * e.imageSize.y, t.rotation = Math.atan2(e.uPixel.y, e.uPixel.x);
|
|
460
460
|
}
|
|
461
461
|
convertImage(e) {
|
|
462
|
-
const t = new
|
|
462
|
+
const t = new be();
|
|
463
463
|
return this.processImage(e, t), t;
|
|
464
464
|
}
|
|
465
465
|
convertWipeout(e) {
|
|
466
|
-
const t = new
|
|
466
|
+
const t = new Pe();
|
|
467
467
|
return this.processImage(e, t), t;
|
|
468
468
|
}
|
|
469
469
|
convertViewport(e) {
|
|
@@ -471,29 +471,29 @@ class V {
|
|
|
471
471
|
return t.number = e.viewportId, t.centerPoint.copy(e.viewportCenter), t.height = e.height, t.width = e.width, t.viewCenter.copy(e.displayCenter), t.viewHeight = e.viewHeight, t;
|
|
472
472
|
}
|
|
473
473
|
convertRay(e) {
|
|
474
|
-
const t = new
|
|
474
|
+
const t = new Te();
|
|
475
475
|
return t.basePoint.copy(e.firstPoint), t.unitDir.copy(e.unitDirection), t;
|
|
476
476
|
}
|
|
477
477
|
convertXline(e) {
|
|
478
|
-
const t = new
|
|
478
|
+
const t = new Le();
|
|
479
479
|
return t.basePoint.copy(e.firstPoint), t.unitDir.copy(e.unitDirection), t;
|
|
480
480
|
}
|
|
481
481
|
convertAttributeCommon(e, t) {
|
|
482
482
|
const o = e.text;
|
|
483
483
|
t.textString = o.text, t.styleName = o.styleName, t.height = o.textHeight, t.position.copy(o.startPoint);
|
|
484
|
-
const n = e.alignmentPoint ?? o.endPoint,
|
|
485
|
-
n && !
|
|
484
|
+
const n = e.alignmentPoint ?? o.endPoint, i = !n || n.x === 0 && n.y === 0 && (n.z ?? 0) === 0;
|
|
485
|
+
n && !i ? t.alignmentPoint.copy(n) : t.alignmentPoint.copy(o.startPoint), t.rotation = o.rotation, t.oblique = o.obliqueAngle ?? 0, t.thickness = o.thickness, t.horizontalMode = o.halign, t.verticalMode = o.valign, t.widthFactor = o.xScale ?? 1, t.tag = e.tag, t.fieldLength = e.fieldLength, t.isInvisible = (e.flags & P.Invisible) !== 0, t.isConst = (e.flags & P.Const) !== 0, t.isVerifiable = (e.flags & P.Verifiable) !== 0, t.isPreset = (e.flags & P.Preset) !== 0, t.lockPositionInBlock = e.lockPositionFlag, t.isReallyLocked = e.isReallyLocked, t.isMTextAttribute = (e.mtextFlag & k.MultiLine) !== 0, t.isConstMTextAttribute = (e.mtextFlag & k.ConstMultiLine) !== 0;
|
|
486
486
|
}
|
|
487
487
|
convertAttribute(e) {
|
|
488
488
|
const t = new N();
|
|
489
489
|
return this.convertAttributeCommon(e, t), t;
|
|
490
490
|
}
|
|
491
491
|
convertAttributeDefinition(e) {
|
|
492
|
-
const t = new
|
|
492
|
+
const t = new we();
|
|
493
493
|
return this.convertAttributeCommon(e, t), t.prompt = e.prompt, t;
|
|
494
494
|
}
|
|
495
495
|
convertBlockReference(e) {
|
|
496
|
-
const t = new
|
|
496
|
+
const t = new Ee(e.name);
|
|
497
497
|
return e.insertionPoint && t.position.copy(e.insertionPoint), t.scaleFactors.x = e.xScale, t.scaleFactors.y = e.yScale, t.scaleFactors.z = e.zScale, t.rotation = e.rotation, t.normal.copy(e.extrusionDirection), e.handle != null && (t.objectId = e.handle), e.attribs && e.attribs.forEach((o) => {
|
|
498
498
|
const n = this.convert(o);
|
|
499
499
|
n instanceof N && t.appendAttributes(n);
|
|
@@ -504,11 +504,11 @@ class V {
|
|
|
504
504
|
}
|
|
505
505
|
processCommonAttrs(e, t) {
|
|
506
506
|
if (t.layer = e.layer || "0", t.objectId = e.handle, e.ownerBlockRecordSoftId != null && (t.ownerId = e.ownerBlockRecordSoftId), e.lineType != null && (t.lineType = e.lineType), e.lineweight != null && (t.lineWeight = e.lineweight), e.lineTypeScale != null && (t.linetypeScale = e.lineTypeScale), e.color != null || e.colorIndex != null || e.colorName) {
|
|
507
|
-
const o = new
|
|
507
|
+
const o = new B();
|
|
508
508
|
e.color != null && o.setRGBValue(e.color), e.colorIndex != null && (e.color == null || e.colorIndex === 7) && (o.colorIndex = e.colorIndex), e.colorName && (o.colorName = e.colorName), t.color = o;
|
|
509
509
|
}
|
|
510
510
|
if (e.isVisible != null && (t.visibility = e.isVisible), e.transparency != null) {
|
|
511
|
-
const o = new
|
|
511
|
+
const o = new Ce();
|
|
512
512
|
o.method = e.transparencyType, (o.isByBlock || o.isByBlock) && (o.alpha = e.transparency), t.transparency = o;
|
|
513
513
|
}
|
|
514
514
|
}
|
|
@@ -544,12 +544,12 @@ class V {
|
|
|
544
544
|
if (Array.isArray(t))
|
|
545
545
|
return t.map((n) => {
|
|
546
546
|
if (!n || typeof n != "object") return;
|
|
547
|
-
const
|
|
548
|
-
return Array.isArray(
|
|
547
|
+
const i = n.vertices;
|
|
548
|
+
return Array.isArray(i) ? i.filter((r) => this.isPointLike(r)) : void 0;
|
|
549
549
|
}).filter((n) => !!n && n.length > 0);
|
|
550
550
|
const o = e.vertices;
|
|
551
551
|
if (Array.isArray(o)) {
|
|
552
|
-
const n = o.filter((
|
|
552
|
+
const n = o.filter((i) => this.isPointLike(i));
|
|
553
553
|
return n.length > 0 ? [n] : void 0;
|
|
554
554
|
}
|
|
555
555
|
}
|
|
@@ -557,93 +557,93 @@ class V {
|
|
|
557
557
|
return !!e && typeof e == "object" && typeof e.x == "number" && typeof e.y == "number";
|
|
558
558
|
}
|
|
559
559
|
}
|
|
560
|
-
const
|
|
561
|
-
class
|
|
560
|
+
const Ue = "*MODEL_SPACE";
|
|
561
|
+
class _e extends xe {
|
|
562
562
|
constructor(e = {}) {
|
|
563
563
|
super(e), e.useWorker = !0, e.parserWorkerUrl || (e.parserWorkerUrl = "/assets/libredwg-parser-worker.js");
|
|
564
564
|
}
|
|
565
565
|
async parse(e, t) {
|
|
566
566
|
const o = this.config, n = this.getParserWorkerTimeout(e, t);
|
|
567
567
|
if (o.useWorker && o.parserWorkerUrl) {
|
|
568
|
-
const
|
|
568
|
+
const i = Me({
|
|
569
569
|
workerUrl: o.parserWorkerUrl,
|
|
570
570
|
timeout: n,
|
|
571
571
|
maxConcurrentWorkers: 1
|
|
572
|
-
}),
|
|
573
|
-
if (
|
|
574
|
-
return
|
|
572
|
+
}), r = await i.execute(e);
|
|
573
|
+
if (i.destroy(), r.success)
|
|
574
|
+
return r.data;
|
|
575
575
|
throw new Error(
|
|
576
|
-
`Failed to parse drawing due to error: '${
|
|
576
|
+
`Failed to parse drawing due to error: '${r.error}'`
|
|
577
577
|
);
|
|
578
578
|
} else
|
|
579
579
|
throw new Error("dwg converter can run in web worker only!");
|
|
580
580
|
}
|
|
581
581
|
getFonts(e) {
|
|
582
582
|
const t = /* @__PURE__ */ new Map();
|
|
583
|
-
e.tables.BLOCK_RECORD.entries.forEach((
|
|
584
|
-
t.set(
|
|
583
|
+
e.tables.BLOCK_RECORD.entries.forEach((r) => {
|
|
584
|
+
t.set(r.name, r);
|
|
585
585
|
});
|
|
586
|
-
const o = /* @__PURE__ */ new Map(), n = (
|
|
587
|
-
if (
|
|
588
|
-
const a =
|
|
589
|
-
return a >= 0 ?
|
|
586
|
+
const o = /* @__PURE__ */ new Map(), n = (r) => {
|
|
587
|
+
if (r) {
|
|
588
|
+
const a = r.lastIndexOf(".");
|
|
589
|
+
return a >= 0 ? r.substring(0, a).toLowerCase() : r.toLowerCase();
|
|
590
590
|
}
|
|
591
591
|
};
|
|
592
|
-
e.tables.STYLE.entries.forEach((
|
|
592
|
+
e.tables.STYLE.entries.forEach((r) => {
|
|
593
593
|
const a = [];
|
|
594
|
-
let s = n(
|
|
595
|
-
s && a.push(s), s = n(
|
|
594
|
+
let s = n(r.font);
|
|
595
|
+
s && a.push(s), s = n(r.bigFont), s && a.push(s), o.set(r.name, a);
|
|
596
596
|
});
|
|
597
|
-
const
|
|
598
|
-
return this.getFontsInBlock(e.entities, t, o,
|
|
597
|
+
const i = /* @__PURE__ */ new Set();
|
|
598
|
+
return this.getFontsInBlock(e.entities, t, o, i), Array.from(i);
|
|
599
599
|
}
|
|
600
600
|
getFontsInBlock(e, t, o, n) {
|
|
601
|
-
const
|
|
602
|
-
e.forEach((
|
|
603
|
-
if (
|
|
604
|
-
const a =
|
|
605
|
-
[...a.text.matchAll(
|
|
601
|
+
const i = /\\f(.*?)\|/g;
|
|
602
|
+
e.forEach((r) => {
|
|
603
|
+
if (r.type == "MTEXT") {
|
|
604
|
+
const a = r;
|
|
605
|
+
[...a.text.matchAll(i)].forEach((c) => {
|
|
606
606
|
n.add(c[1].toLowerCase());
|
|
607
607
|
});
|
|
608
608
|
const s = o.get(a.styleName);
|
|
609
609
|
s == null || s.forEach((c) => n.add(c));
|
|
610
|
-
} else if (
|
|
611
|
-
const a =
|
|
610
|
+
} else if (r.type == "TEXT") {
|
|
611
|
+
const a = r, s = o.get(a.styleName);
|
|
612
612
|
s == null || s.forEach((c) => n.add(c));
|
|
613
|
-
} else if (
|
|
614
|
-
const a =
|
|
615
|
-
[...(typeof (s == null ? void 0 : s.text) == "string" ? s.text : "").matchAll(
|
|
613
|
+
} else if (r.type == "MULTILEADER" || r.type == "MLEADER") {
|
|
614
|
+
const a = r, s = a.textContent;
|
|
615
|
+
[...(typeof (s == null ? void 0 : s.text) == "string" ? s.text : "").matchAll(i)].forEach((f) => {
|
|
616
616
|
n.add(f[1].toLowerCase());
|
|
617
617
|
});
|
|
618
618
|
const d = typeof (s == null ? void 0 : s.styleName) == "string" ? s.styleName : typeof a.textStyleName == "string" ? a.textStyleName : typeof a.styleName == "string" ? a.styleName : void 0, l = d ? o.get(d) : void 0;
|
|
619
619
|
l == null || l.forEach((f) => n.add(f));
|
|
620
|
-
} else if (
|
|
621
|
-
const a =
|
|
620
|
+
} else if (r.type == "INSERT") {
|
|
621
|
+
const a = r, s = t.get(a.name);
|
|
622
622
|
s && this.getFontsInBlock(s.entities, t, o, n);
|
|
623
623
|
}
|
|
624
624
|
});
|
|
625
625
|
}
|
|
626
626
|
processLineTypes(e, t) {
|
|
627
627
|
e.tables.LTYPE.entries.forEach((n) => {
|
|
628
|
-
const
|
|
628
|
+
const i = {
|
|
629
629
|
name: n.name,
|
|
630
630
|
description: n.description,
|
|
631
631
|
standardFlag: n.standardFlag,
|
|
632
632
|
totalPatternLength: n.totalPatternLength,
|
|
633
633
|
pattern: n.pattern
|
|
634
|
-
},
|
|
635
|
-
this.processCommonTableEntryAttrs(n,
|
|
634
|
+
}, r = new Se(i);
|
|
635
|
+
this.processCommonTableEntryAttrs(n, r), r.name = n.name, t.tables.linetypeTable.add(r);
|
|
636
636
|
});
|
|
637
637
|
}
|
|
638
638
|
processTextStyles(e, t) {
|
|
639
639
|
e.tables.STYLE.entries.forEach((n) => {
|
|
640
|
-
const
|
|
641
|
-
this.processCommonTableEntryAttrs(n,
|
|
640
|
+
const i = new me(n);
|
|
641
|
+
this.processCommonTableEntryAttrs(n, i), t.tables.textStyleTable.add(i);
|
|
642
642
|
});
|
|
643
643
|
}
|
|
644
644
|
processDimStyles(e, t) {
|
|
645
645
|
e.tables.DIMSTYLE.entries.forEach((n) => {
|
|
646
|
-
const
|
|
646
|
+
const i = {
|
|
647
647
|
name: n.name,
|
|
648
648
|
ownerId: n.ownerHandle,
|
|
649
649
|
dimpost: n.DIMPOST || "",
|
|
@@ -712,55 +712,59 @@ class je extends xe {
|
|
|
712
712
|
dimblk2: n.DIMBLK2 || "",
|
|
713
713
|
dimlwd: n.DIMLWD,
|
|
714
714
|
dimlwe: n.DIMLWE
|
|
715
|
-
},
|
|
716
|
-
this.processCommonTableEntryAttrs(n,
|
|
715
|
+
}, r = new ve(i);
|
|
716
|
+
this.processCommonTableEntryAttrs(n, r), t.tables.dimStyleTable.add(r);
|
|
717
717
|
});
|
|
718
718
|
}
|
|
719
719
|
processLayers(e, t) {
|
|
720
720
|
e.tables.LAYER.entries.forEach((n) => {
|
|
721
|
-
const
|
|
722
|
-
|
|
723
|
-
const
|
|
721
|
+
const i = new B();
|
|
722
|
+
i.colorIndex = n.colorIndex;
|
|
723
|
+
const r = new Oe({
|
|
724
724
|
name: n.name,
|
|
725
725
|
standardFlags: n.standardFlag,
|
|
726
726
|
linetype: n.lineType,
|
|
727
727
|
lineWeight: n.lineweight,
|
|
728
728
|
isOff: n.off,
|
|
729
|
-
color:
|
|
729
|
+
color: i,
|
|
730
730
|
isPlottable: n.plotFlag != 0
|
|
731
731
|
});
|
|
732
|
-
this.processCommonTableEntryAttrs(n,
|
|
732
|
+
this.processCommonTableEntryAttrs(n, r), t.tables.layerTable.add(r);
|
|
733
733
|
});
|
|
734
734
|
}
|
|
735
735
|
processViewports(e, t) {
|
|
736
736
|
e.tables.VPORT.entries.forEach((n) => {
|
|
737
|
-
const
|
|
738
|
-
this.processCommonTableEntryAttrs(n,
|
|
737
|
+
const i = new ke();
|
|
738
|
+
this.processCommonTableEntryAttrs(n, i), n.circleSides && (i.circleSides = n.circleSides), i.standardFlag = n.standardFlag, i.center.copy(n.center ?? V), i.lowerLeftCorner.copy(n.lowerLeftCorner ?? Ne), i.upperRightCorner.copy(n.upperRightCorner ?? Re), n.snapBasePoint && i.snapBase.copy(n.snapBasePoint), n.snapRotationAngle && (i.snapAngle = n.snapRotationAngle), n.snapSpacing && i.snapIncrements.copy(n.snapSpacing), n.majorGridLines && (i.gridMajor = n.majorGridLines), n.gridSpacing && i.gridIncrements.copy(n.gridSpacing), n.backgroundObjectId && (i.backgroundObjectId = n.backgroundObjectId), i.gsView.center.copy(n.center ?? V), i.gsView.viewDirectionFromTarget.copy(
|
|
739
|
+
n.viewDirectionFromTarget ?? Ve
|
|
740
|
+
), i.gsView.viewTarget.copy(
|
|
741
|
+
n.viewTarget ?? Fe
|
|
742
|
+
), n.lensLength && (i.gsView.lensLength = n.lensLength), n.frontClippingPlane && (i.gsView.frontClippingPlane = n.frontClippingPlane), n.backClippingPlane && (i.gsView.backClippingPlane = n.backClippingPlane), n.viewHeight && (i.gsView.viewHeight = n.viewHeight), n.viewTwistAngle && (i.gsView.viewTwistAngle = n.viewTwistAngle), n.frozenLayers && (i.gsView.frozenLayers = n.frozenLayers), n.styleSheet && (i.gsView.styleSheet = n.styleSheet), n.renderMode && (i.gsView.renderMode = n.renderMode), n.viewMode && (i.gsView.viewMode = n.viewMode), n.ucsIconSetting && (i.gsView.ucsIconSetting = n.ucsIconSetting), n.ucsOrigin && i.gsView.ucsOrigin.copy(n.ucsOrigin), n.ucsXAxis && i.gsView.ucsXAxis.copy(n.ucsXAxis), n.ucsYAxis && i.gsView.ucsYAxis.copy(n.ucsYAxis), n.orthographicType && (i.gsView.orthographicType = n.orthographicType), n.shadePlotSetting && (i.gsView.shadePlotSetting = n.shadePlotSetting), n.shadePlotObjectId && (i.gsView.shadePlotObjectId = n.shadePlotObjectId), n.visualStyleObjectId && (i.gsView.visualStyleObjectId = n.visualStyleObjectId), n.isDefaultLightingOn && (i.gsView.isDefaultLightingOn = n.isDefaultLightingOn), n.defaultLightingType && (i.gsView.defaultLightingType = n.defaultLightingType), n.brightness && (i.gsView.brightness = n.brightness), n.contrast && (i.gsView.contrast = n.contrast), n.ambientColor && (i.gsView.ambientColor = n.ambientColor), t.tables.viewportTable.add(i);
|
|
739
743
|
});
|
|
740
744
|
}
|
|
741
745
|
processBlockTables(e, t) {
|
|
742
746
|
e.tables.BLOCK_RECORD.entries.forEach((n) => {
|
|
743
|
-
let
|
|
744
|
-
|
|
747
|
+
let i = t.tables.blockTable.getAt(n.name);
|
|
748
|
+
i || (i = new Be(), i.objectId = n.handle, i.name = n.name, i.ownerId = n.ownerHandle, i.origin.copy(n.basePoint), i.layoutId = n.layout, i.blockInsertUnits = n.insertionUnits, i.explodability = n.explodability, i.blockScaling = n.scalability, n.bmpPreview && (i.bmpPreview = n.bmpPreview), t.tables.blockTable.add(i)), !i.isModelSapce && n.entities && n.entities.length > 0 && this.processEntitiesInBlock(n.entities, i);
|
|
745
749
|
});
|
|
746
750
|
}
|
|
747
751
|
processBlocks(e, t) {
|
|
748
752
|
}
|
|
749
753
|
async processEntitiesInBlock(e, t) {
|
|
750
|
-
const o = new
|
|
751
|
-
for (let
|
|
752
|
-
const a = e[
|
|
753
|
-
s &&
|
|
754
|
+
const o = new F(), n = e.length, i = [];
|
|
755
|
+
for (let r = 0; r < n; r++) {
|
|
756
|
+
const a = e[r], s = o.convert(a);
|
|
757
|
+
s && i.push(s);
|
|
754
758
|
}
|
|
755
|
-
t.appendEntity(
|
|
759
|
+
t.appendEntity(i);
|
|
756
760
|
}
|
|
757
|
-
async processEntities(e, t, o, n,
|
|
758
|
-
const
|
|
761
|
+
async processEntities(e, t, o, n, i) {
|
|
762
|
+
const r = new F();
|
|
759
763
|
let a = [];
|
|
760
764
|
e.tables.BLOCK_RECORD.entries.forEach((l) => {
|
|
761
765
|
this.isModelSpace(l.name) && (a = l.entities);
|
|
762
766
|
});
|
|
763
|
-
const s = a.length, c = new
|
|
767
|
+
const s = a.length, c = new He(
|
|
764
768
|
s,
|
|
765
769
|
100 - n.value,
|
|
766
770
|
o
|
|
@@ -769,19 +773,19 @@ class je extends xe {
|
|
|
769
773
|
const d = t.tables.blockTable.modelSpace;
|
|
770
774
|
await c.processChunk(async (l, f) => {
|
|
771
775
|
const p = [];
|
|
772
|
-
for (let
|
|
773
|
-
const
|
|
776
|
+
for (let u = l; u < f; u++) {
|
|
777
|
+
const g = a[u], y = r.convert(g);
|
|
774
778
|
y && p.push(y);
|
|
775
779
|
}
|
|
776
|
-
if (d.appendEntity(p),
|
|
777
|
-
let
|
|
778
|
-
|
|
780
|
+
if (d.appendEntity(p), i) {
|
|
781
|
+
let u = n.value + f / s * (100 - n.value);
|
|
782
|
+
u > 100 && (u = 100), await i(u, "ENTITY", "IN-PROGRESS");
|
|
779
783
|
}
|
|
780
784
|
});
|
|
781
785
|
}
|
|
782
786
|
processHeader(e, t) {
|
|
783
787
|
const o = e.header;
|
|
784
|
-
o.CECOLOR && (o.CECOLOR.index >= 0 && o.CECOLOR.index <= 256 ? t.cecolor.colorIndex = o.CECOLOR.index : t.cecolor.setRGBValue(o.CECOLOR.rgb)), t.
|
|
788
|
+
o.CECOLOR && (o.CECOLOR.index >= 0 && o.CECOLOR.index <= 256 ? t.cecolor.colorIndex = o.CECOLOR.index : t.cecolor.setRGBValue(o.CECOLOR.rgb)), t.angbase = o.ANGBASE ?? 0, t.angdir = o.ANGDIR ?? 0, t.aunits = o.AUNITS ?? 0, o.AUPREC != null && (t.auprec = o.AUPREC), o.LUNITS != null && (t.lunits = o.LUNITS), o.LUPREC != null && (t.luprec = o.LUPREC), o.UNITMODE != null && (t.unitmode = o.UNITMODE), o.MEASUREMENT != null && (t.measurement = o.MEASUREMENT), t.celtype = o.CELTYPE ?? We, t.celtscale = o.CELTSCALE ?? 1, t.ltscale = o.LTSCALE ?? 1, o.EXTMAX && (t.extmax = o.EXTMAX), o.EXTMIN && (t.extmin = o.EXTMIN), t.insunits = o.INSUNITS ?? 1, t.pdmode = o.PDMODE ?? 0, t.pdsize = o.PDSIZE ?? 0, t.textstyle = o.TEXTSTYLE ?? R;
|
|
785
789
|
}
|
|
786
790
|
processCommonTableEntryAttrs(e, t) {
|
|
787
791
|
t.name = e.name, t.objectId = e.handle, e.ownerHandle != null && (t.ownerId = e.ownerHandle);
|
|
@@ -791,24 +795,24 @@ class je extends xe {
|
|
|
791
795
|
}
|
|
792
796
|
processLayouts(e, t) {
|
|
793
797
|
const o = t.objects.layout;
|
|
794
|
-
e.objects.LAYOUT.forEach((
|
|
795
|
-
const
|
|
796
|
-
|
|
798
|
+
e.objects.LAYOUT.forEach((i) => {
|
|
799
|
+
const r = new je();
|
|
800
|
+
r.layoutName = i.layoutName, r.tabOrder = i.tabOrder;
|
|
797
801
|
const a = t.tables.blockTable.newIterator();
|
|
798
|
-
|
|
802
|
+
r.objectId = i.handle;
|
|
799
803
|
for (const s of a)
|
|
800
|
-
if (s.layoutId ===
|
|
801
|
-
|
|
804
|
+
if (s.layoutId === r.objectId) {
|
|
805
|
+
r.blockTableRecordId = s.objectId;
|
|
802
806
|
break;
|
|
803
807
|
}
|
|
804
|
-
|
|
808
|
+
r.blockTableRecordId || i.layoutName === "Model" && (r.blockTableRecordId = t.tables.blockTable.modelSpace.objectId), r.limits.min.copy(i.minLimit), r.limits.max.copy(i.maxLimit), r.extents.min.copy(i.minExtent), r.extents.max.copy(i.maxExtent), i.viewportId && r.viewportArray.push(i.viewportId), this.processCommonObjectAttrs(i, r), o.setAt(r.layoutName, r);
|
|
805
809
|
});
|
|
806
810
|
}
|
|
807
811
|
processImageDefs(e, t) {
|
|
808
812
|
const o = t.objects.imageDefinition;
|
|
809
|
-
e.objects.IMAGEDEF.forEach((
|
|
810
|
-
const
|
|
811
|
-
|
|
813
|
+
e.objects.IMAGEDEF.forEach((i) => {
|
|
814
|
+
const r = new ze();
|
|
815
|
+
r.sourceFileName = i.fileName, this.processCommonObjectAttrs(i, r), o.setAt(r.objectId, r);
|
|
812
816
|
});
|
|
813
817
|
}
|
|
814
818
|
processCommonObjectAttrs(e, t) {
|
|
@@ -821,9 +825,9 @@ class je extends xe {
|
|
|
821
825
|
return o.flatMap((n) => t[n]);
|
|
822
826
|
}
|
|
823
827
|
isModelSpace(e) {
|
|
824
|
-
return e && e.toUpperCase() ==
|
|
828
|
+
return e && e.toUpperCase() == Ue;
|
|
825
829
|
}
|
|
826
830
|
}
|
|
827
831
|
export {
|
|
828
|
-
|
|
832
|
+
_e as AcDbLibreDwgConverter
|
|
829
833
|
};
|