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