@mlightcad/libdxfrw-converter 3.5.36 → 3.5.38
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/lib/index.d.ts +1 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +1 -1
- package/lib/index.js.map +1 -1
- package/package.json +5 -4
- package/dist/libdxfrw-converter.js +0 -521
package/lib/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export
|
|
1
|
+
export { AcDbLibdxfrwConverter } from './AcDbLibdxfrwConverter';
|
|
2
2
|
//# sourceMappingURL=index.d.ts.map
|
package/lib/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAA"}
|
package/lib/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export
|
|
1
|
+
export { AcDbLibdxfrwConverter } from './AcDbLibdxfrwConverter';
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mlightcad/libdxfrw-converter",
|
|
3
|
-
"version": "3.5.
|
|
3
|
+
"version": "3.5.38",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -24,19 +24,20 @@
|
|
|
24
24
|
"README.md",
|
|
25
25
|
"package.json"
|
|
26
26
|
],
|
|
27
|
+
"sideEffects": false,
|
|
27
28
|
"main": "./dist/libdxfrw-converter.umd.cjs",
|
|
28
|
-
"module": "./
|
|
29
|
+
"module": "./lib/index.js",
|
|
29
30
|
"types": "./lib/index.d.ts",
|
|
30
31
|
"exports": {
|
|
31
32
|
"types": "./lib/index.d.ts",
|
|
32
|
-
"import": "./
|
|
33
|
+
"import": "./lib/index.js",
|
|
33
34
|
"require": "./dist/libdxfrw-converter.umd.cjs"
|
|
34
35
|
},
|
|
35
36
|
"dependencies": {},
|
|
36
37
|
"devDependencies": {},
|
|
37
38
|
"peerDependencies": {
|
|
38
39
|
"@mlightcad/libdxfrw-web": "0.0.9",
|
|
39
|
-
"@mlightcad/data-model": "1.7.
|
|
40
|
+
"@mlightcad/data-model": "1.7.38"
|
|
40
41
|
},
|
|
41
42
|
"scripts": {
|
|
42
43
|
"clean": "rimraf dist lib tsconfig.tsbuildinfo",
|
|
@@ -1,521 +0,0 @@
|
|
|
1
|
-
import { AcGeVector3d as h, AcDbArc as z, transformOcsPointToWcs as A, AcDbCircle as L, AcDbEllipse as R, AcDbBlockReference as C, AcDbHatch as W, AcGePolyline2d as N, AcGeLoop2d as _, AcGeLine2d as Y, AcGeCircArc2d as F, AcGeVector2d as V, AcGeEllipseArc2d as H, AcGeSpline3d as P, AcDbLine as k, AcGePoint3d as v, AcDbMText as O, AcDbPoint as j, AcDbPolyline as B, AcGePoint2d as M, AcDbRay as G, AcDbSpline as D, AcDbText as X, AcDbXline as $, AcCmTransparency as U, AcDbRasterImageDef as Z, AcDbDatabaseConverter as q, AcDbLinetypeTableRecord as K, AcDbTextStyleTableRecord as J, DEFAULT_TEXT_STYLE as Q, AcDbDimStyleTableRecord as ee, AcCmColor as te, AcDbLayerTableRecord as ie, AcDbViewportTableRecord as ne, AcDbBlockTableRecord as se, ByLayer as oe, AcDbBatchProcessing as re } from "@mlightcad/data-model";
|
|
2
|
-
class x {
|
|
3
|
-
convert(e) {
|
|
4
|
-
const i = this.createEntity(e);
|
|
5
|
-
return i && this.processCommonAttrs(e, i), i;
|
|
6
|
-
}
|
|
7
|
-
createEntity(e) {
|
|
8
|
-
const i = window.libdxfrw;
|
|
9
|
-
if (e.eType == i.DRW_ETYPE.ARC)
|
|
10
|
-
return this.convertArc(e);
|
|
11
|
-
if (e.eType == i.DRW_ETYPE.CIRCLE)
|
|
12
|
-
return this.convertCirle(e);
|
|
13
|
-
if (e.eType != i.DRW_ETYPE.DIMENSION) {
|
|
14
|
-
if (e.eType == i.DRW_ETYPE.ELLIPSE)
|
|
15
|
-
return this.convertEllipse(e);
|
|
16
|
-
if (e.eType == i.DRW_ETYPE.HATCH)
|
|
17
|
-
return this.convertHatch(e);
|
|
18
|
-
if (e.eType != i.DRW_ETYPE.IMAGE) {
|
|
19
|
-
if (e.eType != i.DRW_ETYPE.LEADER) {
|
|
20
|
-
if (e.eType == i.DRW_ETYPE.LINE)
|
|
21
|
-
return this.convertLine(e);
|
|
22
|
-
if (e.eType == i.DRW_ETYPE.MTEXT)
|
|
23
|
-
return this.convertMText(e);
|
|
24
|
-
if (e.eType != i.DRW_ETYPE.POLYLINE) {
|
|
25
|
-
if (e.eType == i.DRW_ETYPE.LWPOLYLINE)
|
|
26
|
-
return this.convertPolyline(e);
|
|
27
|
-
if (e.eType == i.DRW_ETYPE.POINT)
|
|
28
|
-
return this.convertPoint(e);
|
|
29
|
-
if (e.eType == i.DRW_ETYPE.RAY)
|
|
30
|
-
return this.convertRay(e);
|
|
31
|
-
if (e.eType == i.DRW_ETYPE.SPLINE)
|
|
32
|
-
return this.convertSpline(e);
|
|
33
|
-
if (e.eType == i.DRW_ETYPE.TEXT)
|
|
34
|
-
return this.convertText(e);
|
|
35
|
-
if (e.eType != i.DRW_ETYPE.SOLID) {
|
|
36
|
-
if (e.eType != i.DRW_ETYPE.VIEWPORT) {
|
|
37
|
-
if (e.eType == i.DRW_ETYPE.XLINE)
|
|
38
|
-
return this.convertXline(e);
|
|
39
|
-
if (e.eType == i.DRW_ETYPE.INSERT)
|
|
40
|
-
return this.convertBlockReference(e);
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
return null;
|
|
48
|
-
}
|
|
49
|
-
convertArc(e) {
|
|
50
|
-
const i = e.extPoint ?? h.Z_AXIS;
|
|
51
|
-
return new z(
|
|
52
|
-
A(e.center(), i),
|
|
53
|
-
e.radius,
|
|
54
|
-
e.startAngle,
|
|
55
|
-
e.endAngle,
|
|
56
|
-
i
|
|
57
|
-
);
|
|
58
|
-
}
|
|
59
|
-
convertCirle(e) {
|
|
60
|
-
const i = e.extPoint ?? h.Z_AXIS;
|
|
61
|
-
return new L(
|
|
62
|
-
A(e.basePoint, i),
|
|
63
|
-
e.radius,
|
|
64
|
-
i
|
|
65
|
-
);
|
|
66
|
-
}
|
|
67
|
-
convertEllipse(e) {
|
|
68
|
-
const i = new h(e.secPoint), o = i.length();
|
|
69
|
-
return new R(
|
|
70
|
-
e.basePoint,
|
|
71
|
-
h.Z_AXIS,
|
|
72
|
-
i,
|
|
73
|
-
o,
|
|
74
|
-
o * e.ratio,
|
|
75
|
-
e.startAngle,
|
|
76
|
-
e.endAngle
|
|
77
|
-
);
|
|
78
|
-
}
|
|
79
|
-
convertBlockReference(e) {
|
|
80
|
-
const i = new C(e.name);
|
|
81
|
-
return e.basePoint && i.position.copy(e.basePoint), i.scaleFactors.x = e.xScale || 1, i.scaleFactors.y = e.yScale || 1, i.scaleFactors.z = e.zScale || 1, i.rotation = e.angle, i.normal.copy(e.extPoint), i;
|
|
82
|
-
}
|
|
83
|
-
convertHatch(e) {
|
|
84
|
-
const i = new W(), o = e.definitionLines;
|
|
85
|
-
for (let r = 0, t = o.size(); r < t; ++r) {
|
|
86
|
-
const s = o.get(r);
|
|
87
|
-
s != null && i.definitionLines.push({
|
|
88
|
-
angle: s.angle,
|
|
89
|
-
base: s.base,
|
|
90
|
-
offset: s.offset,
|
|
91
|
-
dashLengths: this.toNumberArray(s.dashPattern)
|
|
92
|
-
});
|
|
93
|
-
}
|
|
94
|
-
i.hatchStyle = e.hatchStyle, i.patternName = e.name, i.patternType = e.patternType, i.patternAngle = e.angle, i.patternScale = e.scale;
|
|
95
|
-
const n = e.getLoopList();
|
|
96
|
-
for (let r = 0, t = n.size(); r < t; ++r) {
|
|
97
|
-
const s = n.get(r);
|
|
98
|
-
if (s != null)
|
|
99
|
-
if (s.type == 2) {
|
|
100
|
-
const l = s.getObjList().get(0);
|
|
101
|
-
if (l) {
|
|
102
|
-
const f = new N(), m = l.getVertexList();
|
|
103
|
-
for (let g = 0, p = m.size(); g < p; ++g) {
|
|
104
|
-
const d = m.get(g);
|
|
105
|
-
d != null && f.addVertexAt(g, {
|
|
106
|
-
x: d.x,
|
|
107
|
-
y: d.y,
|
|
108
|
-
bulge: d.bulge
|
|
109
|
-
});
|
|
110
|
-
}
|
|
111
|
-
i.add(f);
|
|
112
|
-
}
|
|
113
|
-
} else {
|
|
114
|
-
const l = window.libdxfrw, f = s.getObjList(), m = new _();
|
|
115
|
-
for (let g = 0, p = f.size(); g < p; ++g) {
|
|
116
|
-
const d = f.get(g);
|
|
117
|
-
if (d != null) {
|
|
118
|
-
if (d.eType == l.DRW_ETYPE.LINE) {
|
|
119
|
-
const a = d;
|
|
120
|
-
m.add(new Y(a.basePoint, a.secPoint));
|
|
121
|
-
} else if (d.eType == l.DRW_ETYPE.ARC) {
|
|
122
|
-
const a = d;
|
|
123
|
-
m.add(
|
|
124
|
-
new F(
|
|
125
|
-
a.center(),
|
|
126
|
-
a.radius,
|
|
127
|
-
a.startAngle,
|
|
128
|
-
a.endAngle,
|
|
129
|
-
!a.isccw
|
|
130
|
-
)
|
|
131
|
-
);
|
|
132
|
-
} else if (d.eType == l.DRW_ETYPE.ELLIPSE) {
|
|
133
|
-
const a = d, c = a.basePoint, u = a.secPoint, E = new V(u).length(), I = E * a.ratio;
|
|
134
|
-
let T = a.startAngle, w = a.endAngle;
|
|
135
|
-
const S = Math.atan2(u.y, u.x);
|
|
136
|
-
a.isCounterClockwise || (T = Math.PI * 2 - T, w = Math.PI * 2 - w), m.add(
|
|
137
|
-
new H(
|
|
138
|
-
{ x: c.x, y: c.y, z: 0 },
|
|
139
|
-
E,
|
|
140
|
-
I,
|
|
141
|
-
T,
|
|
142
|
-
w,
|
|
143
|
-
!a.isCounterClockwise,
|
|
144
|
-
S
|
|
145
|
-
)
|
|
146
|
-
);
|
|
147
|
-
} else if (d.eType == l.DRW_ETYPE.SPLINE) {
|
|
148
|
-
const a = d;
|
|
149
|
-
if (a.numberOfControls > 0 && a.numberOfKnots > 0) {
|
|
150
|
-
const c = this.toPointArray(
|
|
151
|
-
a.getControlList(),
|
|
152
|
-
!0
|
|
153
|
-
), u = this.toNumberArray(a.weights), b = this.toNumberArray(a.knots);
|
|
154
|
-
m.add(
|
|
155
|
-
new P(
|
|
156
|
-
c,
|
|
157
|
-
b,
|
|
158
|
-
u.length > 0 ? u : void 0
|
|
159
|
-
)
|
|
160
|
-
);
|
|
161
|
-
} else if (a.numberOfFits > 0) {
|
|
162
|
-
const c = this.toPointArray(
|
|
163
|
-
a.getFitList()
|
|
164
|
-
);
|
|
165
|
-
m.add(new P(c, "Uniform"));
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
i.add(m);
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
return i;
|
|
174
|
-
}
|
|
175
|
-
convertLine(e) {
|
|
176
|
-
const i = e.basePoint, o = e.secPoint;
|
|
177
|
-
return new k(
|
|
178
|
-
new v(i.x, i.y, i.z || 0),
|
|
179
|
-
new v(o.x, o.y, o.z || 0)
|
|
180
|
-
);
|
|
181
|
-
}
|
|
182
|
-
convertMText(e) {
|
|
183
|
-
const i = new O();
|
|
184
|
-
return i.contents = e.text, e.style != null && (i.styleName = e.style), i.height = e.height, i.lineSpacingFactor = e.interlin, i.rotation = e.angle || 0, i.location = e.basePoint, i;
|
|
185
|
-
}
|
|
186
|
-
convertPoint(e) {
|
|
187
|
-
const i = new j();
|
|
188
|
-
return i.position = e.basePoint, i;
|
|
189
|
-
}
|
|
190
|
-
convertPolyline(e) {
|
|
191
|
-
const i = new B();
|
|
192
|
-
i.closed = !!(e.flags & 1);
|
|
193
|
-
const o = e.width ?? -1, n = e.getVertexList();
|
|
194
|
-
for (let r = 0, t = n.size(); r < t; ++r) {
|
|
195
|
-
const s = n.get(r);
|
|
196
|
-
s != null && i.addVertexAt(
|
|
197
|
-
r,
|
|
198
|
-
new M(s.x, s.y),
|
|
199
|
-
s.bulge,
|
|
200
|
-
s.startWidth ?? o,
|
|
201
|
-
s.endWidth ?? o
|
|
202
|
-
);
|
|
203
|
-
}
|
|
204
|
-
return i;
|
|
205
|
-
}
|
|
206
|
-
convertRay(e) {
|
|
207
|
-
const i = new G();
|
|
208
|
-
return i.basePoint.copy(e.basePoint), i.unitDir.copy(e.secPoint), i;
|
|
209
|
-
}
|
|
210
|
-
convertSpline(e) {
|
|
211
|
-
const i = this.toNumberArray(e.weights);
|
|
212
|
-
if (e.numberOfControls > 0 && e.numberOfKnots > 0)
|
|
213
|
-
return new D(
|
|
214
|
-
this.toPointArray(e.getControlList(), !1),
|
|
215
|
-
this.toNumberArray(e.knots),
|
|
216
|
-
i.length > 0 ? i : void 0,
|
|
217
|
-
e.degree,
|
|
218
|
-
!!(e.flags & 1)
|
|
219
|
-
);
|
|
220
|
-
if (e.numberOfFits > 0) {
|
|
221
|
-
const o = this.toPointArray(e.getFitList());
|
|
222
|
-
if (o.length > 0)
|
|
223
|
-
return new D(
|
|
224
|
-
o,
|
|
225
|
-
"Uniform",
|
|
226
|
-
e.degree,
|
|
227
|
-
!!(e.flags & 1)
|
|
228
|
-
);
|
|
229
|
-
}
|
|
230
|
-
return null;
|
|
231
|
-
}
|
|
232
|
-
convertText(e) {
|
|
233
|
-
const i = new X();
|
|
234
|
-
return i.textString = e.text, i.styleName = e.style, i.height = e.height, i.position.copy(e.basePoint), i.rotation = e.angle || 0, i.oblique = e.oblique ?? 0, i.horizontalMode = e.alignH, i.verticalMode = e.alignV, i.widthFactor = e.widthScale ?? 1, i;
|
|
235
|
-
}
|
|
236
|
-
convertXline(e) {
|
|
237
|
-
const i = new $();
|
|
238
|
-
return i.basePoint.copy(e.basePoint), i.unitDir.copy(e.secPoint), i;
|
|
239
|
-
}
|
|
240
|
-
processCommonAttrs(e, i) {
|
|
241
|
-
i.layer = e.layer, i.objectId = e.handle.toString(), e.parentHandle != null && (i.ownerId = e.parentHandle.toString()), e.lineType != null && (i.lineType = e.lineType), e.lWeight != null && (i.lineWeight = e.lWeight), e.ltypeScale != null && (i.linetypeScale = e.ltypeScale), e.color24 != null && i.color.setRGBValue(e.color24), e.color != null && (i.color.colorIndex = e.color), e.colorName && (i.color.colorName = e.colorName), e.visible != null && (i.visibility = e.visible), e.transparency != null && (i.transparency = U.deserialize(e.transparency));
|
|
242
|
-
}
|
|
243
|
-
toNumberArray(e) {
|
|
244
|
-
const i = [];
|
|
245
|
-
for (let o = 0, n = e.size(); o < n; ++o) {
|
|
246
|
-
const r = e.get(o);
|
|
247
|
-
r != null && i.push(r);
|
|
248
|
-
}
|
|
249
|
-
return i;
|
|
250
|
-
}
|
|
251
|
-
toPointArray(e, i = !0) {
|
|
252
|
-
const o = [];
|
|
253
|
-
for (let n = 0, r = e.size(); n < r; ++n) {
|
|
254
|
-
const t = e.get(n);
|
|
255
|
-
t != null && o.push({ x: t.x, y: t.y, z: i ? 0 : t.z });
|
|
256
|
-
}
|
|
257
|
-
return o;
|
|
258
|
-
}
|
|
259
|
-
}
|
|
260
|
-
class le {
|
|
261
|
-
convertImageDef(e) {
|
|
262
|
-
const i = new Z();
|
|
263
|
-
return i.sourceFileName = e.path, i.objectId = e.handle.toString(), e.parentHandle != null && (i.ownerId = e.parentHandle.toString()), i;
|
|
264
|
-
}
|
|
265
|
-
}
|
|
266
|
-
class de extends q {
|
|
267
|
-
constructor(e) {
|
|
268
|
-
super(), this.librefrw = e;
|
|
269
|
-
}
|
|
270
|
-
onFinished() {
|
|
271
|
-
super.onFinished(), this.dwg && (this.dwg.delete(), this.dwg = void 0), this.database && (this.database.delete(), this.database = void 0), this.fileHandler && (this.fileHandler.delete(), this.fileHandler = void 0);
|
|
272
|
-
}
|
|
273
|
-
async parse(e) {
|
|
274
|
-
if (this.librefrw == null)
|
|
275
|
-
throw new Error("librefrw is not loaded!");
|
|
276
|
-
const i = this.librefrw;
|
|
277
|
-
return this.database = new i.DRW_Database(), this.fileHandler = new i.DRW_FileHandler(), this.fileHandler.database = this.database, this.dwg = new i.DRW_DwgR(e), this.dwg.read(this.fileHandler, !1), {
|
|
278
|
-
model: this.database,
|
|
279
|
-
data: {
|
|
280
|
-
unknownEntityCount: 0
|
|
281
|
-
}
|
|
282
|
-
};
|
|
283
|
-
}
|
|
284
|
-
processLineTypes(e, i) {
|
|
285
|
-
const o = e.lineTypes;
|
|
286
|
-
for (let n = 0, r = o.size(); n < r; ++n) {
|
|
287
|
-
const t = o.get(n);
|
|
288
|
-
if (t != null) {
|
|
289
|
-
const s = {
|
|
290
|
-
name: t.name,
|
|
291
|
-
description: t.desc,
|
|
292
|
-
standardFlag: t.flags,
|
|
293
|
-
totalPatternLength: t.length,
|
|
294
|
-
pattern: this.convertLineTypePattern(t.path)
|
|
295
|
-
}, l = new K(s);
|
|
296
|
-
this.processCommonTableEntryAttrs(t, l), l.name = t.name, i.tables.linetypeTable.add(l);
|
|
297
|
-
}
|
|
298
|
-
}
|
|
299
|
-
}
|
|
300
|
-
convertLineTypePattern(e) {
|
|
301
|
-
const i = [];
|
|
302
|
-
for (let o = 0, n = e.size(); o < n; ++o)
|
|
303
|
-
i.push({
|
|
304
|
-
elementLength: e.get(o) || 0,
|
|
305
|
-
elementTypeFlag: 0
|
|
306
|
-
});
|
|
307
|
-
return i;
|
|
308
|
-
}
|
|
309
|
-
processTextStyles(e, i) {
|
|
310
|
-
const o = e.textStyles;
|
|
311
|
-
for (let n = 0, r = o.size(); n < r; ++n) {
|
|
312
|
-
const t = o.get(n);
|
|
313
|
-
if (t != null) {
|
|
314
|
-
const s = {
|
|
315
|
-
name: t.name,
|
|
316
|
-
standardFlag: t.flags,
|
|
317
|
-
fixedTextHeight: t.height,
|
|
318
|
-
widthFactor: t.width,
|
|
319
|
-
obliqueAngle: t.oblique,
|
|
320
|
-
textGenerationFlag: t.genFlag,
|
|
321
|
-
lastHeight: t.lastHeight,
|
|
322
|
-
font: t.font,
|
|
323
|
-
bigFont: t.bigFont
|
|
324
|
-
}, l = new J(s);
|
|
325
|
-
this.processCommonTableEntryAttrs(t, l), i.tables.textStyleTable.add(l);
|
|
326
|
-
}
|
|
327
|
-
}
|
|
328
|
-
}
|
|
329
|
-
processDimStyles(e, i) {
|
|
330
|
-
const o = e.dimStyles;
|
|
331
|
-
for (let n = 0, r = o.size(); n < r; ++n) {
|
|
332
|
-
const t = o.get(n);
|
|
333
|
-
if (t != null) {
|
|
334
|
-
const s = {
|
|
335
|
-
name: t.name,
|
|
336
|
-
ownerId: t.parentHandle.toString(),
|
|
337
|
-
dimpost: t.dimpost || "",
|
|
338
|
-
dimapost: t.dimapost || "",
|
|
339
|
-
dimscale: t.dimscale,
|
|
340
|
-
dimasz: t.dimasz,
|
|
341
|
-
dimexo: t.dimexo,
|
|
342
|
-
dimdli: t.dimdli,
|
|
343
|
-
dimexe: t.dimexe,
|
|
344
|
-
dimrnd: t.dimrnd,
|
|
345
|
-
dimdle: t.dimdle,
|
|
346
|
-
dimtp: t.dimtp,
|
|
347
|
-
dimtm: t.dimtm,
|
|
348
|
-
dimtxt: t.dimtxt,
|
|
349
|
-
dimcen: t.dimcen,
|
|
350
|
-
dimtsz: t.dimtsz,
|
|
351
|
-
dimaltf: t.dimaltf,
|
|
352
|
-
dimlfac: t.dimlfac,
|
|
353
|
-
dimtvp: t.dimtvp,
|
|
354
|
-
dimtfac: t.dimtfac,
|
|
355
|
-
dimgap: t.dimgap,
|
|
356
|
-
dimaltrnd: t.dimaltrnd,
|
|
357
|
-
dimtol: t.dimtol == null || t.dimtol == 0 ? 0 : 1,
|
|
358
|
-
dimlim: t.dimlim == null || t.dimlim == 0 ? 0 : 1,
|
|
359
|
-
dimtih: t.dimtih == null || t.dimtih == 0 ? 0 : 1,
|
|
360
|
-
dimtoh: t.dimtoh == null || t.dimtoh == 0 ? 0 : 1,
|
|
361
|
-
dimse1: t.dimse1 == null || t.dimse1 == 0 ? 0 : 1,
|
|
362
|
-
dimse2: t.dimse2 == null || t.dimse2 == 0 ? 0 : 1,
|
|
363
|
-
dimtad: t.dimtad,
|
|
364
|
-
dimzin: t.dimzin,
|
|
365
|
-
dimazin: t.dimazin,
|
|
366
|
-
dimalt: t.dimalt,
|
|
367
|
-
dimaltd: t.dimaltd,
|
|
368
|
-
dimtofl: t.dimtofl,
|
|
369
|
-
dimsah: t.dimsah,
|
|
370
|
-
dimtix: t.dimtix,
|
|
371
|
-
dimsoxd: t.dimsoxd,
|
|
372
|
-
dimclrd: t.dimclrd,
|
|
373
|
-
dimclre: t.dimclre,
|
|
374
|
-
dimclrt: t.dimclrt,
|
|
375
|
-
dimadec: t.dimadec || 0,
|
|
376
|
-
dimunit: t.dimunit || 2,
|
|
377
|
-
dimdec: t.dimdec,
|
|
378
|
-
dimtdec: t.dimtdec,
|
|
379
|
-
dimaltu: t.dimaltu,
|
|
380
|
-
dimalttd: t.dimalttd,
|
|
381
|
-
dimaunit: t.dimaunit,
|
|
382
|
-
dimfrac: t.dimfrac,
|
|
383
|
-
dimlunit: t.dimlunit,
|
|
384
|
-
dimdsep: t.dimdsep.toString(),
|
|
385
|
-
dimtmove: t.dimtmove || 0,
|
|
386
|
-
dimjust: t.dimjust,
|
|
387
|
-
dimsd1: t.dimsd1,
|
|
388
|
-
dimsd2: t.dimsd2,
|
|
389
|
-
dimtolj: t.dimtolj,
|
|
390
|
-
dimtzin: t.dimtzin,
|
|
391
|
-
dimaltz: t.dimaltz,
|
|
392
|
-
dimalttz: t.dimaltttz,
|
|
393
|
-
dimfit: t.dimfit || 0,
|
|
394
|
-
dimupt: t.dimupt,
|
|
395
|
-
dimatfit: t.dimatfit,
|
|
396
|
-
dimtxsty: t.dimtxsty || Q,
|
|
397
|
-
dimldrblk: t.dimldrblk || "",
|
|
398
|
-
dimblk: t.dimblk || "",
|
|
399
|
-
dimblk1: t.dimblk1 || "",
|
|
400
|
-
dimblk2: t.dimblk2 || "",
|
|
401
|
-
dimlwd: t.dimlwd,
|
|
402
|
-
dimlwe: t.dimlwe
|
|
403
|
-
}, l = new ee(s);
|
|
404
|
-
this.processCommonTableEntryAttrs(t, l), i.tables.dimStyleTable.add(l);
|
|
405
|
-
}
|
|
406
|
-
}
|
|
407
|
-
}
|
|
408
|
-
processLayers(e, i) {
|
|
409
|
-
const o = e.layers;
|
|
410
|
-
for (let n = 0, r = o.size(); n < r; ++n) {
|
|
411
|
-
const t = o.get(n);
|
|
412
|
-
if (t != null) {
|
|
413
|
-
const s = new te();
|
|
414
|
-
s.colorIndex = t.color;
|
|
415
|
-
const l = new ie({
|
|
416
|
-
name: t.name,
|
|
417
|
-
standardFlags: t.flags,
|
|
418
|
-
linetype: t.lineType,
|
|
419
|
-
lineWeight: t.lWeight,
|
|
420
|
-
isOff: t.color < 0,
|
|
421
|
-
color: s,
|
|
422
|
-
isPlottable: t.plotF,
|
|
423
|
-
materialId: t.handleMaterialS
|
|
424
|
-
});
|
|
425
|
-
this.processCommonTableEntryAttrs(t, l), i.tables.layerTable.add(l);
|
|
426
|
-
}
|
|
427
|
-
}
|
|
428
|
-
}
|
|
429
|
-
processViewports(e, i) {
|
|
430
|
-
const o = e.viewports;
|
|
431
|
-
for (let n = 0, r = o.size(); n < r; ++n) {
|
|
432
|
-
const t = o.get(n);
|
|
433
|
-
if (t != null) {
|
|
434
|
-
const s = new ne();
|
|
435
|
-
this.processCommonTableEntryAttrs(t, s), t.circleZoom && (s.circleSides = t.circleZoom), s.standardFlag = t.flags, s.center.copy(t.center), s.lowerLeftCorner.copy(t.lowerLeft), s.upperRightCorner.copy(t.upperRight), t.snapBase && s.snapBase.copy(t.snapBase), t.snapAngle && (s.snapAngle = t.snapAngle), s.snapIncrements && s.snapIncrements.copy(t.snapSpacing), t.gridSpacing && s.gridIncrements.copy(t.gridSpacing), s.gsView.center.copy(t.center), s.gsView.viewDirectionFromTarget.copy(t.viewDir), s.gsView.viewTarget.copy(t.viewTarget), t.lensHeight && (s.gsView.lensLength = t.lensHeight), t.height && (s.gsView.viewHeight = t.height), t.twistAngle && (s.gsView.viewTwistAngle = t.twistAngle), t.viewMode && (s.gsView.viewMode = t.viewMode), t.ucsIcon && (s.gsView.ucsIconSetting = t.ucsIcon), i.tables.viewportTable.add(s);
|
|
436
|
-
}
|
|
437
|
-
}
|
|
438
|
-
}
|
|
439
|
-
processBlockTables(e, i) {
|
|
440
|
-
const o = e.blocks;
|
|
441
|
-
for (let n = 0, r = o.size(); n < r; ++n) {
|
|
442
|
-
const t = o.get(n);
|
|
443
|
-
if (t != null) {
|
|
444
|
-
const s = new se();
|
|
445
|
-
s.objectId = t.handle.toString(), s.name = t.name.toUpperCase(), i.tables.blockTable.add(s), t.entities && this.processEntitiesInBlock(t.entities, s);
|
|
446
|
-
}
|
|
447
|
-
}
|
|
448
|
-
}
|
|
449
|
-
processCommonTableEntryAttrs(e, i) {
|
|
450
|
-
i.name = e.name, i.objectId = e.handle.toString(), e.parentHandle != null && (i.ownerId = e.parentHandle.toString());
|
|
451
|
-
}
|
|
452
|
-
processHeader(e, i) {
|
|
453
|
-
const o = e.header;
|
|
454
|
-
let n = o.getVar("$CECOLOR");
|
|
455
|
-
i.cecolor.colorIndex = n ? n.getInt() : 256, n = o.getVar("$ANGDIR"), i.angdir = n ? n.getInt() : 0, n = o.getVar("$AUNITS"), i.aunits = n ? n.getInt() : 0, n = o.getVar("$CELTYPE"), i.celtype = n ? n.getString() : oe, n = o.getVar("$INSUNITS"), i.insunits = n ? n.getInt() : 1, n = o.getVar("$UNITMODE"), n && (i.unitmode = n.getInt()), n = o.getVar("$MEASUREMENT"), n && (i.measurement = n.getInt()), n = o.getVar("$PDMODE"), i.pdmode = n ? n.getInt() : 0, n = o.getVar("$PDSIZE"), i.pdsize = n ? n.getDouble() : 0;
|
|
456
|
-
}
|
|
457
|
-
processObjects(e, i) {
|
|
458
|
-
this.processImageDefs(e.images, i);
|
|
459
|
-
}
|
|
460
|
-
processImageDefs(e, i) {
|
|
461
|
-
const o = new le(), n = i.objects.imageDefinition;
|
|
462
|
-
for (let r = 0, t = e.size(); r < t; ++r) {
|
|
463
|
-
const s = e.get(r);
|
|
464
|
-
if (s != null) {
|
|
465
|
-
const l = o.convertImageDef(s);
|
|
466
|
-
n.setAt(l.objectId, l);
|
|
467
|
-
}
|
|
468
|
-
}
|
|
469
|
-
}
|
|
470
|
-
async processEntitiesInBlock(e, i) {
|
|
471
|
-
const o = new x(), n = [];
|
|
472
|
-
for (let r = 0, t = e.size(); r < t; ++r) {
|
|
473
|
-
const s = e.get(r);
|
|
474
|
-
if (s != null) {
|
|
475
|
-
const l = o.convert(s);
|
|
476
|
-
l && n.push(l);
|
|
477
|
-
}
|
|
478
|
-
}
|
|
479
|
-
i.appendEntity(n);
|
|
480
|
-
}
|
|
481
|
-
async processEntities(e, i, o, n, r) {
|
|
482
|
-
if (e.mBlock) {
|
|
483
|
-
const t = new x();
|
|
484
|
-
let s = [];
|
|
485
|
-
const l = e.mBlock.entities, f = l.size();
|
|
486
|
-
for (let p = 0; p < f; p++) {
|
|
487
|
-
const d = l.get(p);
|
|
488
|
-
d && s.push(d);
|
|
489
|
-
}
|
|
490
|
-
const m = new re(
|
|
491
|
-
s.length,
|
|
492
|
-
100 - n.value,
|
|
493
|
-
o
|
|
494
|
-
);
|
|
495
|
-
this.config.convertByEntityType && (s = this.groupAndFlattenByType(s));
|
|
496
|
-
const g = i.tables.blockTable.modelSpace;
|
|
497
|
-
await m.processChunk(async (p, d) => {
|
|
498
|
-
const a = [];
|
|
499
|
-
for (let c = p; c < d; c++) {
|
|
500
|
-
const u = s[c], b = t.convert(u);
|
|
501
|
-
b && a.push(b);
|
|
502
|
-
}
|
|
503
|
-
if (g.appendEntity(a), r) {
|
|
504
|
-
let c = n.value + d / f * (100 - n.value);
|
|
505
|
-
c > 100 && (c = 100), await r(c, "ENTITY", "IN-PROGRESS");
|
|
506
|
-
}
|
|
507
|
-
});
|
|
508
|
-
}
|
|
509
|
-
}
|
|
510
|
-
groupAndFlattenByType(e) {
|
|
511
|
-
const i = {}, o = [], n = e.length;
|
|
512
|
-
for (let r = 0; r < n; r++) {
|
|
513
|
-
const t = e[r], s = t.eType.value;
|
|
514
|
-
i[s] || (i[s] = [], o.push(s)), i[s].push(t);
|
|
515
|
-
}
|
|
516
|
-
return o.flatMap((r) => i[r]);
|
|
517
|
-
}
|
|
518
|
-
}
|
|
519
|
-
export {
|
|
520
|
-
de as AcDbLibdxfrwConverter
|
|
521
|
-
};
|