@mlightcad/libredwg-web 0.7.4 → 0.7.5
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-web.js +1292 -1024
- package/dist/libredwg-web.umd.cjs +1292 -1024
- package/lib/converter/converter.d.ts +1 -0
- package/lib/converter/converter.js +253 -343
- package/lib/converter/dwgColorToMLeaderRawColor.d.ts +10 -0
- package/lib/converter/dwgColorToMLeaderRawColor.js +55 -0
- package/lib/converter/entityConverter.d.ts +2 -0
- package/lib/converter/entityConverter.js +679 -562
- package/lib/converter/index.d.ts +1 -0
- package/lib/converter/index.js +1 -0
- package/lib/database/database.d.ts +2 -1
- package/lib/database/entities/index.d.ts +2 -0
- package/lib/database/entities/index.js +2 -0
- package/lib/database/entities/multileader.d.ts +190 -0
- package/lib/database/entities/multileader.js +2 -0
- package/lib/database/entities/shape.d.ts +50 -0
- package/lib/database/entities/shape.js +2 -0
- package/lib/database/objects/index.d.ts +1 -0
- package/lib/database/objects/index.js +1 -0
- package/lib/database/objects/mleaderStyle.d.ts +101 -0
- package/lib/database/objects/mleaderStyle.js +2 -0
- package/lib/libredwg.d.ts +61 -0
- package/lib/libredwg.js +107 -18
- package/package.json +1 -1
- package/wasm/libredwg-web.d.ts +3 -0
- package/wasm/libredwg-web.wasm +0 -0
package/dist/libredwg-web.js
CHANGED
|
@@ -1166,6 +1166,45 @@ var Dwg_Color_Method = /* @__PURE__ */ ((Dwg_Color_Method2) => {
|
|
|
1166
1166
|
Dwg_Color_Method2[Dwg_Color_Method2["None"] = 200] = "None";
|
|
1167
1167
|
return Dwg_Color_Method2;
|
|
1168
1168
|
})(Dwg_Color_Method || {});
|
|
1169
|
+
const RAW_COLOR_TYPE_BY_LAYER = 192;
|
|
1170
|
+
const RAW_COLOR_TYPE_BY_BLOCK = 193;
|
|
1171
|
+
const RAW_COLOR_TYPE_RGB = 194;
|
|
1172
|
+
const RAW_COLOR_TYPE_ACI = 195;
|
|
1173
|
+
const RAW_COLOR_TYPE_WINDOW_BG = 200;
|
|
1174
|
+
function dwgColorToMLeaderRawColor(color) {
|
|
1175
|
+
if (color == null) return void 0;
|
|
1176
|
+
const methodNum = color.method;
|
|
1177
|
+
const method = color.method != null && methodNum !== 0 ? methodNum : color.rgb >>> 24 & 255;
|
|
1178
|
+
const index = color.index;
|
|
1179
|
+
if (color.rgb != null && method >= RAW_COLOR_TYPE_BY_LAYER && method <= RAW_COLOR_TYPE_WINDOW_BG && (color.rgb >>> 24 & 255) === method) {
|
|
1180
|
+
return color.rgb >> 0;
|
|
1181
|
+
}
|
|
1182
|
+
if (method === Dwg_Color_Method.ByLayer || index === 256) {
|
|
1183
|
+
return RAW_COLOR_TYPE_BY_LAYER << 24 >> 0;
|
|
1184
|
+
}
|
|
1185
|
+
if (method === Dwg_Color_Method.ByBlock || index === 0) {
|
|
1186
|
+
return RAW_COLOR_TYPE_BY_BLOCK << 24 >> 0;
|
|
1187
|
+
}
|
|
1188
|
+
if (method === Dwg_Color_Method.None) {
|
|
1189
|
+
return RAW_COLOR_TYPE_WINDOW_BG << 24 >> 0;
|
|
1190
|
+
}
|
|
1191
|
+
if (method === Dwg_Color_Method.TrueColor) {
|
|
1192
|
+
const rgb = color.rgb != null ? color.rgb & 16777215 : void 0;
|
|
1193
|
+
if (rgb != null) {
|
|
1194
|
+
return (RAW_COLOR_TYPE_RGB << 24 | rgb) >> 0;
|
|
1195
|
+
}
|
|
1196
|
+
}
|
|
1197
|
+
if (method === Dwg_Color_Method.ForegroundColor) {
|
|
1198
|
+
return (RAW_COLOR_TYPE_ACI << 24 | 7) >> 0;
|
|
1199
|
+
}
|
|
1200
|
+
if (method === Dwg_Color_Method.Entities && index > 0 && index < 256) {
|
|
1201
|
+
return (RAW_COLOR_TYPE_ACI << 24 | index & 255) >> 0;
|
|
1202
|
+
}
|
|
1203
|
+
if (index > 0 && index < 256) {
|
|
1204
|
+
return (RAW_COLOR_TYPE_ACI << 24 | index & 255) >> 0;
|
|
1205
|
+
}
|
|
1206
|
+
return RAW_COLOR_TYPE_BY_BLOCK << 24 >> 0;
|
|
1207
|
+
}
|
|
1169
1208
|
const MODEL_SPACE = "*MODEL_SPACE";
|
|
1170
1209
|
const MODEL_SPACE_PREFIX = "*PAPER_SPACE";
|
|
1171
1210
|
const isModelSpace = (name) => {
|
|
@@ -1260,6 +1299,8 @@ class LibreEntityConverter {
|
|
|
1260
1299
|
return this.convertLWPolyline(entity_tio, commonAttrs);
|
|
1261
1300
|
} else if (fixedtype == Dwg_Object_Type.DWG_TYPE_MLINE) {
|
|
1262
1301
|
return this.convertMLine(entity_tio, commonAttrs);
|
|
1302
|
+
} else if (fixedtype == Dwg_Object_Type.DWG_TYPE_MULTILEADER) {
|
|
1303
|
+
return this.convertMultiLeader(entity_tio, commonAttrs);
|
|
1263
1304
|
} else if (fixedtype == Dwg_Object_Type.DWG_TYPE_MTEXT) {
|
|
1264
1305
|
return this.convertMText(entity_tio, commonAttrs);
|
|
1265
1306
|
} else if (fixedtype == Dwg_Object_Type.DWG_TYPE_OLE2FRAME) {
|
|
@@ -1278,6 +1319,8 @@ class LibreEntityConverter {
|
|
|
1278
1319
|
return this.convertRay(entity_tio, commonAttrs);
|
|
1279
1320
|
} else if (fixedtype == Dwg_Object_Type.DWG_TYPE_SECTIONOBJECT) {
|
|
1280
1321
|
return this.convertSection(entity_tio, commonAttrs);
|
|
1322
|
+
} else if (fixedtype == Dwg_Object_Type.DWG_TYPE_SHAPE) {
|
|
1323
|
+
return this.convertShape(entity_tio, commonAttrs);
|
|
1281
1324
|
} else if (fixedtype == Dwg_Object_Type.DWG_TYPE_SOLID) {
|
|
1282
1325
|
return this.convertSolid(entity_tio, commonAttrs);
|
|
1283
1326
|
} else if (fixedtype == Dwg_Object_Type.DWG_TYPE_SPLINE) {
|
|
@@ -1302,11 +1345,11 @@ class LibreEntityConverter {
|
|
|
1302
1345
|
}
|
|
1303
1346
|
convert3dFace(entity, commonAttrs) {
|
|
1304
1347
|
const libredwg = this.libredwg;
|
|
1305
|
-
const corner1 = libredwg.
|
|
1306
|
-
const corner2 = libredwg.
|
|
1307
|
-
const corner3 = libredwg.
|
|
1308
|
-
const corner4 = libredwg.
|
|
1309
|
-
const flag = libredwg.
|
|
1348
|
+
const corner1 = libredwg.dwg_dynapi_entity_data(entity, "corner1");
|
|
1349
|
+
const corner2 = libredwg.dwg_dynapi_entity_data(entity, "corner2");
|
|
1350
|
+
const corner3 = libredwg.dwg_dynapi_entity_data(entity, "corner3");
|
|
1351
|
+
const corner4 = libredwg.dwg_dynapi_entity_data(entity, "corner4");
|
|
1352
|
+
const flag = libredwg.dwg_dynapi_entity_data(entity, "invis_flags");
|
|
1310
1353
|
return {
|
|
1311
1354
|
type: "3DFACE",
|
|
1312
1355
|
...commonAttrs,
|
|
@@ -1319,15 +1362,12 @@ class LibreEntityConverter {
|
|
|
1319
1362
|
}
|
|
1320
1363
|
convertArc(entity, commonAttrs) {
|
|
1321
1364
|
const libredwg = this.libredwg;
|
|
1322
|
-
const center = libredwg.
|
|
1323
|
-
const radius = libredwg.
|
|
1324
|
-
const thickness = libredwg.
|
|
1325
|
-
const extrusionDirection = libredwg.
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
).data;
|
|
1329
|
-
const startAngle = libredwg.dwg_dynapi_entity_value(entity, "start_angle").data;
|
|
1330
|
-
const endAngle = libredwg.dwg_dynapi_entity_value(entity, "end_angle").data;
|
|
1365
|
+
const center = libredwg.dwg_dynapi_entity_data(entity, "center");
|
|
1366
|
+
const radius = libredwg.dwg_dynapi_entity_data(entity, "radius");
|
|
1367
|
+
const thickness = libredwg.dwg_dynapi_entity_data(entity, "thickness");
|
|
1368
|
+
const extrusionDirection = libredwg.dwg_dynapi_entity_data(entity, "extrusion");
|
|
1369
|
+
const startAngle = libredwg.dwg_dynapi_entity_data(entity, "start_angle");
|
|
1370
|
+
const endAngle = libredwg.dwg_dynapi_entity_data(entity, "end_angle");
|
|
1331
1371
|
return {
|
|
1332
1372
|
type: "ARC",
|
|
1333
1373
|
...commonAttrs,
|
|
@@ -1341,41 +1381,13 @@ class LibreEntityConverter {
|
|
|
1341
1381
|
}
|
|
1342
1382
|
convertEmbeddedMText(entity, subclassName) {
|
|
1343
1383
|
const libredwg = this.libredwg;
|
|
1344
|
-
const attachmentPoint = libredwg.
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
)
|
|
1349
|
-
const
|
|
1350
|
-
|
|
1351
|
-
subclassName,
|
|
1352
|
-
"ins_pt"
|
|
1353
|
-
).data;
|
|
1354
|
-
const direction = libredwg.dwg_dynapi_subclass_value(
|
|
1355
|
-
entity,
|
|
1356
|
-
subclassName,
|
|
1357
|
-
"x_axis_dir"
|
|
1358
|
-
).data;
|
|
1359
|
-
const rectHeight = libredwg.dwg_dynapi_subclass_value(
|
|
1360
|
-
entity,
|
|
1361
|
-
subclassName,
|
|
1362
|
-
"rect_height"
|
|
1363
|
-
).data;
|
|
1364
|
-
const rectWidth = libredwg.dwg_dynapi_subclass_value(
|
|
1365
|
-
entity,
|
|
1366
|
-
subclassName,
|
|
1367
|
-
"rect_width"
|
|
1368
|
-
).data;
|
|
1369
|
-
const extentsHeight = libredwg.dwg_dynapi_subclass_value(
|
|
1370
|
-
entity,
|
|
1371
|
-
subclassName,
|
|
1372
|
-
"extents_height"
|
|
1373
|
-
).data;
|
|
1374
|
-
const extentsWidth = libredwg.dwg_dynapi_subclass_value(
|
|
1375
|
-
entity,
|
|
1376
|
-
subclassName,
|
|
1377
|
-
"extents_width"
|
|
1378
|
-
).data;
|
|
1384
|
+
const attachmentPoint = libredwg.dwg_dynapi_subclass_data(entity, subclassName, "attachment");
|
|
1385
|
+
const insertionPoint = libredwg.dwg_dynapi_subclass_data(entity, subclassName, "ins_pt");
|
|
1386
|
+
const direction = libredwg.dwg_dynapi_subclass_data(entity, subclassName, "x_axis_dir");
|
|
1387
|
+
const rectHeight = libredwg.dwg_dynapi_subclass_data(entity, subclassName, "rect_height");
|
|
1388
|
+
const rectWidth = libredwg.dwg_dynapi_subclass_data(entity, subclassName, "rect_width");
|
|
1389
|
+
const extentsHeight = libredwg.dwg_dynapi_subclass_data(entity, subclassName, "extents_height");
|
|
1390
|
+
const extentsWidth = libredwg.dwg_dynapi_subclass_data(entity, subclassName, "extents_width");
|
|
1379
1391
|
return {
|
|
1380
1392
|
insertionPoint,
|
|
1381
1393
|
rectHeight,
|
|
@@ -1395,30 +1407,18 @@ class LibreEntityConverter {
|
|
|
1395
1407
|
}
|
|
1396
1408
|
convertAttdef(entity, commonAttrs) {
|
|
1397
1409
|
const libredwg = this.libredwg;
|
|
1398
|
-
const textValue = libredwg.
|
|
1410
|
+
const textValue = libredwg.dwg_dynapi_entity_data(entity, "default_value");
|
|
1399
1411
|
const text = this.convertTextBase(entity);
|
|
1400
1412
|
text.text = textValue;
|
|
1401
|
-
const prompt = libredwg.
|
|
1402
|
-
const tag = libredwg.
|
|
1403
|
-
const flags = libredwg.
|
|
1404
|
-
const fieldLength = libredwg.
|
|
1405
|
-
const lockPositionFlag = libredwg.
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
)
|
|
1409
|
-
const
|
|
1410
|
-
entity,
|
|
1411
|
-
"keep_duplicate_records"
|
|
1412
|
-
).data;
|
|
1413
|
-
const isReallyLocked = libredwg.dwg_dynapi_entity_value(
|
|
1414
|
-
entity,
|
|
1415
|
-
"is_really_locked"
|
|
1416
|
-
).data;
|
|
1417
|
-
const mtextFlag = libredwg.dwg_dynapi_entity_value(entity, "mtext_type").data;
|
|
1418
|
-
const alignmentPoint = libredwg.dwg_dynapi_entity_value(
|
|
1419
|
-
entity,
|
|
1420
|
-
"alignment_pt"
|
|
1421
|
-
).data;
|
|
1413
|
+
const prompt = libredwg.dwg_dynapi_entity_data(entity, "prompt");
|
|
1414
|
+
const tag = libredwg.dwg_dynapi_entity_data(entity, "tag");
|
|
1415
|
+
const flags = libredwg.dwg_dynapi_entity_data(entity, "flags");
|
|
1416
|
+
const fieldLength = libredwg.dwg_dynapi_entity_data(entity, "field_length");
|
|
1417
|
+
const lockPositionFlag = libredwg.dwg_dynapi_entity_data(entity, "lock_position_flag");
|
|
1418
|
+
const duplicateRecordCloningFlag = libredwg.dwg_dynapi_entity_data(entity, "keep_duplicate_records");
|
|
1419
|
+
const isReallyLocked = libredwg.dwg_dynapi_entity_data(entity, "is_really_locked");
|
|
1420
|
+
const mtextFlag = libredwg.dwg_dynapi_entity_data(entity, "mtext_type");
|
|
1421
|
+
const alignmentPoint = libredwg.dwg_dynapi_entity_data(entity, "alignment_pt");
|
|
1422
1422
|
return {
|
|
1423
1423
|
type: "ATTDEF",
|
|
1424
1424
|
...commonAttrs,
|
|
@@ -1442,26 +1442,14 @@ class LibreEntityConverter {
|
|
|
1442
1442
|
convertAttrib(entity, commonAttrs) {
|
|
1443
1443
|
const libredwg = this.libredwg;
|
|
1444
1444
|
const text = this.convertTextBase(entity);
|
|
1445
|
-
const tag = libredwg.
|
|
1446
|
-
const flags = libredwg.
|
|
1447
|
-
const fieldLength = libredwg.
|
|
1448
|
-
const lockPositionFlag = libredwg.
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
)
|
|
1452
|
-
const
|
|
1453
|
-
entity,
|
|
1454
|
-
"keep_duplicate_records"
|
|
1455
|
-
).data;
|
|
1456
|
-
const mtextFlag = libredwg.dwg_dynapi_entity_value(entity, "mtext_type").data;
|
|
1457
|
-
const isReallyLocked = libredwg.dwg_dynapi_entity_value(
|
|
1458
|
-
entity,
|
|
1459
|
-
"is_really_locked"
|
|
1460
|
-
).data;
|
|
1461
|
-
const alignmentPoint = libredwg.dwg_dynapi_entity_value(
|
|
1462
|
-
entity,
|
|
1463
|
-
"alignment_pt"
|
|
1464
|
-
).data;
|
|
1445
|
+
const tag = libredwg.dwg_dynapi_entity_data(entity, "tag");
|
|
1446
|
+
const flags = libredwg.dwg_dynapi_entity_data(entity, "flags");
|
|
1447
|
+
const fieldLength = libredwg.dwg_dynapi_entity_data(entity, "field_length");
|
|
1448
|
+
const lockPositionFlag = libredwg.dwg_dynapi_entity_data(entity, "lock_position_flag");
|
|
1449
|
+
const duplicateRecordCloningFlag = libredwg.dwg_dynapi_entity_data(entity, "keep_duplicate_records");
|
|
1450
|
+
const mtextFlag = libredwg.dwg_dynapi_entity_data(entity, "mtext_type");
|
|
1451
|
+
const isReallyLocked = libredwg.dwg_dynapi_entity_data(entity, "is_really_locked");
|
|
1452
|
+
const alignmentPoint = libredwg.dwg_dynapi_entity_data(entity, "alignment_pt");
|
|
1465
1453
|
return {
|
|
1466
1454
|
type: "ATTRIB",
|
|
1467
1455
|
...commonAttrs,
|
|
@@ -1487,13 +1475,10 @@ class LibreEntityConverter {
|
|
|
1487
1475
|
}
|
|
1488
1476
|
convertCircle(entity, commonAttrs) {
|
|
1489
1477
|
const libredwg = this.libredwg;
|
|
1490
|
-
const center = libredwg.
|
|
1491
|
-
const radius = libredwg.
|
|
1492
|
-
const thickness = libredwg.
|
|
1493
|
-
const extrusionDirection = libredwg.
|
|
1494
|
-
entity,
|
|
1495
|
-
"extrusion"
|
|
1496
|
-
).data;
|
|
1478
|
+
const center = libredwg.dwg_dynapi_entity_data(entity, "center");
|
|
1479
|
+
const radius = libredwg.dwg_dynapi_entity_data(entity, "radius");
|
|
1480
|
+
const thickness = libredwg.dwg_dynapi_entity_data(entity, "thickness");
|
|
1481
|
+
const extrusionDirection = libredwg.dwg_dynapi_entity_data(entity, "extrusion");
|
|
1497
1482
|
return {
|
|
1498
1483
|
type: "CIRCLE",
|
|
1499
1484
|
...commonAttrs,
|
|
@@ -1506,26 +1491,11 @@ class LibreEntityConverter {
|
|
|
1506
1491
|
convertAlignedDimension(entity, commonAttrs) {
|
|
1507
1492
|
const libredwg = this.libredwg;
|
|
1508
1493
|
const dimensionCommonAttrs = this.getDimensionCommonAttrs(entity);
|
|
1509
|
-
const insertionPoint = libredwg.
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
)
|
|
1513
|
-
const
|
|
1514
|
-
entity,
|
|
1515
|
-
"xline1_pt"
|
|
1516
|
-
).data;
|
|
1517
|
-
const subDefinitionPoint2 = libredwg.dwg_dynapi_entity_value(
|
|
1518
|
-
entity,
|
|
1519
|
-
"xline2_pt"
|
|
1520
|
-
).data;
|
|
1521
|
-
const rotationAngle = libredwg.dwg_dynapi_entity_value(
|
|
1522
|
-
entity,
|
|
1523
|
-
"ins_rotation"
|
|
1524
|
-
).data;
|
|
1525
|
-
const obliqueAngle = libredwg.dwg_dynapi_entity_value(
|
|
1526
|
-
entity,
|
|
1527
|
-
"oblique_angle"
|
|
1528
|
-
).data;
|
|
1494
|
+
const insertionPoint = libredwg.dwg_dynapi_entity_data(entity, "clone_ins_pt");
|
|
1495
|
+
const subDefinitionPoint1 = libredwg.dwg_dynapi_entity_data(entity, "xline1_pt");
|
|
1496
|
+
const subDefinitionPoint2 = libredwg.dwg_dynapi_entity_data(entity, "xline2_pt");
|
|
1497
|
+
const rotationAngle = libredwg.dwg_dynapi_entity_data(entity, "ins_rotation");
|
|
1498
|
+
const obliqueAngle = libredwg.dwg_dynapi_entity_data(entity, "oblique_angle");
|
|
1529
1499
|
return {
|
|
1530
1500
|
subclassMarker: "AcDbAlignedDimension",
|
|
1531
1501
|
...commonAttrs,
|
|
@@ -1540,16 +1510,10 @@ class LibreEntityConverter {
|
|
|
1540
1510
|
convert3PointAngularDimension(entity, commonAttrs) {
|
|
1541
1511
|
const libredwg = this.libredwg;
|
|
1542
1512
|
const dimensionCommonAttrs = this.getDimensionCommonAttrs(entity);
|
|
1543
|
-
const subDefinitionPoint1 = libredwg.
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
)
|
|
1547
|
-
const subDefinitionPoint2 = libredwg.dwg_dynapi_entity_value(
|
|
1548
|
-
entity,
|
|
1549
|
-
"xline2_pt"
|
|
1550
|
-
).data;
|
|
1551
|
-
const centerPoint = libredwg.dwg_dynapi_entity_value(entity, "center_pt").data;
|
|
1552
|
-
const arcPoint = libredwg.dwg_dynapi_entity_value(entity, "xline2end_pt").data;
|
|
1513
|
+
const subDefinitionPoint1 = libredwg.dwg_dynapi_entity_data(entity, "xline1_pt");
|
|
1514
|
+
const subDefinitionPoint2 = libredwg.dwg_dynapi_entity_data(entity, "xline2_pt");
|
|
1515
|
+
const centerPoint = libredwg.dwg_dynapi_entity_data(entity, "center_pt");
|
|
1516
|
+
const arcPoint = libredwg.dwg_dynapi_entity_data(entity, "xline2end_pt");
|
|
1553
1517
|
return {
|
|
1554
1518
|
subclassMarker: "AcDb3PointAngularDimension",
|
|
1555
1519
|
...commonAttrs,
|
|
@@ -1563,8 +1527,8 @@ class LibreEntityConverter {
|
|
|
1563
1527
|
convertDiameterDimension(entity, commonAttrs) {
|
|
1564
1528
|
const libredwg = this.libredwg;
|
|
1565
1529
|
const dimensionCommonAttrs = this.getDimensionCommonAttrs(entity);
|
|
1566
|
-
const centerPoint = libredwg.
|
|
1567
|
-
const leaderLength = libredwg.
|
|
1530
|
+
const centerPoint = libredwg.dwg_dynapi_entity_data(entity, "first_arc_pt");
|
|
1531
|
+
const leaderLength = libredwg.dwg_dynapi_entity_data(entity, "leader_len");
|
|
1568
1532
|
return {
|
|
1569
1533
|
subclassMarker: "AcDbDiametricDimension",
|
|
1570
1534
|
...commonAttrs,
|
|
@@ -1576,14 +1540,8 @@ class LibreEntityConverter {
|
|
|
1576
1540
|
convertOrdinateDimension(entity, commonAttrs) {
|
|
1577
1541
|
const libredwg = this.libredwg;
|
|
1578
1542
|
const dimensionCommonAttrs = this.getDimensionCommonAttrs(entity);
|
|
1579
|
-
const subDefinitionPoint1 = libredwg.
|
|
1580
|
-
|
|
1581
|
-
"feature_location_pt"
|
|
1582
|
-
).data;
|
|
1583
|
-
const subDefinitionPoint2 = libredwg.dwg_dynapi_entity_value(
|
|
1584
|
-
entity,
|
|
1585
|
-
"leader_endpt"
|
|
1586
|
-
).data;
|
|
1543
|
+
const subDefinitionPoint1 = libredwg.dwg_dynapi_entity_data(entity, "feature_location_pt");
|
|
1544
|
+
const subDefinitionPoint2 = libredwg.dwg_dynapi_entity_data(entity, "leader_endpt");
|
|
1587
1545
|
return {
|
|
1588
1546
|
subclassMarker: "AcDbOrdinateDimension",
|
|
1589
1547
|
...commonAttrs,
|
|
@@ -1595,8 +1553,8 @@ class LibreEntityConverter {
|
|
|
1595
1553
|
convertRadiusDimension(entity, commonAttrs) {
|
|
1596
1554
|
const libredwg = this.libredwg;
|
|
1597
1555
|
const dimensionCommonAttrs = this.getDimensionCommonAttrs(entity);
|
|
1598
|
-
const centerPoint = libredwg.
|
|
1599
|
-
const leaderLength = libredwg.
|
|
1556
|
+
const centerPoint = libredwg.dwg_dynapi_entity_data(entity, "first_arc_pt");
|
|
1557
|
+
const leaderLength = libredwg.dwg_dynapi_entity_data(entity, "leader_len");
|
|
1600
1558
|
return {
|
|
1601
1559
|
subclassMarker: "AcDbRadialDimension",
|
|
1602
1560
|
...commonAttrs,
|
|
@@ -1607,18 +1565,12 @@ class LibreEntityConverter {
|
|
|
1607
1565
|
}
|
|
1608
1566
|
convertEllise(entity, commonAttrs) {
|
|
1609
1567
|
const libredwg = this.libredwg;
|
|
1610
|
-
const center = libredwg.
|
|
1611
|
-
const majorAxisEndPoint = libredwg.
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
)
|
|
1615
|
-
const
|
|
1616
|
-
entity,
|
|
1617
|
-
"extrusion"
|
|
1618
|
-
).data;
|
|
1619
|
-
const axisRatio = libredwg.dwg_dynapi_entity_value(entity, "axis_ratio").data;
|
|
1620
|
-
const startAngle = libredwg.dwg_dynapi_entity_value(entity, "start_angle").data;
|
|
1621
|
-
const endAngle = libredwg.dwg_dynapi_entity_value(entity, "end_angle").data;
|
|
1568
|
+
const center = libredwg.dwg_dynapi_entity_data(entity, "center");
|
|
1569
|
+
const majorAxisEndPoint = libredwg.dwg_dynapi_entity_data(entity, "sm_axis");
|
|
1570
|
+
const extrusionDirection = libredwg.dwg_dynapi_entity_data(entity, "extrusion");
|
|
1571
|
+
const axisRatio = libredwg.dwg_dynapi_entity_data(entity, "axis_ratio");
|
|
1572
|
+
const startAngle = libredwg.dwg_dynapi_entity_data(entity, "start_angle");
|
|
1573
|
+
const endAngle = libredwg.dwg_dynapi_entity_data(entity, "end_angle");
|
|
1622
1574
|
return {
|
|
1623
1575
|
type: "ELLIPSE",
|
|
1624
1576
|
...commonAttrs,
|
|
@@ -1632,53 +1584,29 @@ class LibreEntityConverter {
|
|
|
1632
1584
|
}
|
|
1633
1585
|
convertHatch(entity, commonAttrs) {
|
|
1634
1586
|
const libredwg = this.libredwg;
|
|
1635
|
-
const extrusionDirection = libredwg.
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
)
|
|
1639
|
-
const
|
|
1640
|
-
const
|
|
1641
|
-
entity,
|
|
1642
|
-
"is_solid_fill"
|
|
1643
|
-
).data;
|
|
1644
|
-
const isAssociative = libredwg.dwg_dynapi_entity_value(
|
|
1645
|
-
entity,
|
|
1646
|
-
"is_associative"
|
|
1647
|
-
).data;
|
|
1648
|
-
const numberOfBoundaryPaths = libredwg.dwg_dynapi_entity_value(
|
|
1649
|
-
entity,
|
|
1650
|
-
"num_paths"
|
|
1651
|
-
).data;
|
|
1652
|
-
const paths_ptr = libredwg.dwg_dynapi_entity_value(entity, "paths").data;
|
|
1587
|
+
const extrusionDirection = libredwg.dwg_dynapi_entity_data(entity, "extrusion");
|
|
1588
|
+
const patternName = libredwg.dwg_dynapi_entity_data(entity, "name");
|
|
1589
|
+
const isSolidFill = libredwg.dwg_dynapi_entity_data(entity, "is_solid_fill");
|
|
1590
|
+
const isAssociative = libredwg.dwg_dynapi_entity_data(entity, "is_associative");
|
|
1591
|
+
const numberOfBoundaryPaths = libredwg.dwg_dynapi_entity_data(entity, "num_paths");
|
|
1592
|
+
const paths_ptr = libredwg.dwg_dynapi_entity_data(entity, "paths");
|
|
1653
1593
|
const boundaryPaths = libredwg.dwg_ptr_to_hatch_path_array(
|
|
1654
1594
|
paths_ptr,
|
|
1655
1595
|
numberOfBoundaryPaths
|
|
1656
1596
|
);
|
|
1657
|
-
const patternStyle = libredwg.
|
|
1658
|
-
const patternType = libredwg.
|
|
1659
|
-
const patternAngle = libredwg.
|
|
1660
|
-
const patternScale = libredwg.
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
).data;
|
|
1664
|
-
const numberOfDefinitionLines = libredwg.dwg_dynapi_entity_value(
|
|
1665
|
-
entity,
|
|
1666
|
-
"num_deflines"
|
|
1667
|
-
).data;
|
|
1668
|
-
const definitionLines_ptr = libredwg.dwg_dynapi_entity_value(
|
|
1669
|
-
entity,
|
|
1670
|
-
"deflines"
|
|
1671
|
-
).data;
|
|
1597
|
+
const patternStyle = libredwg.dwg_dynapi_entity_data(entity, "style");
|
|
1598
|
+
const patternType = libredwg.dwg_dynapi_entity_data(entity, "pattern_type");
|
|
1599
|
+
const patternAngle = libredwg.dwg_dynapi_entity_data(entity, "angle");
|
|
1600
|
+
const patternScale = libredwg.dwg_dynapi_entity_data(entity, "scale_spacing");
|
|
1601
|
+
const numberOfDefinitionLines = libredwg.dwg_dynapi_entity_data(entity, "num_deflines");
|
|
1602
|
+
const definitionLines_ptr = libredwg.dwg_dynapi_entity_data(entity, "deflines");
|
|
1672
1603
|
const definitionLines = libredwg.dwg_ptr_to_hatch_defline_array(
|
|
1673
1604
|
definitionLines_ptr,
|
|
1674
1605
|
numberOfDefinitionLines
|
|
1675
1606
|
);
|
|
1676
|
-
const pixelSize = libredwg.
|
|
1677
|
-
const numberOfSeedPoints = libredwg.
|
|
1678
|
-
|
|
1679
|
-
"num_seeds"
|
|
1680
|
-
).data;
|
|
1681
|
-
const seedPoints_ptr = libredwg.dwg_dynapi_entity_value(entity, "seeds").data;
|
|
1607
|
+
const pixelSize = libredwg.dwg_dynapi_entity_data(entity, "pixel_size");
|
|
1608
|
+
const numberOfSeedPoints = libredwg.dwg_dynapi_entity_data(entity, "num_seeds");
|
|
1609
|
+
const seedPoints_ptr = libredwg.dwg_dynapi_entity_data(entity, "seeds");
|
|
1682
1610
|
const seedPoints = libredwg.dwg_ptr_to_point2d_array(
|
|
1683
1611
|
seedPoints_ptr,
|
|
1684
1612
|
numberOfSeedPoints
|
|
@@ -1713,14 +1641,14 @@ class LibreEntityConverter {
|
|
|
1713
1641
|
seedPoints
|
|
1714
1642
|
// gradientFlag?: DwgHatchGradientFlag
|
|
1715
1643
|
};
|
|
1716
|
-
const gradientFlag = libredwg.
|
|
1644
|
+
const gradientFlag = libredwg.dwg_dynapi_entity_data(entity, "is_gradient_fill");
|
|
1717
1645
|
if (gradientFlag > 0) {
|
|
1718
|
-
const gradientName = libredwg.
|
|
1719
|
-
const gradientRotation = libredwg.
|
|
1720
|
-
const gradientDefinition = libredwg.
|
|
1721
|
-
const colorTint = libredwg.
|
|
1722
|
-
const gradientColorFlag = libredwg.
|
|
1723
|
-
const gradientColors_ptr = libredwg.
|
|
1646
|
+
const gradientName = libredwg.dwg_dynapi_entity_data(entity, "gradient_name");
|
|
1647
|
+
const gradientRotation = libredwg.dwg_dynapi_entity_data(entity, "gradient_angle");
|
|
1648
|
+
const gradientDefinition = libredwg.dwg_dynapi_entity_data(entity, "gradient_shift");
|
|
1649
|
+
const colorTint = libredwg.dwg_dynapi_entity_data(entity, "gradient_tint");
|
|
1650
|
+
const gradientColorFlag = libredwg.dwg_dynapi_entity_data(entity, "single_color_gradient");
|
|
1651
|
+
const gradientColors_ptr = libredwg.dwg_dynapi_entity_data(entity, "colors");
|
|
1724
1652
|
const gradientColors = libredwg.dwg_ptr_to_hatch_gradient_color_array(gradientColors_ptr, gradientColorFlag == 1 ? 1 : 2);
|
|
1725
1653
|
return {
|
|
1726
1654
|
type: "HATCH",
|
|
@@ -1814,39 +1742,28 @@ class LibreEntityConverter {
|
|
|
1814
1742
|
}
|
|
1815
1743
|
convertImage(entity, commonAttrs) {
|
|
1816
1744
|
const libredwg = this.libredwg;
|
|
1817
|
-
const version = libredwg.
|
|
1818
|
-
const position = libredwg.
|
|
1819
|
-
const uPixel = libredwg.
|
|
1820
|
-
const vPixel = libredwg.
|
|
1821
|
-
const imageSize = libredwg.
|
|
1822
|
-
const flags = libredwg.
|
|
1823
|
-
const clipping = libredwg.
|
|
1824
|
-
const brightness = libredwg.
|
|
1825
|
-
const contrast = libredwg.
|
|
1826
|
-
const fade = libredwg.
|
|
1827
|
-
const clipMode = libredwg.
|
|
1828
|
-
const clippingBoundaryType = libredwg.
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
).data;
|
|
1832
|
-
const countBoundaryPoints = libredwg.dwg_dynapi_entity_value(
|
|
1833
|
-
entity,
|
|
1834
|
-
"num_clip_verts"
|
|
1835
|
-
).data;
|
|
1836
|
-
const clip_verts = libredwg.dwg_dynapi_entity_value(entity, "clip_verts").data;
|
|
1745
|
+
const version = libredwg.dwg_dynapi_entity_data(entity, "class_version");
|
|
1746
|
+
const position = libredwg.dwg_dynapi_entity_data(entity, "pt0");
|
|
1747
|
+
const uPixel = libredwg.dwg_dynapi_entity_data(entity, "uvec");
|
|
1748
|
+
const vPixel = libredwg.dwg_dynapi_entity_data(entity, "vvec");
|
|
1749
|
+
const imageSize = libredwg.dwg_dynapi_entity_data(entity, "image_size");
|
|
1750
|
+
const flags = libredwg.dwg_dynapi_entity_data(entity, "display_props");
|
|
1751
|
+
const clipping = libredwg.dwg_dynapi_entity_data(entity, "clipping");
|
|
1752
|
+
const brightness = libredwg.dwg_dynapi_entity_data(entity, "brightness");
|
|
1753
|
+
const contrast = libredwg.dwg_dynapi_entity_data(entity, "contrast");
|
|
1754
|
+
const fade = libredwg.dwg_dynapi_entity_data(entity, "fade");
|
|
1755
|
+
const clipMode = libredwg.dwg_dynapi_entity_data(entity, "clip_mode");
|
|
1756
|
+
const clippingBoundaryType = libredwg.dwg_dynapi_entity_data(entity, "clip_boundary_type");
|
|
1757
|
+
const countBoundaryPoints = libredwg.dwg_dynapi_entity_data(entity, "num_clip_verts");
|
|
1758
|
+
const clip_verts = libredwg.dwg_dynapi_entity_data(entity, "clip_verts");
|
|
1837
1759
|
const clippingBoundaryPath = libredwg.dwg_ptr_to_point3d_array(
|
|
1838
1760
|
clip_verts,
|
|
1839
1761
|
countBoundaryPoints
|
|
1840
1762
|
);
|
|
1841
|
-
const imagedef_ref = libredwg.
|
|
1842
|
-
const imageDefHandle =
|
|
1843
|
-
const imagedefreactor_ref = libredwg.
|
|
1844
|
-
|
|
1845
|
-
"imagedefreactor"
|
|
1846
|
-
).data;
|
|
1847
|
-
const imageDefReactorHandle = idToString(
|
|
1848
|
-
libredwg.dwg_ref_get_absref(imagedefreactor_ref)
|
|
1849
|
-
);
|
|
1763
|
+
const imagedef_ref = libredwg.dwg_dynapi_entity_data(entity, "imagedef");
|
|
1764
|
+
const imageDefHandle = libredwg.dwg_ref_get_id(imagedef_ref) ?? "";
|
|
1765
|
+
const imagedefreactor_ref = libredwg.dwg_dynapi_entity_data(entity, "imagedefreactor");
|
|
1766
|
+
const imageDefReactorHandle = libredwg.dwg_ref_get_id(imagedefreactor_ref) ?? "";
|
|
1850
1767
|
return {
|
|
1851
1768
|
type: "IMAGE",
|
|
1852
1769
|
...commonAttrs,
|
|
@@ -1871,10 +1788,7 @@ class LibreEntityConverter {
|
|
|
1871
1788
|
convertInsert(entity, commonAttrs) {
|
|
1872
1789
|
const libredwg = this.libredwg;
|
|
1873
1790
|
let name = "";
|
|
1874
|
-
const block_header_ref = libredwg.
|
|
1875
|
-
entity,
|
|
1876
|
-
"block_header"
|
|
1877
|
-
).data;
|
|
1791
|
+
const block_header_ref = libredwg.dwg_dynapi_entity_data(entity, "block_header");
|
|
1878
1792
|
if (block_header_ref) {
|
|
1879
1793
|
const block_header_obj = libredwg.dwg_ref_get_object(block_header_ref);
|
|
1880
1794
|
if (block_header_obj) {
|
|
@@ -1885,22 +1799,16 @@ class LibreEntityConverter {
|
|
|
1885
1799
|
}
|
|
1886
1800
|
}
|
|
1887
1801
|
if (!name) {
|
|
1888
|
-
name = libredwg.
|
|
1802
|
+
name = libredwg.dwg_dynapi_entity_data(entity, "block_name");
|
|
1889
1803
|
}
|
|
1890
|
-
const insertionPoint = libredwg.
|
|
1891
|
-
const scale = libredwg.
|
|
1892
|
-
const rotation = libredwg.
|
|
1893
|
-
const columnCount = libredwg.
|
|
1894
|
-
const rowCount = libredwg.
|
|
1895
|
-
const columnSpacing = libredwg.
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
).data;
|
|
1899
|
-
const rowSpacing = libredwg.dwg_dynapi_entity_value(entity, "row_spacing").data;
|
|
1900
|
-
const extrusionDirection = libredwg.dwg_dynapi_entity_value(
|
|
1901
|
-
entity,
|
|
1902
|
-
"extrusion"
|
|
1903
|
-
).data;
|
|
1804
|
+
const insertionPoint = libredwg.dwg_dynapi_entity_data(entity, "ins_pt");
|
|
1805
|
+
const scale = libredwg.dwg_dynapi_entity_data(entity, "scale");
|
|
1806
|
+
const rotation = libredwg.dwg_dynapi_entity_data(entity, "rotation");
|
|
1807
|
+
const columnCount = libredwg.dwg_dynapi_entity_data(entity, "num_cols");
|
|
1808
|
+
const rowCount = libredwg.dwg_dynapi_entity_data(entity, "num_rows");
|
|
1809
|
+
const columnSpacing = libredwg.dwg_dynapi_entity_data(entity, "col_spacing");
|
|
1810
|
+
const rowSpacing = libredwg.dwg_dynapi_entity_data(entity, "row_spacing");
|
|
1811
|
+
const extrusionDirection = libredwg.dwg_dynapi_entity_data(entity, "extrusion");
|
|
1904
1812
|
const attrib_ptr_array = libredwg.dwg_entity_insert_get_attribs(entity);
|
|
1905
1813
|
const attribs = [];
|
|
1906
1814
|
attrib_ptr_array.forEach((object_ptr) => {
|
|
@@ -1934,48 +1842,21 @@ class LibreEntityConverter {
|
|
|
1934
1842
|
convertLeader(entity, commonAttrs) {
|
|
1935
1843
|
const libredwg = this.libredwg;
|
|
1936
1844
|
const styleName = libredwg.dwg_entity_mtext_get_style_name(entity);
|
|
1937
|
-
const isArrowheadEnabled = libredwg.
|
|
1938
|
-
|
|
1939
|
-
|
|
1940
|
-
)
|
|
1941
|
-
const
|
|
1942
|
-
const
|
|
1943
|
-
|
|
1944
|
-
|
|
1945
|
-
)
|
|
1946
|
-
const isHooklineSameDirection = libredwg.dwg_dynapi_entity_value(
|
|
1947
|
-
entity,
|
|
1948
|
-
"hookline_dir"
|
|
1949
|
-
).data;
|
|
1950
|
-
const isHooklineExists = libredwg.dwg_dynapi_entity_value(
|
|
1951
|
-
entity,
|
|
1952
|
-
"hookline_on"
|
|
1953
|
-
).data;
|
|
1954
|
-
const textHeight = libredwg.dwg_dynapi_entity_value(entity, "box_height").data;
|
|
1955
|
-
const textWidth = libredwg.dwg_dynapi_entity_value(entity, "box_width").data;
|
|
1956
|
-
const numberOfVertices = libredwg.dwg_dynapi_entity_value(
|
|
1957
|
-
entity,
|
|
1958
|
-
"num_points"
|
|
1959
|
-
).data;
|
|
1960
|
-
const vertices_ptr = libredwg.dwg_dynapi_entity_value(entity, "points").data;
|
|
1845
|
+
const isArrowheadEnabled = libredwg.dwg_dynapi_entity_data(entity, "arrowhead_type");
|
|
1846
|
+
const isSpline = libredwg.dwg_dynapi_entity_data(entity, "path_type");
|
|
1847
|
+
const leaderCreationFlag = libredwg.dwg_dynapi_entity_data(entity, "annot_type");
|
|
1848
|
+
const isHooklineSameDirection = libredwg.dwg_dynapi_entity_data(entity, "hookline_dir");
|
|
1849
|
+
const isHooklineExists = libredwg.dwg_dynapi_entity_data(entity, "hookline_on");
|
|
1850
|
+
const textHeight = libredwg.dwg_dynapi_entity_data(entity, "box_height");
|
|
1851
|
+
const textWidth = libredwg.dwg_dynapi_entity_data(entity, "box_width");
|
|
1852
|
+
const numberOfVertices = libredwg.dwg_dynapi_entity_data(entity, "num_points");
|
|
1853
|
+
const vertices_ptr = libredwg.dwg_dynapi_entity_data(entity, "points");
|
|
1961
1854
|
const vertices = numberOfVertices > 0 ? libredwg.dwg_ptr_to_point3d_array(vertices_ptr, numberOfVertices) : [];
|
|
1962
|
-
const byBlockColor = libredwg.
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
)
|
|
1966
|
-
const
|
|
1967
|
-
const horizontalDirection = libredwg.dwg_dynapi_entity_value(
|
|
1968
|
-
entity,
|
|
1969
|
-
"x_direction"
|
|
1970
|
-
).data;
|
|
1971
|
-
const offsetFromBlock = libredwg.dwg_dynapi_entity_value(
|
|
1972
|
-
entity,
|
|
1973
|
-
"inspt_offset"
|
|
1974
|
-
).data;
|
|
1975
|
-
const offsetFromAnnotation = libredwg.dwg_dynapi_entity_value(
|
|
1976
|
-
entity,
|
|
1977
|
-
"endptproj"
|
|
1978
|
-
).data;
|
|
1855
|
+
const byBlockColor = libredwg.dwg_dynapi_entity_data(entity, "byblock_color");
|
|
1856
|
+
const normal = libredwg.dwg_dynapi_entity_data(entity, "extrusion");
|
|
1857
|
+
const horizontalDirection = libredwg.dwg_dynapi_entity_data(entity, "x_direction");
|
|
1858
|
+
const offsetFromBlock = libredwg.dwg_dynapi_entity_data(entity, "inspt_offset");
|
|
1859
|
+
const offsetFromAnnotation = libredwg.dwg_dynapi_entity_data(entity, "endptproj");
|
|
1979
1860
|
return {
|
|
1980
1861
|
type: "LEADER",
|
|
1981
1862
|
...commonAttrs,
|
|
@@ -1998,13 +1879,10 @@ class LibreEntityConverter {
|
|
|
1998
1879
|
}
|
|
1999
1880
|
convertLine(entity, commonAttrs) {
|
|
2000
1881
|
const libredwg = this.libredwg;
|
|
2001
|
-
const startPoint = libredwg.
|
|
2002
|
-
const endPoint = libredwg.
|
|
2003
|
-
const thickness = libredwg.
|
|
2004
|
-
const extrusionDirection = libredwg.
|
|
2005
|
-
entity,
|
|
2006
|
-
"extrusion"
|
|
2007
|
-
).data;
|
|
1882
|
+
const startPoint = libredwg.dwg_dynapi_entity_data(entity, "start");
|
|
1883
|
+
const endPoint = libredwg.dwg_dynapi_entity_data(entity, "end");
|
|
1884
|
+
const thickness = libredwg.dwg_dynapi_entity_data(entity, "thickness");
|
|
1885
|
+
const extrusionDirection = libredwg.dwg_dynapi_entity_data(entity, "extrusion");
|
|
2008
1886
|
return {
|
|
2009
1887
|
type: "LINE",
|
|
2010
1888
|
...commonAttrs,
|
|
@@ -2016,27 +1894,18 @@ class LibreEntityConverter {
|
|
|
2016
1894
|
}
|
|
2017
1895
|
convertLWPolyline(entity, commonAttrs) {
|
|
2018
1896
|
const libredwg = this.libredwg;
|
|
2019
|
-
const numberOfVertices = libredwg.
|
|
2020
|
-
|
|
2021
|
-
|
|
2022
|
-
)
|
|
2023
|
-
const
|
|
2024
|
-
const
|
|
2025
|
-
entity,
|
|
2026
|
-
"const_width"
|
|
2027
|
-
).data;
|
|
2028
|
-
const elevation = libredwg.dwg_dynapi_entity_value(entity, "elevation").data;
|
|
2029
|
-
const thickness = libredwg.dwg_dynapi_entity_value(entity, "thickness").data;
|
|
2030
|
-
const extrusionDirection = libredwg.dwg_dynapi_entity_value(
|
|
2031
|
-
entity,
|
|
2032
|
-
"extrusion"
|
|
2033
|
-
).data;
|
|
1897
|
+
const numberOfVertices = libredwg.dwg_dynapi_entity_data(entity, "num_points");
|
|
1898
|
+
const flag = libredwg.dwg_dynapi_entity_data(entity, "flag");
|
|
1899
|
+
const constantWidth = libredwg.dwg_dynapi_entity_data(entity, "const_width");
|
|
1900
|
+
const elevation = libredwg.dwg_dynapi_entity_data(entity, "elevation");
|
|
1901
|
+
const thickness = libredwg.dwg_dynapi_entity_data(entity, "thickness");
|
|
1902
|
+
const extrusionDirection = libredwg.dwg_dynapi_entity_data(entity, "extrusion");
|
|
2034
1903
|
const vertices = [];
|
|
2035
|
-
const num_points = libredwg.
|
|
2036
|
-
const points_ptr = libredwg.
|
|
1904
|
+
const num_points = libredwg.dwg_dynapi_entity_data(entity, "num_points");
|
|
1905
|
+
const points_ptr = libredwg.dwg_dynapi_entity_data(entity, "points");
|
|
2037
1906
|
const points = libredwg.dwg_ptr_to_point2d_array(points_ptr, num_points);
|
|
2038
|
-
const num_bulges = libredwg.
|
|
2039
|
-
const bulges_ptr = libredwg.
|
|
1907
|
+
const num_bulges = libredwg.dwg_dynapi_entity_data(entity, "num_bulges");
|
|
1908
|
+
const bulges_ptr = libredwg.dwg_dynapi_entity_data(entity, "bulges");
|
|
2040
1909
|
const bulges = libredwg.dwg_ptr_to_double_array(bulges_ptr, num_bulges);
|
|
2041
1910
|
points.forEach((point, index) => {
|
|
2042
1911
|
vertices.push({
|
|
@@ -2060,23 +1929,14 @@ class LibreEntityConverter {
|
|
|
2060
1929
|
}
|
|
2061
1930
|
convertMLine(entity, commonAttrs) {
|
|
2062
1931
|
const libredwg = this.libredwg;
|
|
2063
|
-
const scale = libredwg.
|
|
2064
|
-
const flags = libredwg.
|
|
2065
|
-
const justification = libredwg.
|
|
2066
|
-
|
|
2067
|
-
|
|
2068
|
-
)
|
|
2069
|
-
const
|
|
2070
|
-
const
|
|
2071
|
-
entity,
|
|
2072
|
-
"extrusion"
|
|
2073
|
-
).data;
|
|
2074
|
-
const numberOfLines = libredwg.dwg_dynapi_entity_value(entity, "num_lines").data;
|
|
2075
|
-
const numberOfVertices = libredwg.dwg_dynapi_entity_value(
|
|
2076
|
-
entity,
|
|
2077
|
-
"num_verts"
|
|
2078
|
-
).data;
|
|
2079
|
-
const verts_ptr = libredwg.dwg_dynapi_entity_value(entity, "verts").data;
|
|
1932
|
+
const scale = libredwg.dwg_dynapi_entity_data(entity, "scale");
|
|
1933
|
+
const flags = libredwg.dwg_dynapi_entity_data(entity, "flags");
|
|
1934
|
+
const justification = libredwg.dwg_dynapi_entity_data(entity, "justification");
|
|
1935
|
+
const startPoint = libredwg.dwg_dynapi_entity_data(entity, "base_point");
|
|
1936
|
+
const extrusionDirection = libredwg.dwg_dynapi_entity_data(entity, "extrusion");
|
|
1937
|
+
const numberOfLines = libredwg.dwg_dynapi_entity_data(entity, "num_lines");
|
|
1938
|
+
const numberOfVertices = libredwg.dwg_dynapi_entity_data(entity, "num_verts");
|
|
1939
|
+
const verts_ptr = libredwg.dwg_dynapi_entity_data(entity, "verts");
|
|
2080
1940
|
const verts = libredwg.dwg_ptr_to_mline_vertex_array(
|
|
2081
1941
|
verts_ptr,
|
|
2082
1942
|
numberOfVertices
|
|
@@ -2113,17 +1973,525 @@ class LibreEntityConverter {
|
|
|
2113
1973
|
// TODO: Set the correct value
|
|
2114
1974
|
};
|
|
2115
1975
|
}
|
|
1976
|
+
convertMultiLeader(entity, commonAttrs) {
|
|
1977
|
+
const libredwg = this.libredwg;
|
|
1978
|
+
const entityVal = (field) => libredwg.dwg_dynapi_entity_data(entity, field);
|
|
1979
|
+
const subclassVal = (ptr, subclass, field) => libredwg.dwg_dynapi_subclass_data(ptr, subclass, field);
|
|
1980
|
+
const refToId = (ref) => libredwg.dwg_ref_get_id(ref);
|
|
1981
|
+
const asBool = (value) => value > 0;
|
|
1982
|
+
const mleaderColor = (color) => color != null ? dwgColorToMLeaderRawColor(color) : void 0;
|
|
1983
|
+
const version = entityVal("class_version");
|
|
1984
|
+
const leaderStyleId = refToId(entityVal("mleaderstyle"));
|
|
1985
|
+
const propertyOverrideFlag = entityVal("flags");
|
|
1986
|
+
const leaderLineType = entityVal("type");
|
|
1987
|
+
const leaderLineColor = mleaderColor(entityVal("line_color"));
|
|
1988
|
+
const leaderLineTypeId = refToId(entityVal("line_ltype"));
|
|
1989
|
+
const leaderLineWeight = entityVal("line_linewt");
|
|
1990
|
+
const landingEnabled = asBool(entityVal("has_landing"));
|
|
1991
|
+
const doglegEnabled = asBool(entityVal("has_dogleg"));
|
|
1992
|
+
const doglegLength = entityVal("landing_dist");
|
|
1993
|
+
const arrowheadId = refToId(entityVal("arrow_handle"));
|
|
1994
|
+
const arrowheadSize = entityVal("arrow_size");
|
|
1995
|
+
const contentType = entityVal("style_content");
|
|
1996
|
+
const textStyleId = refToId(entityVal("text_style"));
|
|
1997
|
+
const textLeftAttachmentType = entityVal("text_left");
|
|
1998
|
+
const textRightAttachmentType = entityVal("text_right");
|
|
1999
|
+
const textAngleType = entityVal("text_angletype");
|
|
2000
|
+
const textAlignmentType = entityVal("text_alignment");
|
|
2001
|
+
const textColor = mleaderColor(entityVal("text_color"));
|
|
2002
|
+
const textFrameEnabled = asBool(entityVal("has_text_frame"));
|
|
2003
|
+
const blockContentId = refToId(entityVal("block_style"));
|
|
2004
|
+
const blockContentColor = mleaderColor(entityVal("block_color"));
|
|
2005
|
+
const blockContentScale = entityVal("block_scale");
|
|
2006
|
+
const blockContentRotation = entityVal("block_rotation");
|
|
2007
|
+
const blockContentConnectionType = entityVal("style_attachment");
|
|
2008
|
+
const annotativeScaleEnabled = asBool(entityVal("is_annotative"));
|
|
2009
|
+
const textDirectionNegative = asBool(entityVal("is_neg_textdir"));
|
|
2010
|
+
const textAlignInIPE = entityVal("ipe_alignment");
|
|
2011
|
+
let textAttachmentPoint = entityVal("justification");
|
|
2012
|
+
const textAttachmentDirection = entityVal("attach_dir");
|
|
2013
|
+
const bottomTextAttachmentDirection = entityVal("attach_bottom");
|
|
2014
|
+
const topTextAttachmentDirection = entityVal("attach_top");
|
|
2015
|
+
const contentScale = entityVal("scale_factor");
|
|
2016
|
+
const numArrowheads = entityVal("num_arrowheads");
|
|
2017
|
+
const arrowheadsPtr = entityVal("arrowheads");
|
|
2018
|
+
const arrowHeadSize = libredwg.dwg_dynapi_subclass_size("LEADER_ArrowHead");
|
|
2019
|
+
const arrowheadOverrides = [];
|
|
2020
|
+
for (let i = 0; i < numArrowheads; i++) {
|
|
2021
|
+
const arrowheadPtr = arrowheadsPtr + i * arrowHeadSize;
|
|
2022
|
+
arrowheadOverrides.push({
|
|
2023
|
+
index: subclassVal(arrowheadPtr, "LEADER_ArrowHead", "is_default"),
|
|
2024
|
+
handle: refToId(
|
|
2025
|
+
subclassVal(arrowheadPtr, "LEADER_ArrowHead", "arrowhead")
|
|
2026
|
+
) ?? ""
|
|
2027
|
+
});
|
|
2028
|
+
}
|
|
2029
|
+
const numBlocklabels = entityVal("num_blocklabels");
|
|
2030
|
+
const blocklabelsPtr = entityVal("blocklabels");
|
|
2031
|
+
const blockLabelSize = libredwg.dwg_dynapi_subclass_size("LEADER_BlockLabel");
|
|
2032
|
+
const blockAttributes = [];
|
|
2033
|
+
for (let i = 0; i < numBlocklabels; i++) {
|
|
2034
|
+
const blocklabelPtr = blocklabelsPtr + i * blockLabelSize;
|
|
2035
|
+
blockAttributes.push({
|
|
2036
|
+
id: refToId(
|
|
2037
|
+
subclassVal(blocklabelPtr, "LEADER_BlockLabel", "attdef")
|
|
2038
|
+
),
|
|
2039
|
+
index: subclassVal(
|
|
2040
|
+
blocklabelPtr,
|
|
2041
|
+
"LEADER_BlockLabel",
|
|
2042
|
+
"ui_index"
|
|
2043
|
+
),
|
|
2044
|
+
width: subclassVal(blocklabelPtr, "LEADER_BlockLabel", "width"),
|
|
2045
|
+
text: subclassVal(
|
|
2046
|
+
blocklabelPtr,
|
|
2047
|
+
"LEADER_BlockLabel",
|
|
2048
|
+
"label_text"
|
|
2049
|
+
)
|
|
2050
|
+
});
|
|
2051
|
+
}
|
|
2052
|
+
const ctxPtr = entity + libredwg.dwg_dynapi_entity_field_offset(entity, "ctx");
|
|
2053
|
+
const contentPtr = ctxPtr + libredwg.dwg_dynapi_subclass_field_offset(
|
|
2054
|
+
"MLEADER_AnnotContext",
|
|
2055
|
+
"content"
|
|
2056
|
+
);
|
|
2057
|
+
const contentScaleFactor = subclassVal(
|
|
2058
|
+
ctxPtr,
|
|
2059
|
+
"MLEADER_AnnotContext",
|
|
2060
|
+
"scale_factor"
|
|
2061
|
+
);
|
|
2062
|
+
const contentBasePosition = subclassVal(
|
|
2063
|
+
ctxPtr,
|
|
2064
|
+
"MLEADER_AnnotContext",
|
|
2065
|
+
"content_base"
|
|
2066
|
+
);
|
|
2067
|
+
const landingGap = subclassVal(
|
|
2068
|
+
ctxPtr,
|
|
2069
|
+
"MLEADER_AnnotContext",
|
|
2070
|
+
"landing_gap"
|
|
2071
|
+
);
|
|
2072
|
+
const textAttachment = subclassVal(
|
|
2073
|
+
ctxPtr,
|
|
2074
|
+
"MLEADER_AnnotContext",
|
|
2075
|
+
"attach_dir"
|
|
2076
|
+
);
|
|
2077
|
+
const contextTextHeight = subclassVal(
|
|
2078
|
+
ctxPtr,
|
|
2079
|
+
"MLEADER_AnnotContext",
|
|
2080
|
+
"text_height"
|
|
2081
|
+
);
|
|
2082
|
+
const contextArrowSize = subclassVal(
|
|
2083
|
+
ctxPtr,
|
|
2084
|
+
"MLEADER_AnnotContext",
|
|
2085
|
+
"arrow_size"
|
|
2086
|
+
);
|
|
2087
|
+
const contextTextLeft = subclassVal(
|
|
2088
|
+
ctxPtr,
|
|
2089
|
+
"MLEADER_AnnotContext",
|
|
2090
|
+
"text_left"
|
|
2091
|
+
);
|
|
2092
|
+
const contextTextRight = subclassVal(
|
|
2093
|
+
ctxPtr,
|
|
2094
|
+
"MLEADER_AnnotContext",
|
|
2095
|
+
"text_right"
|
|
2096
|
+
);
|
|
2097
|
+
const contextTextAngleType = subclassVal(
|
|
2098
|
+
ctxPtr,
|
|
2099
|
+
"MLEADER_AnnotContext",
|
|
2100
|
+
"text_angletype"
|
|
2101
|
+
);
|
|
2102
|
+
const contextTextAlignment = subclassVal(
|
|
2103
|
+
ctxPtr,
|
|
2104
|
+
"MLEADER_AnnotContext",
|
|
2105
|
+
"text_alignment"
|
|
2106
|
+
);
|
|
2107
|
+
const hasMText = asBool(
|
|
2108
|
+
subclassVal(ctxPtr, "MLEADER_AnnotContext", "has_content_txt")
|
|
2109
|
+
);
|
|
2110
|
+
const hasBlock = asBool(
|
|
2111
|
+
subclassVal(ctxPtr, "MLEADER_AnnotContext", "has_content_blk")
|
|
2112
|
+
);
|
|
2113
|
+
const planeOrigin = subclassVal(
|
|
2114
|
+
ctxPtr,
|
|
2115
|
+
"MLEADER_AnnotContext",
|
|
2116
|
+
"base"
|
|
2117
|
+
);
|
|
2118
|
+
const planeXAxisDirection = subclassVal(
|
|
2119
|
+
ctxPtr,
|
|
2120
|
+
"MLEADER_AnnotContext",
|
|
2121
|
+
"base_dir"
|
|
2122
|
+
);
|
|
2123
|
+
const planeYAxisDirection = subclassVal(
|
|
2124
|
+
ctxPtr,
|
|
2125
|
+
"MLEADER_AnnotContext",
|
|
2126
|
+
"base_vert"
|
|
2127
|
+
);
|
|
2128
|
+
const planeNormalReversed = asBool(
|
|
2129
|
+
subclassVal(ctxPtr, "MLEADER_AnnotContext", "is_normal_reversed")
|
|
2130
|
+
);
|
|
2131
|
+
let textFlowDirection;
|
|
2132
|
+
let normal;
|
|
2133
|
+
let textRotation;
|
|
2134
|
+
let textWidth;
|
|
2135
|
+
let textLineSpacingFactor;
|
|
2136
|
+
let textLineSpacingStyle;
|
|
2137
|
+
let textAnchor;
|
|
2138
|
+
let textDirection;
|
|
2139
|
+
let textBackgroundColor;
|
|
2140
|
+
let textBackgroundScaleFactor;
|
|
2141
|
+
let textBackgroundTransparency;
|
|
2142
|
+
let textBackgroundColorOn;
|
|
2143
|
+
let textFillOn;
|
|
2144
|
+
let textColumnType;
|
|
2145
|
+
let textUseAutoHeight;
|
|
2146
|
+
let textColumnWidth;
|
|
2147
|
+
let textColumnGutterWidth;
|
|
2148
|
+
let textColumnFlowReversed;
|
|
2149
|
+
let textColumnHeight;
|
|
2150
|
+
let textUseWordBreak;
|
|
2151
|
+
let textContent;
|
|
2152
|
+
if (hasMText) {
|
|
2153
|
+
const textAlignment = subclassVal(
|
|
2154
|
+
contentPtr,
|
|
2155
|
+
"MLEADER_Content_MText",
|
|
2156
|
+
"alignment"
|
|
2157
|
+
);
|
|
2158
|
+
if (textAlignment != null && textAlignment !== 0) {
|
|
2159
|
+
textAttachmentPoint = textAlignment;
|
|
2160
|
+
}
|
|
2161
|
+
normal = subclassVal(
|
|
2162
|
+
contentPtr,
|
|
2163
|
+
"MLEADER_Content_MText",
|
|
2164
|
+
"normal"
|
|
2165
|
+
);
|
|
2166
|
+
textAnchor = subclassVal(
|
|
2167
|
+
contentPtr,
|
|
2168
|
+
"MLEADER_Content_MText",
|
|
2169
|
+
"location"
|
|
2170
|
+
);
|
|
2171
|
+
textRotation = subclassVal(
|
|
2172
|
+
contentPtr,
|
|
2173
|
+
"MLEADER_Content_MText",
|
|
2174
|
+
"rotation"
|
|
2175
|
+
);
|
|
2176
|
+
textDirection = subclassVal(
|
|
2177
|
+
contentPtr,
|
|
2178
|
+
"MLEADER_Content_MText",
|
|
2179
|
+
"direction"
|
|
2180
|
+
);
|
|
2181
|
+
textWidth = subclassVal(contentPtr, "MLEADER_Content_MText", "width");
|
|
2182
|
+
textLineSpacingFactor = subclassVal(
|
|
2183
|
+
contentPtr,
|
|
2184
|
+
"MLEADER_Content_MText",
|
|
2185
|
+
"line_spacing_factor"
|
|
2186
|
+
);
|
|
2187
|
+
textLineSpacingStyle = subclassVal(
|
|
2188
|
+
contentPtr,
|
|
2189
|
+
"MLEADER_Content_MText",
|
|
2190
|
+
"line_spacing_style"
|
|
2191
|
+
);
|
|
2192
|
+
textFlowDirection = subclassVal(
|
|
2193
|
+
contentPtr,
|
|
2194
|
+
"MLEADER_Content_MText",
|
|
2195
|
+
"flow"
|
|
2196
|
+
);
|
|
2197
|
+
textBackgroundColor = mleaderColor(
|
|
2198
|
+
subclassVal(
|
|
2199
|
+
contentPtr,
|
|
2200
|
+
"MLEADER_Content_MText",
|
|
2201
|
+
"bg_color"
|
|
2202
|
+
)
|
|
2203
|
+
);
|
|
2204
|
+
textBackgroundScaleFactor = subclassVal(
|
|
2205
|
+
contentPtr,
|
|
2206
|
+
"MLEADER_Content_MText",
|
|
2207
|
+
"bg_scale"
|
|
2208
|
+
);
|
|
2209
|
+
textBackgroundTransparency = subclassVal(
|
|
2210
|
+
contentPtr,
|
|
2211
|
+
"MLEADER_Content_MText",
|
|
2212
|
+
"bg_transparency"
|
|
2213
|
+
);
|
|
2214
|
+
textFillOn = asBool(
|
|
2215
|
+
subclassVal(contentPtr, "MLEADER_Content_MText", "is_bg_fill")
|
|
2216
|
+
);
|
|
2217
|
+
textBackgroundColorOn = asBool(
|
|
2218
|
+
subclassVal(
|
|
2219
|
+
contentPtr,
|
|
2220
|
+
"MLEADER_Content_MText",
|
|
2221
|
+
"is_bg_mask_fill"
|
|
2222
|
+
)
|
|
2223
|
+
);
|
|
2224
|
+
textColumnType = subclassVal(
|
|
2225
|
+
contentPtr,
|
|
2226
|
+
"MLEADER_Content_MText",
|
|
2227
|
+
"col_type"
|
|
2228
|
+
);
|
|
2229
|
+
textUseAutoHeight = asBool(
|
|
2230
|
+
subclassVal(
|
|
2231
|
+
contentPtr,
|
|
2232
|
+
"MLEADER_Content_MText",
|
|
2233
|
+
"is_height_auto"
|
|
2234
|
+
)
|
|
2235
|
+
);
|
|
2236
|
+
textColumnWidth = subclassVal(
|
|
2237
|
+
contentPtr,
|
|
2238
|
+
"MLEADER_Content_MText",
|
|
2239
|
+
"col_width"
|
|
2240
|
+
);
|
|
2241
|
+
textColumnGutterWidth = subclassVal(
|
|
2242
|
+
contentPtr,
|
|
2243
|
+
"MLEADER_Content_MText",
|
|
2244
|
+
"col_gutter"
|
|
2245
|
+
);
|
|
2246
|
+
textColumnFlowReversed = asBool(
|
|
2247
|
+
subclassVal(
|
|
2248
|
+
contentPtr,
|
|
2249
|
+
"MLEADER_Content_MText",
|
|
2250
|
+
"is_col_flow_reversed"
|
|
2251
|
+
)
|
|
2252
|
+
);
|
|
2253
|
+
const numColSizes = subclassVal(
|
|
2254
|
+
contentPtr,
|
|
2255
|
+
"MLEADER_Content_MText",
|
|
2256
|
+
"num_col_sizes"
|
|
2257
|
+
);
|
|
2258
|
+
const colSizesPtr = subclassVal(
|
|
2259
|
+
contentPtr,
|
|
2260
|
+
"MLEADER_Content_MText",
|
|
2261
|
+
"col_sizes"
|
|
2262
|
+
);
|
|
2263
|
+
if (numColSizes > 0) {
|
|
2264
|
+
textColumnHeight = libredwg.dwg_ptr_to_double_array(
|
|
2265
|
+
colSizesPtr,
|
|
2266
|
+
numColSizes
|
|
2267
|
+
)[0];
|
|
2268
|
+
}
|
|
2269
|
+
textUseWordBreak = asBool(
|
|
2270
|
+
subclassVal(contentPtr, "MLEADER_Content_MText", "word_break")
|
|
2271
|
+
);
|
|
2272
|
+
textContent = subclassVal(
|
|
2273
|
+
contentPtr,
|
|
2274
|
+
"MLEADER_Content_MText",
|
|
2275
|
+
"default_text"
|
|
2276
|
+
);
|
|
2277
|
+
}
|
|
2278
|
+
let blockContent;
|
|
2279
|
+
if (hasBlock) {
|
|
2280
|
+
const transformPtr = subclassVal(
|
|
2281
|
+
contentPtr,
|
|
2282
|
+
"MLEADER_Content_Block",
|
|
2283
|
+
"transform"
|
|
2284
|
+
);
|
|
2285
|
+
blockContent = {
|
|
2286
|
+
blockContentId: refToId(
|
|
2287
|
+
subclassVal(contentPtr, "MLEADER_Content_Block", "block_table")
|
|
2288
|
+
),
|
|
2289
|
+
normal: subclassVal(
|
|
2290
|
+
contentPtr,
|
|
2291
|
+
"MLEADER_Content_Block",
|
|
2292
|
+
"normal"
|
|
2293
|
+
),
|
|
2294
|
+
position: subclassVal(
|
|
2295
|
+
contentPtr,
|
|
2296
|
+
"MLEADER_Content_Block",
|
|
2297
|
+
"location"
|
|
2298
|
+
),
|
|
2299
|
+
scale: subclassVal(
|
|
2300
|
+
contentPtr,
|
|
2301
|
+
"MLEADER_Content_Block",
|
|
2302
|
+
"scale"
|
|
2303
|
+
),
|
|
2304
|
+
rotation: subclassVal(
|
|
2305
|
+
contentPtr,
|
|
2306
|
+
"MLEADER_Content_Block",
|
|
2307
|
+
"rotation"
|
|
2308
|
+
),
|
|
2309
|
+
color: mleaderColor(
|
|
2310
|
+
subclassVal(
|
|
2311
|
+
contentPtr,
|
|
2312
|
+
"MLEADER_Content_Block",
|
|
2313
|
+
"color"
|
|
2314
|
+
)
|
|
2315
|
+
),
|
|
2316
|
+
transformationMatrix: transformPtr ? libredwg.dwg_ptr_to_double_array(transformPtr, 16) : void 0
|
|
2317
|
+
};
|
|
2318
|
+
}
|
|
2319
|
+
const numLeaders = subclassVal(
|
|
2320
|
+
ctxPtr,
|
|
2321
|
+
"MLEADER_AnnotContext",
|
|
2322
|
+
"num_leaders"
|
|
2323
|
+
);
|
|
2324
|
+
const leadersPtr = subclassVal(
|
|
2325
|
+
ctxPtr,
|
|
2326
|
+
"MLEADER_AnnotContext",
|
|
2327
|
+
"leaders"
|
|
2328
|
+
);
|
|
2329
|
+
const leaderNodeSize = libredwg.dwg_dynapi_subclass_size("LEADER_Node");
|
|
2330
|
+
const leaderLineSize = libredwg.dwg_dynapi_subclass_size("LEADER_Line");
|
|
2331
|
+
const leaderBreakSize = libredwg.dwg_dynapi_subclass_size("LEADER_Break");
|
|
2332
|
+
const leaderSections = [];
|
|
2333
|
+
for (let i = 0; i < numLeaders; i++) {
|
|
2334
|
+
const nodePtr = leadersPtr + i * leaderNodeSize;
|
|
2335
|
+
const lastLeaderLinePointSet = asBool(
|
|
2336
|
+
subclassVal(nodePtr, "LEADER_Node", "has_lastleaderlinepoint")
|
|
2337
|
+
);
|
|
2338
|
+
const doglegVectorSet = asBool(
|
|
2339
|
+
subclassVal(nodePtr, "LEADER_Node", "has_dogleg")
|
|
2340
|
+
);
|
|
2341
|
+
const numBreaks = subclassVal(nodePtr, "LEADER_Node", "num_breaks");
|
|
2342
|
+
const breaksPtr = subclassVal(nodePtr, "LEADER_Node", "breaks");
|
|
2343
|
+
const nodeBreaks = [];
|
|
2344
|
+
for (let j = 0; j < numBreaks; j++) {
|
|
2345
|
+
const breakPtr = breaksPtr + j * leaderBreakSize;
|
|
2346
|
+
nodeBreaks.push({
|
|
2347
|
+
start: subclassVal(breakPtr, "LEADER_Break", "start"),
|
|
2348
|
+
end: subclassVal(breakPtr, "LEADER_Break", "end")
|
|
2349
|
+
});
|
|
2350
|
+
}
|
|
2351
|
+
const numLines = subclassVal(nodePtr, "LEADER_Node", "num_lines");
|
|
2352
|
+
const linesPtr = subclassVal(nodePtr, "LEADER_Node", "lines");
|
|
2353
|
+
const leaderLines = [];
|
|
2354
|
+
for (let j = 0; j < numLines; j++) {
|
|
2355
|
+
const linePtr = linesPtr + j * leaderLineSize;
|
|
2356
|
+
const numPoints = subclassVal(
|
|
2357
|
+
linePtr,
|
|
2358
|
+
"LEADER_Line",
|
|
2359
|
+
"num_points"
|
|
2360
|
+
);
|
|
2361
|
+
const pointsPtr = subclassVal(linePtr, "LEADER_Line", "points");
|
|
2362
|
+
const vertices = numPoints > 0 ? libredwg.dwg_ptr_to_point3d_array(pointsPtr, numPoints) : [];
|
|
2363
|
+
const lineNumBreaks = subclassVal(
|
|
2364
|
+
linePtr,
|
|
2365
|
+
"LEADER_Line",
|
|
2366
|
+
"num_breaks"
|
|
2367
|
+
);
|
|
2368
|
+
const lineBreaksPtr = subclassVal(
|
|
2369
|
+
linePtr,
|
|
2370
|
+
"LEADER_Line",
|
|
2371
|
+
"breaks"
|
|
2372
|
+
);
|
|
2373
|
+
const lineBreaks = [];
|
|
2374
|
+
for (let k = 0; k < lineNumBreaks; k++) {
|
|
2375
|
+
const breakPtr = lineBreaksPtr + k * leaderBreakSize;
|
|
2376
|
+
lineBreaks.push({
|
|
2377
|
+
start: subclassVal(breakPtr, "LEADER_Break", "start"),
|
|
2378
|
+
end: subclassVal(breakPtr, "LEADER_Break", "end")
|
|
2379
|
+
});
|
|
2380
|
+
}
|
|
2381
|
+
leaderLines.push({
|
|
2382
|
+
vertices,
|
|
2383
|
+
leaderLineIndex: subclassVal(
|
|
2384
|
+
linePtr,
|
|
2385
|
+
"LEADER_Line",
|
|
2386
|
+
"line_index"
|
|
2387
|
+
),
|
|
2388
|
+
breaks: lineBreaks.length > 0 ? lineBreaks : void 0
|
|
2389
|
+
});
|
|
2390
|
+
}
|
|
2391
|
+
leaderSections.push({
|
|
2392
|
+
lastLeaderLinePoint: lastLeaderLinePointSet ? subclassVal(
|
|
2393
|
+
nodePtr,
|
|
2394
|
+
"LEADER_Node",
|
|
2395
|
+
"lastleaderlinepoint"
|
|
2396
|
+
) : void 0,
|
|
2397
|
+
lastLeaderLinePointSet,
|
|
2398
|
+
doglegVector: doglegVectorSet ? subclassVal(nodePtr, "LEADER_Node", "dogleg_vector") : void 0,
|
|
2399
|
+
doglegVectorSet,
|
|
2400
|
+
doglegLength: subclassVal(nodePtr, "LEADER_Node", "dogleg_length"),
|
|
2401
|
+
breaks: nodeBreaks.length > 0 ? nodeBreaks : void 0,
|
|
2402
|
+
leaderBranchIndex: subclassVal(
|
|
2403
|
+
nodePtr,
|
|
2404
|
+
"LEADER_Node",
|
|
2405
|
+
"branch_index"
|
|
2406
|
+
),
|
|
2407
|
+
leaderLines
|
|
2408
|
+
});
|
|
2409
|
+
}
|
|
2410
|
+
return {
|
|
2411
|
+
type: "MULTILEADER",
|
|
2412
|
+
...commonAttrs,
|
|
2413
|
+
subclassMarker: "AcDbMLeader",
|
|
2414
|
+
version,
|
|
2415
|
+
leaderStyleId,
|
|
2416
|
+
propertyOverrideFlag,
|
|
2417
|
+
leaderLineType,
|
|
2418
|
+
leaderLineColor,
|
|
2419
|
+
leaderLineTypeId,
|
|
2420
|
+
leaderLineWeight,
|
|
2421
|
+
landingEnabled,
|
|
2422
|
+
doglegEnabled,
|
|
2423
|
+
doglegLength,
|
|
2424
|
+
arrowheadId,
|
|
2425
|
+
arrowheadSize: arrowheadSize || contextArrowSize,
|
|
2426
|
+
contentType,
|
|
2427
|
+
textStyleId,
|
|
2428
|
+
textLeftAttachmentType: textLeftAttachmentType || contextTextLeft,
|
|
2429
|
+
textRightAttachmentType: textRightAttachmentType || contextTextRight,
|
|
2430
|
+
textAngleType: textAngleType || contextTextAngleType,
|
|
2431
|
+
textAlignmentType: textAlignmentType || contextTextAlignment,
|
|
2432
|
+
textColor,
|
|
2433
|
+
textFrameEnabled,
|
|
2434
|
+
landingGap,
|
|
2435
|
+
textAttachment,
|
|
2436
|
+
textFlowDirection,
|
|
2437
|
+
blockContentId,
|
|
2438
|
+
blockContentColor,
|
|
2439
|
+
blockContentScale,
|
|
2440
|
+
blockContentRotation,
|
|
2441
|
+
blockContentConnectionType,
|
|
2442
|
+
annotativeScaleEnabled,
|
|
2443
|
+
arrowheadOverrides: arrowheadOverrides.length > 0 ? arrowheadOverrides : void 0,
|
|
2444
|
+
blockAttributes: blockAttributes.length > 0 ? blockAttributes : void 0,
|
|
2445
|
+
textDirectionNegative,
|
|
2446
|
+
textAlignInIPE,
|
|
2447
|
+
textAttachmentPoint,
|
|
2448
|
+
textAttachmentDirection,
|
|
2449
|
+
bottomTextAttachmentDirection,
|
|
2450
|
+
topTextAttachmentDirection,
|
|
2451
|
+
contentScale: contentScale || contentScaleFactor,
|
|
2452
|
+
contentBasePosition,
|
|
2453
|
+
normal,
|
|
2454
|
+
textHeight: contextTextHeight,
|
|
2455
|
+
textRotation,
|
|
2456
|
+
textWidth,
|
|
2457
|
+
textLineSpacingFactor,
|
|
2458
|
+
textLineSpacingStyle,
|
|
2459
|
+
textAnchor,
|
|
2460
|
+
textDirection,
|
|
2461
|
+
textBackgroundColor,
|
|
2462
|
+
textBackgroundScaleFactor,
|
|
2463
|
+
textBackgroundTransparency,
|
|
2464
|
+
textBackgroundColorOn,
|
|
2465
|
+
textFillOn,
|
|
2466
|
+
textColumnType,
|
|
2467
|
+
textUseAutoHeight,
|
|
2468
|
+
textColumnWidth,
|
|
2469
|
+
textColumnGutterWidth,
|
|
2470
|
+
textColumnFlowReversed,
|
|
2471
|
+
textColumnHeight,
|
|
2472
|
+
textUseWordBreak,
|
|
2473
|
+
textContent,
|
|
2474
|
+
hasMText,
|
|
2475
|
+
hasBlock,
|
|
2476
|
+
blockContent,
|
|
2477
|
+
planeOrigin,
|
|
2478
|
+
planeXAxisDirection,
|
|
2479
|
+
planeYAxisDirection,
|
|
2480
|
+
planeNormalReversed,
|
|
2481
|
+
leaderSections: leaderSections.length > 0 ? leaderSections : void 0
|
|
2482
|
+
};
|
|
2483
|
+
}
|
|
2116
2484
|
convertOle2Frame(entity, commonAttrs) {
|
|
2117
2485
|
const libredwg = this.libredwg;
|
|
2118
|
-
const oleVersion = libredwg.
|
|
2119
|
-
const oleClient = libredwg.
|
|
2120
|
-
const dataSize = libredwg.
|
|
2121
|
-
const leftUpPoint = libredwg.
|
|
2122
|
-
const rightDownPoint = libredwg.
|
|
2123
|
-
const lockAspect = libredwg.
|
|
2124
|
-
const oleObjectType = libredwg.
|
|
2125
|
-
const tileModeDescriptor = libredwg.
|
|
2126
|
-
const binaryData = libredwg.
|
|
2486
|
+
const oleVersion = libredwg.dwg_dynapi_entity_data(entity, "oleversion");
|
|
2487
|
+
const oleClient = libredwg.dwg_dynapi_entity_data(entity, "oleclient");
|
|
2488
|
+
const dataSize = libredwg.dwg_dynapi_entity_data(entity, "data_size");
|
|
2489
|
+
const leftUpPoint = libredwg.dwg_dynapi_entity_data(entity, "pt1");
|
|
2490
|
+
const rightDownPoint = libredwg.dwg_dynapi_entity_data(entity, "pt2");
|
|
2491
|
+
const lockAspect = libredwg.dwg_dynapi_entity_data(entity, "lock_aspect");
|
|
2492
|
+
const oleObjectType = libredwg.dwg_dynapi_entity_data(entity, "type");
|
|
2493
|
+
const tileModeDescriptor = libredwg.dwg_dynapi_entity_data(entity, "mode");
|
|
2494
|
+
const binaryData = libredwg.dwg_dynapi_entity_data(entity, "data");
|
|
2127
2495
|
return {
|
|
2128
2496
|
type: "OLE2FRAME",
|
|
2129
2497
|
...commonAttrs,
|
|
@@ -2140,10 +2508,10 @@ class LibreEntityConverter {
|
|
|
2140
2508
|
}
|
|
2141
2509
|
convertOleFrame(entity, commonAttrs) {
|
|
2142
2510
|
const libredwg = this.libredwg;
|
|
2143
|
-
const flag = libredwg.
|
|
2144
|
-
const mode = libredwg.
|
|
2145
|
-
const dataSize = libredwg.
|
|
2146
|
-
const binaryData = libredwg.
|
|
2511
|
+
const flag = libredwg.dwg_dynapi_entity_data(entity, "flag");
|
|
2512
|
+
const mode = libredwg.dwg_dynapi_entity_data(entity, "mode");
|
|
2513
|
+
const dataSize = libredwg.dwg_dynapi_entity_data(entity, "data_size");
|
|
2514
|
+
const binaryData = libredwg.dwg_dynapi_entity_data(entity, "data");
|
|
2147
2515
|
return {
|
|
2148
2516
|
type: "OLEFRAME",
|
|
2149
2517
|
...commonAttrs,
|
|
@@ -2155,76 +2523,31 @@ class LibreEntityConverter {
|
|
|
2155
2523
|
}
|
|
2156
2524
|
convertMText(entity, commonAttrs) {
|
|
2157
2525
|
const libredwg = this.libredwg;
|
|
2158
|
-
const insertionPoint = libredwg.
|
|
2159
|
-
const textHeight = libredwg.
|
|
2160
|
-
const rectHeight = libredwg.
|
|
2161
|
-
const rectWidth = libredwg.
|
|
2162
|
-
const extentsWidth = libredwg.
|
|
2163
|
-
|
|
2164
|
-
|
|
2165
|
-
)
|
|
2166
|
-
const
|
|
2167
|
-
entity,
|
|
2168
|
-
"extents_height"
|
|
2169
|
-
).data;
|
|
2170
|
-
const attachmentPoint = libredwg.dwg_dynapi_entity_value(
|
|
2171
|
-
entity,
|
|
2172
|
-
"attachment"
|
|
2173
|
-
).data;
|
|
2174
|
-
const drawingDirection = libredwg.dwg_dynapi_entity_value(
|
|
2175
|
-
entity,
|
|
2176
|
-
"flow_dir"
|
|
2177
|
-
).data;
|
|
2178
|
-
const text = libredwg.dwg_dynapi_entity_value(entity, "text").data;
|
|
2526
|
+
const insertionPoint = libredwg.dwg_dynapi_entity_data(entity, "ins_pt");
|
|
2527
|
+
const textHeight = libredwg.dwg_dynapi_entity_data(entity, "text_height");
|
|
2528
|
+
const rectHeight = libredwg.dwg_dynapi_entity_data(entity, "rect_height");
|
|
2529
|
+
const rectWidth = libredwg.dwg_dynapi_entity_data(entity, "rect_width");
|
|
2530
|
+
const extentsWidth = libredwg.dwg_dynapi_entity_data(entity, "extents_width");
|
|
2531
|
+
const extentsHeight = libredwg.dwg_dynapi_entity_data(entity, "extents_height");
|
|
2532
|
+
const attachmentPoint = libredwg.dwg_dynapi_entity_data(entity, "attachment");
|
|
2533
|
+
const drawingDirection = libredwg.dwg_dynapi_entity_data(entity, "flow_dir");
|
|
2534
|
+
const text = libredwg.dwg_dynapi_entity_data(entity, "text");
|
|
2179
2535
|
const styleName = libredwg.dwg_entity_mtext_get_style_name(entity);
|
|
2180
|
-
const extrusionDirection = libredwg.
|
|
2181
|
-
|
|
2182
|
-
|
|
2183
|
-
)
|
|
2184
|
-
const
|
|
2185
|
-
const
|
|
2186
|
-
|
|
2187
|
-
|
|
2188
|
-
)
|
|
2189
|
-
const
|
|
2190
|
-
|
|
2191
|
-
|
|
2192
|
-
)
|
|
2193
|
-
const
|
|
2194
|
-
|
|
2195
|
-
"bg_fill_flag"
|
|
2196
|
-
).data;
|
|
2197
|
-
const fillBoxScale = libredwg.dwg_dynapi_entity_value(
|
|
2198
|
-
entity,
|
|
2199
|
-
"bg_fill_scale"
|
|
2200
|
-
).data;
|
|
2201
|
-
const backgroundFillColor = libredwg.dwg_dynapi_entity_value(
|
|
2202
|
-
entity,
|
|
2203
|
-
"bg_fill_color"
|
|
2204
|
-
).data;
|
|
2205
|
-
const backgroundFillTransparency = libredwg.dwg_dynapi_entity_value(
|
|
2206
|
-
entity,
|
|
2207
|
-
"bg_fill_trans"
|
|
2208
|
-
).data;
|
|
2209
|
-
const columnType = libredwg.dwg_dynapi_entity_value(entity, "column_type").data;
|
|
2210
|
-
const columnFlowReversed = libredwg.dwg_dynapi_entity_value(
|
|
2211
|
-
entity,
|
|
2212
|
-
"flow_reversed"
|
|
2213
|
-
).data;
|
|
2214
|
-
const columnAutoHeight = libredwg.dwg_dynapi_entity_value(
|
|
2215
|
-
entity,
|
|
2216
|
-
"auto_height"
|
|
2217
|
-
).data;
|
|
2218
|
-
const columnWidth = libredwg.dwg_dynapi_entity_value(entity, "column_width").data;
|
|
2219
|
-
const columnGutter = libredwg.dwg_dynapi_entity_value(entity, "gutter").data;
|
|
2220
|
-
const columnHeightCount = libredwg.dwg_dynapi_entity_value(
|
|
2221
|
-
entity,
|
|
2222
|
-
"num_column_heights"
|
|
2223
|
-
).data;
|
|
2224
|
-
const columnHeights_ptr = libredwg.dwg_dynapi_entity_value(
|
|
2225
|
-
entity,
|
|
2226
|
-
"column_heights"
|
|
2227
|
-
).data;
|
|
2536
|
+
const extrusionDirection = libredwg.dwg_dynapi_entity_data(entity, "extrusion");
|
|
2537
|
+
const direction = libredwg.dwg_dynapi_entity_data(entity, "x_axis_dir");
|
|
2538
|
+
const lineSpacingStyle = libredwg.dwg_dynapi_entity_data(entity, "linespace_style");
|
|
2539
|
+
const lineSpacing = libredwg.dwg_dynapi_entity_data(entity, "linespace_factor");
|
|
2540
|
+
const backgroundFill = libredwg.dwg_dynapi_entity_data(entity, "bg_fill_flag");
|
|
2541
|
+
const fillBoxScale = libredwg.dwg_dynapi_entity_data(entity, "bg_fill_scale");
|
|
2542
|
+
const backgroundFillColor = libredwg.dwg_dynapi_entity_data(entity, "bg_fill_color");
|
|
2543
|
+
const backgroundFillTransparency = libredwg.dwg_dynapi_entity_data(entity, "bg_fill_trans");
|
|
2544
|
+
const columnType = libredwg.dwg_dynapi_entity_data(entity, "column_type");
|
|
2545
|
+
const columnFlowReversed = libredwg.dwg_dynapi_entity_data(entity, "flow_reversed");
|
|
2546
|
+
const columnAutoHeight = libredwg.dwg_dynapi_entity_data(entity, "auto_height");
|
|
2547
|
+
const columnWidth = libredwg.dwg_dynapi_entity_data(entity, "column_width");
|
|
2548
|
+
const columnGutter = libredwg.dwg_dynapi_entity_data(entity, "gutter");
|
|
2549
|
+
const columnHeightCount = libredwg.dwg_dynapi_entity_data(entity, "num_column_heights");
|
|
2550
|
+
const columnHeights_ptr = libredwg.dwg_dynapi_entity_data(entity, "column_heights");
|
|
2228
2551
|
const columnHeights = libredwg.dwg_ptr_to_double_array(
|
|
2229
2552
|
columnHeights_ptr,
|
|
2230
2553
|
columnHeightCount
|
|
@@ -2266,15 +2589,12 @@ class LibreEntityConverter {
|
|
|
2266
2589
|
}
|
|
2267
2590
|
convertPoint(entity, commonAttrs) {
|
|
2268
2591
|
const libredwg = this.libredwg;
|
|
2269
|
-
const x = libredwg.
|
|
2270
|
-
const y = libredwg.
|
|
2271
|
-
const z = libredwg.
|
|
2272
|
-
const thickness = libredwg.
|
|
2273
|
-
const extrusionDirection = libredwg.
|
|
2274
|
-
|
|
2275
|
-
"extrusion"
|
|
2276
|
-
).data;
|
|
2277
|
-
const angle = libredwg.dwg_dynapi_entity_value(entity, "x_ang").data;
|
|
2592
|
+
const x = libredwg.dwg_dynapi_entity_data(entity, "x");
|
|
2593
|
+
const y = libredwg.dwg_dynapi_entity_data(entity, "y");
|
|
2594
|
+
const z = libredwg.dwg_dynapi_entity_data(entity, "z");
|
|
2595
|
+
const thickness = libredwg.dwg_dynapi_entity_data(entity, "thickness");
|
|
2596
|
+
const extrusionDirection = libredwg.dwg_dynapi_entity_data(entity, "extrusion");
|
|
2597
|
+
const angle = libredwg.dwg_dynapi_entity_data(entity, "x_ang");
|
|
2278
2598
|
return {
|
|
2279
2599
|
type: "POINT",
|
|
2280
2600
|
...commonAttrs,
|
|
@@ -2286,16 +2606,13 @@ class LibreEntityConverter {
|
|
|
2286
2606
|
}
|
|
2287
2607
|
convertPolyline2d(entity, commonAttrs, object) {
|
|
2288
2608
|
const libredwg = this.libredwg;
|
|
2289
|
-
const flag = libredwg.
|
|
2290
|
-
const smoothType = libredwg.
|
|
2291
|
-
const startWidth = libredwg.
|
|
2292
|
-
const endWidth = libredwg.
|
|
2293
|
-
const elevation = libredwg.
|
|
2294
|
-
const thickness = libredwg.
|
|
2295
|
-
const extrusionDirection = libredwg.
|
|
2296
|
-
entity,
|
|
2297
|
-
"extrusion"
|
|
2298
|
-
).data;
|
|
2609
|
+
const flag = libredwg.dwg_dynapi_entity_data(entity, "flag");
|
|
2610
|
+
const smoothType = libredwg.dwg_dynapi_entity_data(entity, "curve_type");
|
|
2611
|
+
const startWidth = libredwg.dwg_dynapi_entity_data(entity, "start_width");
|
|
2612
|
+
const endWidth = libredwg.dwg_dynapi_entity_data(entity, "end_width");
|
|
2613
|
+
const elevation = libredwg.dwg_dynapi_entity_data(entity, "elevation");
|
|
2614
|
+
const thickness = libredwg.dwg_dynapi_entity_data(entity, "thickness");
|
|
2615
|
+
const extrusionDirection = libredwg.dwg_dynapi_entity_data(entity, "extrusion");
|
|
2299
2616
|
const vertices = libredwg.dwg_entity_polyline_2d_get_vertices(object);
|
|
2300
2617
|
return {
|
|
2301
2618
|
type: "POLYLINE2D",
|
|
@@ -2327,14 +2644,11 @@ class LibreEntityConverter {
|
|
|
2327
2644
|
}
|
|
2328
2645
|
convertPolyline3d(entity, commonAttrs, object) {
|
|
2329
2646
|
const libredwg = this.libredwg;
|
|
2330
|
-
const flag = libredwg.
|
|
2331
|
-
const smoothType = libredwg.
|
|
2332
|
-
const startWidth = libredwg.
|
|
2333
|
-
const endWidth = libredwg.
|
|
2334
|
-
const extrusionDirection = libredwg.
|
|
2335
|
-
entity,
|
|
2336
|
-
"extrusion"
|
|
2337
|
-
).data;
|
|
2647
|
+
const flag = libredwg.dwg_dynapi_entity_data(entity, "flag");
|
|
2648
|
+
const smoothType = libredwg.dwg_dynapi_entity_data(entity, "curve_type");
|
|
2649
|
+
const startWidth = libredwg.dwg_dynapi_entity_data(entity, "start_width");
|
|
2650
|
+
const endWidth = libredwg.dwg_dynapi_entity_data(entity, "end_width");
|
|
2651
|
+
const extrusionDirection = libredwg.dwg_dynapi_entity_data(entity, "extrusion");
|
|
2338
2652
|
const vertices = libredwg.dwg_entity_polyline_3d_get_vertices(object);
|
|
2339
2653
|
return {
|
|
2340
2654
|
type: "POLYLINE3D",
|
|
@@ -2356,24 +2670,12 @@ class LibreEntityConverter {
|
|
|
2356
2670
|
}
|
|
2357
2671
|
convertProxyEntity(entity, commonAttrs, objectPtr) {
|
|
2358
2672
|
const libredwg = this.libredwg;
|
|
2359
|
-
const proxyEntityClassId = libredwg.
|
|
2360
|
-
|
|
2361
|
-
|
|
2362
|
-
)
|
|
2363
|
-
const
|
|
2364
|
-
|
|
2365
|
-
"class_id"
|
|
2366
|
-
).data;
|
|
2367
|
-
const entityDataSize = libredwg.dwg_dynapi_entity_value(
|
|
2368
|
-
entity,
|
|
2369
|
-
"data_numbits"
|
|
2370
|
-
).data;
|
|
2371
|
-
const objectDrawingFormat = libredwg.dwg_dynapi_entity_value(
|
|
2372
|
-
entity,
|
|
2373
|
-
"version"
|
|
2374
|
-
).data;
|
|
2375
|
-
const fromDxf = libredwg.dwg_dynapi_entity_value(entity, "from_dxf").data;
|
|
2376
|
-
const numObjIds = libredwg.dwg_dynapi_entity_value(entity, "num_objids").data;
|
|
2673
|
+
const proxyEntityClassId = libredwg.dwg_dynapi_entity_data(entity, "proxy_id");
|
|
2674
|
+
const applicationEntityClassId = libredwg.dwg_dynapi_entity_data(entity, "class_id");
|
|
2675
|
+
const entityDataSize = libredwg.dwg_dynapi_entity_data(entity, "data_numbits");
|
|
2676
|
+
const objectDrawingFormat = libredwg.dwg_dynapi_entity_data(entity, "version");
|
|
2677
|
+
const fromDxf = libredwg.dwg_dynapi_entity_data(entity, "from_dxf");
|
|
2678
|
+
const numObjIds = libredwg.dwg_dynapi_entity_data(entity, "num_objids");
|
|
2377
2679
|
const graphicsBytes = libredwg.dwg_entity_get_preview(objectPtr);
|
|
2378
2680
|
const graphicsDataSize = (graphicsBytes == null ? void 0 : graphicsBytes.length) ?? 0;
|
|
2379
2681
|
const entityBytes = libredwg.dwg_entity_proxy_entity_get_entity_data(entity);
|
|
@@ -2381,7 +2683,7 @@ class LibreEntityConverter {
|
|
|
2381
2683
|
const entityData = entityBytes ? uint8ArrayToHexString(entityBytes) : void 0;
|
|
2382
2684
|
let linkedObjectIds;
|
|
2383
2685
|
if (numObjIds > 0) {
|
|
2384
|
-
const objidsPtr = libredwg.
|
|
2686
|
+
const objidsPtr = libredwg.dwg_dynapi_entity_data(entity, "objids");
|
|
2385
2687
|
if (objidsPtr) {
|
|
2386
2688
|
const objids = libredwg.dwg_ptr_to_object_ref_array(
|
|
2387
2689
|
objidsPtr,
|
|
@@ -2436,8 +2738,8 @@ class LibreEntityConverter {
|
|
|
2436
2738
|
}
|
|
2437
2739
|
convertRay(entity, commonAttrs) {
|
|
2438
2740
|
const libredwg = this.libredwg;
|
|
2439
|
-
const firstPoint = libredwg.
|
|
2440
|
-
const unitDirection = libredwg.
|
|
2741
|
+
const firstPoint = libredwg.dwg_dynapi_entity_data(entity, "point");
|
|
2742
|
+
const unitDirection = libredwg.dwg_dynapi_entity_data(entity, "vector");
|
|
2441
2743
|
return {
|
|
2442
2744
|
type: "RAY",
|
|
2443
2745
|
...commonAttrs,
|
|
@@ -2447,51 +2749,25 @@ class LibreEntityConverter {
|
|
|
2447
2749
|
}
|
|
2448
2750
|
convertSection(entity, commonAttrs) {
|
|
2449
2751
|
const libredwg = this.libredwg;
|
|
2450
|
-
const state = libredwg.
|
|
2451
|
-
const flags = libredwg.
|
|
2452
|
-
const name = libredwg.
|
|
2453
|
-
const verticalDirection = libredwg.
|
|
2454
|
-
|
|
2455
|
-
|
|
2456
|
-
)
|
|
2457
|
-
const
|
|
2458
|
-
const
|
|
2459
|
-
|
|
2460
|
-
"bottom_height"
|
|
2461
|
-
).data;
|
|
2462
|
-
const indicatorTransparency = libredwg.dwg_dynapi_entity_value(
|
|
2463
|
-
entity,
|
|
2464
|
-
"indicator_alpha"
|
|
2465
|
-
).data;
|
|
2466
|
-
const indicatorColor = libredwg.dwg_dynapi_entity_value(
|
|
2467
|
-
entity,
|
|
2468
|
-
"indicator_color"
|
|
2469
|
-
).data;
|
|
2470
|
-
const numberOfVertices = libredwg.dwg_dynapi_entity_value(
|
|
2471
|
-
entity,
|
|
2472
|
-
"num_verts"
|
|
2473
|
-
).data;
|
|
2474
|
-
const vertices_ptr = libredwg.dwg_dynapi_entity_value(entity, "verts").data;
|
|
2752
|
+
const state = libredwg.dwg_dynapi_entity_data(entity, "state");
|
|
2753
|
+
const flags = libredwg.dwg_dynapi_entity_data(entity, "flag");
|
|
2754
|
+
const name = libredwg.dwg_dynapi_entity_data(entity, "name");
|
|
2755
|
+
const verticalDirection = libredwg.dwg_dynapi_entity_data(entity, "vert_dir");
|
|
2756
|
+
const topHeight = libredwg.dwg_dynapi_entity_data(entity, "top_height");
|
|
2757
|
+
const bottomHeight = libredwg.dwg_dynapi_entity_data(entity, "bottom_height");
|
|
2758
|
+
const indicatorTransparency = libredwg.dwg_dynapi_entity_data(entity, "indicator_alpha");
|
|
2759
|
+
const indicatorColor = libredwg.dwg_dynapi_entity_data(entity, "indicator_color");
|
|
2760
|
+
const numberOfVertices = libredwg.dwg_dynapi_entity_data(entity, "num_verts");
|
|
2761
|
+
const vertices_ptr = libredwg.dwg_dynapi_entity_data(entity, "verts");
|
|
2475
2762
|
const vertices = numberOfVertices > 0 ? libredwg.dwg_ptr_to_point3d_array(vertices_ptr, numberOfVertices) : [];
|
|
2476
|
-
const numberOfBackLineVertices = libredwg.
|
|
2477
|
-
|
|
2478
|
-
"num_blverts"
|
|
2479
|
-
).data;
|
|
2480
|
-
const backLineVertices_ptr = libredwg.dwg_dynapi_entity_value(
|
|
2481
|
-
entity,
|
|
2482
|
-
"blverts"
|
|
2483
|
-
).data;
|
|
2763
|
+
const numberOfBackLineVertices = libredwg.dwg_dynapi_entity_data(entity, "num_blverts");
|
|
2764
|
+
const backLineVertices_ptr = libredwg.dwg_dynapi_entity_data(entity, "blverts");
|
|
2484
2765
|
const backLineVertices = numberOfBackLineVertices > 0 ? libredwg.dwg_ptr_to_point3d_array(
|
|
2485
2766
|
backLineVertices_ptr,
|
|
2486
2767
|
numberOfBackLineVertices
|
|
2487
2768
|
) : [];
|
|
2488
|
-
const geometrySettingHandle = libredwg.
|
|
2489
|
-
|
|
2490
|
-
"geometrySettingHardId"
|
|
2491
|
-
).data;
|
|
2492
|
-
const geometrySettingHardId = libredwg.dwg_ref_get_handle_absolute_ref(
|
|
2493
|
-
geometrySettingHandle
|
|
2494
|
-
);
|
|
2769
|
+
const geometrySettingHandle = libredwg.dwg_dynapi_entity_data(entity, "geometrySettingHardId");
|
|
2770
|
+
const geometrySettingHardId = libredwg.dwg_ref_get_handle_absolute_ref(geometrySettingHandle) ?? 0n;
|
|
2495
2771
|
return {
|
|
2496
2772
|
type: "SECTION",
|
|
2497
2773
|
...commonAttrs,
|
|
@@ -2510,17 +2786,40 @@ class LibreEntityConverter {
|
|
|
2510
2786
|
geometrySettingHardId
|
|
2511
2787
|
};
|
|
2512
2788
|
}
|
|
2789
|
+
convertShape(entity, commonAttrs) {
|
|
2790
|
+
const libredwg = this.libredwg;
|
|
2791
|
+
const insertionPoint = libredwg.dwg_dynapi_entity_data(entity, "ins_pt");
|
|
2792
|
+
const size = libredwg.dwg_dynapi_entity_data(entity, "scale");
|
|
2793
|
+
const rotation = libredwg.dwg_dynapi_entity_data(entity, "rotation");
|
|
2794
|
+
const xScale = libredwg.dwg_dynapi_entity_data(entity, "width_factor");
|
|
2795
|
+
const obliqueAngle = libredwg.dwg_dynapi_entity_data(entity, "oblique_angle");
|
|
2796
|
+
const thickness = libredwg.dwg_dynapi_entity_data(entity, "thickness");
|
|
2797
|
+
const extrusionDirection = libredwg.dwg_dynapi_entity_data(entity, "extrusion");
|
|
2798
|
+
const shapeNumber = libredwg.dwg_dynapi_entity_data(entity, "style_id");
|
|
2799
|
+
const styleName = libredwg.dwg_entity_text_get_style_name(entity);
|
|
2800
|
+
return {
|
|
2801
|
+
type: "SHAPE",
|
|
2802
|
+
subclassMarker: "AcDbShape",
|
|
2803
|
+
...commonAttrs,
|
|
2804
|
+
thickness,
|
|
2805
|
+
insertionPoint,
|
|
2806
|
+
size,
|
|
2807
|
+
shapeNumber,
|
|
2808
|
+
styleName,
|
|
2809
|
+
rotation,
|
|
2810
|
+
xScale,
|
|
2811
|
+
obliqueAngle,
|
|
2812
|
+
extrusionDirection
|
|
2813
|
+
};
|
|
2814
|
+
}
|
|
2513
2815
|
convertSolid(entity, commonAttrs) {
|
|
2514
2816
|
const libredwg = this.libredwg;
|
|
2515
|
-
const corner1 = libredwg.
|
|
2516
|
-
const corner2 = libredwg.
|
|
2517
|
-
const corner3 = libredwg.
|
|
2518
|
-
const corner4 = libredwg.
|
|
2519
|
-
const thickness = libredwg.
|
|
2520
|
-
const extrusionDirection = libredwg.
|
|
2521
|
-
entity,
|
|
2522
|
-
"extrusion"
|
|
2523
|
-
).data;
|
|
2817
|
+
const corner1 = libredwg.dwg_dynapi_entity_data(entity, "corner1");
|
|
2818
|
+
const corner2 = libredwg.dwg_dynapi_entity_data(entity, "corner2");
|
|
2819
|
+
const corner3 = libredwg.dwg_dynapi_entity_data(entity, "corner3");
|
|
2820
|
+
const corner4 = libredwg.dwg_dynapi_entity_data(entity, "corner4");
|
|
2821
|
+
const thickness = libredwg.dwg_dynapi_entity_data(entity, "thickness");
|
|
2822
|
+
const extrusionDirection = libredwg.dwg_dynapi_entity_data(entity, "extrusion");
|
|
2524
2823
|
return {
|
|
2525
2824
|
type: "SOLID",
|
|
2526
2825
|
...commonAttrs,
|
|
@@ -2534,38 +2833,29 @@ class LibreEntityConverter {
|
|
|
2534
2833
|
}
|
|
2535
2834
|
convertSpline(entity, commonAttrs) {
|
|
2536
2835
|
const libredwg = this.libredwg;
|
|
2537
|
-
const flag = libredwg.
|
|
2538
|
-
const degree = libredwg.
|
|
2539
|
-
const knotTolerance = libredwg.
|
|
2540
|
-
const numberOfKnots = libredwg.
|
|
2541
|
-
const knots_ptr = libredwg.
|
|
2836
|
+
const flag = libredwg.dwg_dynapi_entity_data(entity, "splineflags");
|
|
2837
|
+
const degree = libredwg.dwg_dynapi_entity_data(entity, "degree");
|
|
2838
|
+
const knotTolerance = libredwg.dwg_dynapi_entity_data(entity, "knot_tol");
|
|
2839
|
+
const numberOfKnots = libredwg.dwg_dynapi_entity_data(entity, "num_knots");
|
|
2840
|
+
const knots_ptr = libredwg.dwg_dynapi_entity_data(entity, "knots");
|
|
2542
2841
|
const knots = libredwg.dwg_ptr_to_double_array(knots_ptr, numberOfKnots);
|
|
2543
|
-
const fitTolerance = libredwg.
|
|
2544
|
-
const numberOfFitPoints = libredwg.
|
|
2545
|
-
|
|
2546
|
-
"num_fit_pts"
|
|
2547
|
-
).data;
|
|
2548
|
-
const fit_pts_ptr = libredwg.dwg_dynapi_entity_value(entity, "fit_pts").data;
|
|
2842
|
+
const fitTolerance = libredwg.dwg_dynapi_entity_data(entity, "fit_tol");
|
|
2843
|
+
const numberOfFitPoints = libredwg.dwg_dynapi_entity_data(entity, "num_fit_pts");
|
|
2844
|
+
const fit_pts_ptr = libredwg.dwg_dynapi_entity_data(entity, "fit_pts");
|
|
2549
2845
|
const fitPoints = libredwg.dwg_ptr_to_point3d_array(
|
|
2550
2846
|
fit_pts_ptr,
|
|
2551
2847
|
numberOfFitPoints
|
|
2552
2848
|
);
|
|
2553
|
-
const weighted = libredwg.
|
|
2554
|
-
const controlTolerance = libredwg.
|
|
2555
|
-
|
|
2556
|
-
|
|
2557
|
-
).data;
|
|
2558
|
-
const numberOfControlPoints = libredwg.dwg_dynapi_entity_value(
|
|
2559
|
-
entity,
|
|
2560
|
-
"num_ctrl_pts"
|
|
2561
|
-
).data;
|
|
2562
|
-
const ctrl_pts_ptr = libredwg.dwg_dynapi_entity_value(entity, "ctrl_pts").data;
|
|
2849
|
+
const weighted = libredwg.dwg_dynapi_entity_data(entity, "weighted");
|
|
2850
|
+
const controlTolerance = libredwg.dwg_dynapi_entity_data(entity, "ctrl_tol");
|
|
2851
|
+
const numberOfControlPoints = libredwg.dwg_dynapi_entity_data(entity, "num_ctrl_pts");
|
|
2852
|
+
const ctrl_pts_ptr = libredwg.dwg_dynapi_entity_data(entity, "ctrl_pts");
|
|
2563
2853
|
const controlPoints = libredwg.dwg_ptr_to_point4d_array(
|
|
2564
2854
|
ctrl_pts_ptr,
|
|
2565
2855
|
numberOfControlPoints
|
|
2566
2856
|
);
|
|
2567
|
-
const startTangent = libredwg.
|
|
2568
|
-
const endTangent = libredwg.
|
|
2857
|
+
const startTangent = libredwg.dwg_dynapi_entity_data(entity, "beg_tan_vec");
|
|
2858
|
+
const endTangent = libredwg.dwg_dynapi_entity_data(entity, "end_tan_vec");
|
|
2569
2859
|
return {
|
|
2570
2860
|
type: "SPLINE",
|
|
2571
2861
|
...commonAttrs,
|
|
@@ -2594,66 +2884,32 @@ class LibreEntityConverter {
|
|
|
2594
2884
|
}
|
|
2595
2885
|
convertTable(entity, commonAttrs) {
|
|
2596
2886
|
const libredwg = this.libredwg;
|
|
2597
|
-
const name = libredwg.
|
|
2598
|
-
const startPoint = libredwg.
|
|
2599
|
-
const directionVector = libredwg.
|
|
2600
|
-
|
|
2601
|
-
|
|
2602
|
-
)
|
|
2603
|
-
const
|
|
2604
|
-
entity,
|
|
2605
|
-
"flag_for_table_value"
|
|
2606
|
-
).data;
|
|
2607
|
-
const rowCount = libredwg.dwg_dynapi_entity_value(entity, "num_rows").data;
|
|
2608
|
-
const columnCount = libredwg.dwg_dynapi_entity_value(entity, "num_cols").data;
|
|
2609
|
-
const row_heights_ptr = libredwg.dwg_dynapi_entity_value(
|
|
2610
|
-
entity,
|
|
2611
|
-
"row_heights"
|
|
2612
|
-
).data;
|
|
2887
|
+
const name = libredwg.dwg_dynapi_subclass_data(entity, "ldata", "name");
|
|
2888
|
+
const startPoint = libredwg.dwg_dynapi_entity_data(entity, "ins_pt");
|
|
2889
|
+
const directionVector = libredwg.dwg_dynapi_entity_data(entity, "horiz_direction");
|
|
2890
|
+
const tableValue = libredwg.dwg_dynapi_entity_data(entity, "flag_for_table_value");
|
|
2891
|
+
const rowCount = libredwg.dwg_dynapi_entity_data(entity, "num_rows");
|
|
2892
|
+
const columnCount = libredwg.dwg_dynapi_entity_data(entity, "num_cols");
|
|
2893
|
+
const row_heights_ptr = libredwg.dwg_dynapi_entity_data(entity, "row_heights");
|
|
2613
2894
|
const rowHeightArr = libredwg.dwg_ptr_to_double_array(
|
|
2614
2895
|
row_heights_ptr,
|
|
2615
2896
|
rowCount
|
|
2616
2897
|
);
|
|
2617
|
-
const col_widths_ptr = libredwg.
|
|
2618
|
-
entity,
|
|
2619
|
-
"col_widths"
|
|
2620
|
-
).data;
|
|
2898
|
+
const col_widths_ptr = libredwg.dwg_dynapi_entity_data(entity, "col_widths");
|
|
2621
2899
|
const columnWidthArr = libredwg.dwg_ptr_to_double_array(
|
|
2622
2900
|
col_widths_ptr,
|
|
2623
2901
|
columnCount
|
|
2624
2902
|
);
|
|
2625
|
-
const table_style_ref = libredwg.
|
|
2626
|
-
|
|
2627
|
-
|
|
2628
|
-
)
|
|
2629
|
-
const
|
|
2630
|
-
|
|
2631
|
-
);
|
|
2632
|
-
const
|
|
2633
|
-
|
|
2634
|
-
|
|
2635
|
-
).data;
|
|
2636
|
-
const blockRecordHandle = idToString(
|
|
2637
|
-
libredwg.dwg_ref_get_absref(block_header_ref)
|
|
2638
|
-
);
|
|
2639
|
-
const overrideFlag = libredwg.dwg_dynapi_entity_value(
|
|
2640
|
-
entity,
|
|
2641
|
-
"table_flag_override"
|
|
2642
|
-
).data;
|
|
2643
|
-
const borderColorOverrideFlag = libredwg.dwg_dynapi_entity_value(
|
|
2644
|
-
entity,
|
|
2645
|
-
"border_color_overrides_flag"
|
|
2646
|
-
).data;
|
|
2647
|
-
const borderLineWeightOverrideFlag = libredwg.dwg_dynapi_entity_value(
|
|
2648
|
-
entity,
|
|
2649
|
-
"border_lineweight_overrides_flag"
|
|
2650
|
-
).data;
|
|
2651
|
-
const borderVisibilityOverrideFlag = libredwg.dwg_dynapi_entity_value(
|
|
2652
|
-
entity,
|
|
2653
|
-
"border_visibility_overrides_flag"
|
|
2654
|
-
).data;
|
|
2655
|
-
const num_cells = libredwg.dwg_dynapi_entity_value(entity, "num_cells").data;
|
|
2656
|
-
const cells_ptr = libredwg.dwg_dynapi_entity_value(entity, "cells").data;
|
|
2903
|
+
const table_style_ref = libredwg.dwg_dynapi_entity_data(entity, "tablestyle");
|
|
2904
|
+
const tableStyleId = libredwg.dwg_ref_get_id(table_style_ref) ?? "";
|
|
2905
|
+
const block_header_ref = libredwg.dwg_dynapi_entity_data(entity, "block_header");
|
|
2906
|
+
const blockRecordHandle = libredwg.dwg_ref_get_id(block_header_ref) ?? "";
|
|
2907
|
+
const overrideFlag = libredwg.dwg_dynapi_entity_data(entity, "table_flag_override");
|
|
2908
|
+
const borderColorOverrideFlag = libredwg.dwg_dynapi_entity_data(entity, "border_color_overrides_flag");
|
|
2909
|
+
const borderLineWeightOverrideFlag = libredwg.dwg_dynapi_entity_data(entity, "border_lineweight_overrides_flag");
|
|
2910
|
+
const borderVisibilityOverrideFlag = libredwg.dwg_dynapi_entity_data(entity, "border_visibility_overrides_flag");
|
|
2911
|
+
const num_cells = libredwg.dwg_dynapi_entity_data(entity, "num_cells");
|
|
2912
|
+
const cells_ptr = libredwg.dwg_dynapi_entity_data(entity, "cells");
|
|
2657
2913
|
const cells = libredwg.dwg_ptr_to_table_cell_array(cells_ptr, num_cells);
|
|
2658
2914
|
return {
|
|
2659
2915
|
type: "ACAD_TABLE",
|
|
@@ -2712,28 +2968,19 @@ class LibreEntityConverter {
|
|
|
2712
2968
|
}
|
|
2713
2969
|
convertTextBase(entity) {
|
|
2714
2970
|
const libredwg = this.libredwg;
|
|
2715
|
-
const text = libredwg.
|
|
2716
|
-
const thickness = libredwg.
|
|
2717
|
-
const startPoint = libredwg.
|
|
2718
|
-
const endPoint = libredwg.
|
|
2719
|
-
const rotation = libredwg.
|
|
2720
|
-
const textHeight = libredwg.
|
|
2721
|
-
const xScale = libredwg.
|
|
2722
|
-
const obliqueAngle = libredwg.
|
|
2723
|
-
entity,
|
|
2724
|
-
"oblique_angle"
|
|
2725
|
-
).data;
|
|
2971
|
+
const text = libredwg.dwg_dynapi_entity_data(entity, "text_value");
|
|
2972
|
+
const thickness = libredwg.dwg_dynapi_entity_data(entity, "thickness");
|
|
2973
|
+
const startPoint = libredwg.dwg_dynapi_entity_data(entity, "ins_pt");
|
|
2974
|
+
const endPoint = libredwg.dwg_dynapi_entity_data(entity, "alignment_pt");
|
|
2975
|
+
const rotation = libredwg.dwg_dynapi_entity_data(entity, "rotation");
|
|
2976
|
+
const textHeight = libredwg.dwg_dynapi_entity_data(entity, "height");
|
|
2977
|
+
const xScale = libredwg.dwg_dynapi_entity_data(entity, "width_factor");
|
|
2978
|
+
const obliqueAngle = libredwg.dwg_dynapi_entity_data(entity, "oblique_angle");
|
|
2726
2979
|
const styleName = libredwg.dwg_entity_text_get_style_name(entity);
|
|
2727
|
-
const generationFlag = libredwg.
|
|
2728
|
-
|
|
2729
|
-
|
|
2730
|
-
)
|
|
2731
|
-
const halign = libredwg.dwg_dynapi_entity_value(entity, "horiz_alignment").data;
|
|
2732
|
-
const valign = libredwg.dwg_dynapi_entity_value(entity, "vert_alignment").data;
|
|
2733
|
-
const extrusionDirection = libredwg.dwg_dynapi_entity_value(
|
|
2734
|
-
entity,
|
|
2735
|
-
"extrusion"
|
|
2736
|
-
).data;
|
|
2980
|
+
const generationFlag = libredwg.dwg_dynapi_entity_data(entity, "generation");
|
|
2981
|
+
const halign = libredwg.dwg_dynapi_entity_data(entity, "horiz_alignment");
|
|
2982
|
+
const valign = libredwg.dwg_dynapi_entity_data(entity, "vert_alignment");
|
|
2983
|
+
const extrusionDirection = libredwg.dwg_dynapi_entity_data(entity, "extrusion");
|
|
2737
2984
|
return {
|
|
2738
2985
|
text,
|
|
2739
2986
|
thickness,
|
|
@@ -2759,16 +3006,10 @@ class LibreEntityConverter {
|
|
|
2759
3006
|
}
|
|
2760
3007
|
convertTolerance(entity, commonAttrs) {
|
|
2761
3008
|
const libredwg = this.libredwg;
|
|
2762
|
-
const insertionPoint = libredwg.
|
|
2763
|
-
const text = libredwg.
|
|
2764
|
-
const xAxisDirection = libredwg.
|
|
2765
|
-
|
|
2766
|
-
"x_direction"
|
|
2767
|
-
).data;
|
|
2768
|
-
const extrusionDirection = libredwg.dwg_dynapi_entity_value(
|
|
2769
|
-
entity,
|
|
2770
|
-
"extrusion"
|
|
2771
|
-
).data;
|
|
3009
|
+
const insertionPoint = libredwg.dwg_dynapi_entity_data(entity, "ins_pt");
|
|
3010
|
+
const text = libredwg.dwg_dynapi_entity_data(entity, "text_value");
|
|
3011
|
+
const xAxisDirection = libredwg.dwg_dynapi_entity_data(entity, "x_direction");
|
|
3012
|
+
const extrusionDirection = libredwg.dwg_dynapi_entity_data(entity, "extrusion");
|
|
2772
3013
|
const dimStyleName = libredwg.dwg_entity_get_dimstyle_name(entity);
|
|
2773
3014
|
return {
|
|
2774
3015
|
type: "TOLERANCE",
|
|
@@ -2782,83 +3023,50 @@ class LibreEntityConverter {
|
|
|
2782
3023
|
}
|
|
2783
3024
|
convertViewport(entity, commonAttrs) {
|
|
2784
3025
|
const libredwg = this.libredwg;
|
|
2785
|
-
const viewportCenter = libredwg.
|
|
2786
|
-
const width = libredwg.
|
|
2787
|
-
const height = libredwg.
|
|
2788
|
-
const status = libredwg.
|
|
2789
|
-
const displayCenter = libredwg.
|
|
2790
|
-
const snapBase = libredwg.
|
|
2791
|
-
const snapSpacing = libredwg.
|
|
2792
|
-
const gridSpacing = libredwg.
|
|
2793
|
-
const viewDirection = libredwg.
|
|
2794
|
-
const targetPoint = libredwg.
|
|
2795
|
-
const perspectiveLensLength = libredwg.
|
|
2796
|
-
|
|
2797
|
-
|
|
2798
|
-
)
|
|
2799
|
-
const
|
|
2800
|
-
const
|
|
2801
|
-
const
|
|
2802
|
-
const
|
|
2803
|
-
const
|
|
2804
|
-
|
|
2805
|
-
|
|
2806
|
-
)
|
|
2807
|
-
const
|
|
2808
|
-
|
|
2809
|
-
|
|
2810
|
-
)
|
|
2811
|
-
const
|
|
2812
|
-
|
|
2813
|
-
|
|
2814
|
-
)
|
|
2815
|
-
const
|
|
2816
|
-
const
|
|
2817
|
-
const
|
|
2818
|
-
const
|
|
2819
|
-
const
|
|
2820
|
-
const
|
|
2821
|
-
const
|
|
2822
|
-
const
|
|
2823
|
-
const
|
|
2824
|
-
const
|
|
2825
|
-
const
|
|
2826
|
-
|
|
2827
|
-
|
|
2828
|
-
)
|
|
2829
|
-
const elevation = libredwg.dwg_dynapi_entity_value(entity, "ucs_elevation").data;
|
|
2830
|
-
const shadePlotMode = libredwg.dwg_dynapi_entity_value(
|
|
2831
|
-
entity,
|
|
2832
|
-
"shadeplot_mode"
|
|
2833
|
-
).data;
|
|
2834
|
-
const isDefaultLighting = libredwg.dwg_dynapi_entity_value(
|
|
2835
|
-
entity,
|
|
2836
|
-
"use_default_lights"
|
|
2837
|
-
).data;
|
|
2838
|
-
const defaultLightingType = libredwg.dwg_dynapi_entity_value(
|
|
2839
|
-
entity,
|
|
2840
|
-
"default_lighting_type"
|
|
2841
|
-
).data;
|
|
2842
|
-
const brightness = libredwg.dwg_dynapi_entity_value(entity, "brightness").data;
|
|
2843
|
-
const contrast = libredwg.dwg_dynapi_entity_value(entity, "contrast").data;
|
|
2844
|
-
const majorGridFrequency = libredwg.dwg_dynapi_entity_value(
|
|
2845
|
-
entity,
|
|
2846
|
-
"grid_major"
|
|
2847
|
-
).data;
|
|
2848
|
-
const background_ref = libredwg.dwg_dynapi_entity_value(
|
|
2849
|
-
entity,
|
|
2850
|
-
"background"
|
|
2851
|
-
).data;
|
|
2852
|
-
const backgroundId = libredwg.dwg_ref_get_absref(background_ref);
|
|
2853
|
-
const shadeplot_ref = libredwg.dwg_dynapi_entity_value(entity, "shadeplot").data;
|
|
2854
|
-
const shadePlotId = libredwg.dwg_ref_get_absref(shadeplot_ref);
|
|
2855
|
-
const visualstyle_ref = libredwg.dwg_dynapi_entity_value(
|
|
2856
|
-
entity,
|
|
2857
|
-
"visualstyle"
|
|
2858
|
-
).data;
|
|
2859
|
-
const visualStyleId = libredwg.dwg_ref_get_absref(visualstyle_ref);
|
|
2860
|
-
const sun_ref = libredwg.dwg_dynapi_entity_value(entity, "sun").data;
|
|
2861
|
-
const sunId = libredwg.dwg_ref_get_absref(sun_ref);
|
|
3026
|
+
const viewportCenter = libredwg.dwg_dynapi_entity_data(entity, "center");
|
|
3027
|
+
const width = libredwg.dwg_dynapi_entity_data(entity, "width");
|
|
3028
|
+
const height = libredwg.dwg_dynapi_entity_data(entity, "height");
|
|
3029
|
+
const status = libredwg.dwg_dynapi_entity_data(entity, "on_off");
|
|
3030
|
+
const displayCenter = libredwg.dwg_dynapi_entity_data(entity, "VIEWCTR");
|
|
3031
|
+
const snapBase = libredwg.dwg_dynapi_entity_data(entity, "SNAPBASE");
|
|
3032
|
+
const snapSpacing = libredwg.dwg_dynapi_entity_data(entity, "SNAPUNIT");
|
|
3033
|
+
const gridSpacing = libredwg.dwg_dynapi_entity_data(entity, "GRIDUNIT");
|
|
3034
|
+
const viewDirection = libredwg.dwg_dynapi_entity_data(entity, "VIEWDIR");
|
|
3035
|
+
const targetPoint = libredwg.dwg_dynapi_entity_data(entity, "view_target");
|
|
3036
|
+
const perspectiveLensLength = libredwg.dwg_dynapi_entity_data(entity, "lens_length");
|
|
3037
|
+
const frontClipZ = libredwg.dwg_dynapi_entity_data(entity, "front_clip_z");
|
|
3038
|
+
const backClipZ = libredwg.dwg_dynapi_entity_data(entity, "back_clip_z");
|
|
3039
|
+
const viewHeight = libredwg.dwg_dynapi_entity_data(entity, "VIEWSIZE");
|
|
3040
|
+
const snapAngle = libredwg.dwg_dynapi_entity_data(entity, "SNAPANG");
|
|
3041
|
+
const viewTwistAngle = libredwg.dwg_dynapi_entity_data(entity, "twist_angle");
|
|
3042
|
+
const circleZoomPercent = libredwg.dwg_dynapi_entity_data(entity, "circle_zoom");
|
|
3043
|
+
const statusBitFlags = libredwg.dwg_dynapi_entity_data(entity, "status_flag");
|
|
3044
|
+
const sheetName = libredwg.dwg_dynapi_entity_data(entity, "style_sheet");
|
|
3045
|
+
const renderMode = libredwg.dwg_dynapi_entity_data(entity, "render_mode");
|
|
3046
|
+
const ucsPerViewport = libredwg.dwg_dynapi_entity_data(entity, "UCSVP");
|
|
3047
|
+
const ucsOrigin = libredwg.dwg_dynapi_entity_data(entity, "ucsorg");
|
|
3048
|
+
const ucsXAxis = libredwg.dwg_dynapi_entity_data(entity, "ucsxdir");
|
|
3049
|
+
const ucsYAxis = libredwg.dwg_dynapi_entity_data(entity, "ucsydir");
|
|
3050
|
+
const named_ucs_ref = libredwg.dwg_dynapi_entity_data(entity, "named_ucs");
|
|
3051
|
+
const ucsId = libredwg.dwg_ref_get_id(named_ucs_ref);
|
|
3052
|
+
const base_ucs_ref = libredwg.dwg_dynapi_entity_data(entity, "base_ucs");
|
|
3053
|
+
const ucsBaseId = libredwg.dwg_ref_get_id(base_ucs_ref);
|
|
3054
|
+
const orthographicType = libredwg.dwg_dynapi_entity_data(entity, "UCSORTHOVIEW");
|
|
3055
|
+
const elevation = libredwg.dwg_dynapi_entity_data(entity, "ucs_elevation");
|
|
3056
|
+
const shadePlotMode = libredwg.dwg_dynapi_entity_data(entity, "shadeplot_mode");
|
|
3057
|
+
const isDefaultLighting = libredwg.dwg_dynapi_entity_data(entity, "use_default_lights");
|
|
3058
|
+
const defaultLightingType = libredwg.dwg_dynapi_entity_data(entity, "default_lighting_type");
|
|
3059
|
+
const brightness = libredwg.dwg_dynapi_entity_data(entity, "brightness");
|
|
3060
|
+
const contrast = libredwg.dwg_dynapi_entity_data(entity, "contrast");
|
|
3061
|
+
const majorGridFrequency = libredwg.dwg_dynapi_entity_data(entity, "grid_major");
|
|
3062
|
+
const background_ref = libredwg.dwg_dynapi_entity_data(entity, "background");
|
|
3063
|
+
const backgroundId = libredwg.dwg_ref_get_id(background_ref);
|
|
3064
|
+
const shadeplot_ref = libredwg.dwg_dynapi_entity_data(entity, "shadeplot");
|
|
3065
|
+
const shadePlotId = libredwg.dwg_ref_get_id(shadeplot_ref);
|
|
3066
|
+
const visualstyle_ref = libredwg.dwg_dynapi_entity_data(entity, "visualstyle");
|
|
3067
|
+
const visualStyleId = libredwg.dwg_ref_get_id(visualstyle_ref);
|
|
3068
|
+
const sun_ref = libredwg.dwg_dynapi_entity_data(entity, "sun");
|
|
3069
|
+
const sunId = libredwg.dwg_ref_get_id(sun_ref);
|
|
2862
3070
|
return {
|
|
2863
3071
|
type: "VIEWPORT",
|
|
2864
3072
|
...commonAttrs,
|
|
@@ -2888,55 +3096,46 @@ class LibreEntityConverter {
|
|
|
2888
3096
|
ucsOrigin,
|
|
2889
3097
|
ucsXAxis,
|
|
2890
3098
|
ucsYAxis,
|
|
2891
|
-
ucsId:
|
|
2892
|
-
ucsBaseId:
|
|
3099
|
+
ucsId: ucsId ?? "",
|
|
3100
|
+
ucsBaseId: ucsBaseId ?? "",
|
|
2893
3101
|
orthographicType,
|
|
2894
3102
|
elevation,
|
|
2895
3103
|
shadePlotMode,
|
|
2896
3104
|
majorGridFrequency,
|
|
2897
|
-
backgroundId:
|
|
2898
|
-
shadePlotId:
|
|
2899
|
-
visualStyleId:
|
|
3105
|
+
backgroundId: backgroundId ?? "",
|
|
3106
|
+
shadePlotId: shadePlotId ?? "",
|
|
3107
|
+
visualStyleId: visualStyleId ?? "",
|
|
2900
3108
|
isDefaultLighting: !!isDefaultLighting,
|
|
2901
3109
|
defaultLightingType,
|
|
2902
3110
|
brightness,
|
|
2903
3111
|
contrast,
|
|
2904
|
-
sunId:
|
|
3112
|
+
sunId: sunId ?? ""
|
|
2905
3113
|
};
|
|
2906
3114
|
}
|
|
2907
3115
|
convertWipeout(entity, commonAttrs) {
|
|
2908
3116
|
const libredwg = this.libredwg;
|
|
2909
|
-
const version = libredwg.
|
|
2910
|
-
const position = libredwg.
|
|
2911
|
-
const uPixel = libredwg.
|
|
2912
|
-
const vPixel = libredwg.
|
|
2913
|
-
const imageSize = libredwg.
|
|
2914
|
-
const flags = libredwg.
|
|
2915
|
-
const clipping = libredwg.
|
|
2916
|
-
const brightness = libredwg.
|
|
2917
|
-
const contrast = libredwg.
|
|
2918
|
-
const fade = libredwg.
|
|
2919
|
-
const clipMode = libredwg.
|
|
2920
|
-
const clippingBoundaryType = libredwg.
|
|
2921
|
-
|
|
2922
|
-
|
|
2923
|
-
).data;
|
|
2924
|
-
const countBoundaryPoints = libredwg.dwg_dynapi_entity_value(
|
|
2925
|
-
entity,
|
|
2926
|
-
"num_clip_verts"
|
|
2927
|
-
).data;
|
|
2928
|
-
const clip_verts = libredwg.dwg_dynapi_entity_value(entity, "clip_verts").data;
|
|
3117
|
+
const version = libredwg.dwg_dynapi_entity_data(entity, "class_version");
|
|
3118
|
+
const position = libredwg.dwg_dynapi_entity_data(entity, "pt0");
|
|
3119
|
+
const uPixel = libredwg.dwg_dynapi_entity_data(entity, "uvec");
|
|
3120
|
+
const vPixel = libredwg.dwg_dynapi_entity_data(entity, "vvec");
|
|
3121
|
+
const imageSize = libredwg.dwg_dynapi_entity_data(entity, "image_size");
|
|
3122
|
+
const flags = libredwg.dwg_dynapi_entity_data(entity, "display_props");
|
|
3123
|
+
const clipping = libredwg.dwg_dynapi_entity_data(entity, "clipping");
|
|
3124
|
+
const brightness = libredwg.dwg_dynapi_entity_data(entity, "brightness");
|
|
3125
|
+
const contrast = libredwg.dwg_dynapi_entity_data(entity, "contrast");
|
|
3126
|
+
const fade = libredwg.dwg_dynapi_entity_data(entity, "fade");
|
|
3127
|
+
const clipMode = libredwg.dwg_dynapi_entity_data(entity, "clip_mode");
|
|
3128
|
+
const clippingBoundaryType = libredwg.dwg_dynapi_entity_data(entity, "clip_boundary_type");
|
|
3129
|
+
const countBoundaryPoints = libredwg.dwg_dynapi_entity_data(entity, "num_clip_verts");
|
|
3130
|
+
const clip_verts = libredwg.dwg_dynapi_entity_data(entity, "clip_verts");
|
|
2929
3131
|
const clippingBoundaryPath = libredwg.dwg_ptr_to_point2d_array(
|
|
2930
3132
|
clip_verts,
|
|
2931
3133
|
countBoundaryPoints
|
|
2932
3134
|
);
|
|
2933
|
-
const imagedef_ref = libredwg.
|
|
2934
|
-
const imageDefHandle = libredwg.dwg_ref_get_absref(imagedef_ref);
|
|
2935
|
-
const imagedefreactor_ref = libredwg.
|
|
2936
|
-
|
|
2937
|
-
"imagedefreactor"
|
|
2938
|
-
).data;
|
|
2939
|
-
const imageDefReactorHandle = libredwg.dwg_ref_get_absref(imagedefreactor_ref);
|
|
3135
|
+
const imagedef_ref = libredwg.dwg_dynapi_entity_data(entity, "imagedef");
|
|
3136
|
+
const imageDefHandle = libredwg.dwg_ref_get_absref(imagedef_ref) ?? 0;
|
|
3137
|
+
const imagedefreactor_ref = libredwg.dwg_dynapi_entity_data(entity, "imagedefreactor");
|
|
3138
|
+
const imageDefReactorHandle = libredwg.dwg_ref_get_absref(imagedefreactor_ref) ?? 0;
|
|
2940
3139
|
return {
|
|
2941
3140
|
type: "WIPEOUT",
|
|
2942
3141
|
...commonAttrs,
|
|
@@ -2960,8 +3159,8 @@ class LibreEntityConverter {
|
|
|
2960
3159
|
}
|
|
2961
3160
|
convertXline(entity, commonAttrs) {
|
|
2962
3161
|
const libredwg = this.libredwg;
|
|
2963
|
-
const firstPoint = libredwg.
|
|
2964
|
-
const unitDirection = libredwg.
|
|
3162
|
+
const firstPoint = libredwg.dwg_dynapi_entity_data(entity, "point");
|
|
3163
|
+
const unitDirection = libredwg.dwg_dynapi_entity_data(entity, "vector");
|
|
2965
3164
|
return {
|
|
2966
3165
|
type: "XLINE",
|
|
2967
3166
|
...commonAttrs,
|
|
@@ -2971,37 +3170,19 @@ class LibreEntityConverter {
|
|
|
2971
3170
|
}
|
|
2972
3171
|
getDimensionCommonAttrs(entity) {
|
|
2973
3172
|
const libredwg = this.libredwg;
|
|
2974
|
-
const version = libredwg.
|
|
3173
|
+
const version = libredwg.dwg_dynapi_entity_data(entity, "class_version");
|
|
2975
3174
|
const name = libredwg.dwg_entity_get_block_name(entity, "block");
|
|
2976
|
-
const definitionPoint = libredwg.
|
|
2977
|
-
const textPoint = libredwg.
|
|
2978
|
-
const attachmentPoint = libredwg.
|
|
2979
|
-
|
|
2980
|
-
|
|
2981
|
-
)
|
|
2982
|
-
const
|
|
2983
|
-
const
|
|
2984
|
-
|
|
2985
|
-
|
|
2986
|
-
)
|
|
2987
|
-
const textLineSpacingFactor = libredwg.dwg_dynapi_entity_value(
|
|
2988
|
-
entity,
|
|
2989
|
-
"lspace_factor"
|
|
2990
|
-
).data;
|
|
2991
|
-
const measurement = libredwg.dwg_dynapi_entity_value(
|
|
2992
|
-
entity,
|
|
2993
|
-
"act_measurement"
|
|
2994
|
-
).data;
|
|
2995
|
-
const text = libredwg.dwg_dynapi_entity_value(entity, "user_text").data;
|
|
2996
|
-
const textRotation = libredwg.dwg_dynapi_entity_value(
|
|
2997
|
-
entity,
|
|
2998
|
-
"text_rotation"
|
|
2999
|
-
).data;
|
|
3000
|
-
const ocsRotation = libredwg.dwg_dynapi_entity_value(entity, "ins_rotation").data;
|
|
3001
|
-
const extrusionDirection = libredwg.dwg_dynapi_entity_value(
|
|
3002
|
-
entity,
|
|
3003
|
-
"extrusion"
|
|
3004
|
-
).data;
|
|
3175
|
+
const definitionPoint = libredwg.dwg_dynapi_entity_data(entity, "def_pt");
|
|
3176
|
+
const textPoint = libredwg.dwg_dynapi_entity_data(entity, "text_midpt");
|
|
3177
|
+
const attachmentPoint = libredwg.dwg_dynapi_entity_data(entity, "attachmentPoint");
|
|
3178
|
+
const dimensionType = libredwg.dwg_dynapi_entity_data(entity, "flag");
|
|
3179
|
+
const textLineSpacingStyle = libredwg.dwg_dynapi_entity_data(entity, "lspace_factor");
|
|
3180
|
+
const textLineSpacingFactor = libredwg.dwg_dynapi_entity_data(entity, "lspace_factor");
|
|
3181
|
+
const measurement = libredwg.dwg_dynapi_entity_data(entity, "act_measurement");
|
|
3182
|
+
const text = libredwg.dwg_dynapi_entity_data(entity, "user_text");
|
|
3183
|
+
const textRotation = libredwg.dwg_dynapi_entity_data(entity, "text_rotation");
|
|
3184
|
+
const ocsRotation = libredwg.dwg_dynapi_entity_data(entity, "ins_rotation");
|
|
3185
|
+
const extrusionDirection = libredwg.dwg_dynapi_entity_data(entity, "extrusion");
|
|
3005
3186
|
const styleName = libredwg.dwg_entity_get_dimstyle_name(entity);
|
|
3006
3187
|
return {
|
|
3007
3188
|
type: "DIMENSION",
|
|
@@ -3106,6 +3287,7 @@ class LibreDwgConverter {
|
|
|
3106
3287
|
DICTIONARY: [],
|
|
3107
3288
|
IMAGEDEF: [],
|
|
3108
3289
|
LAYOUT: [],
|
|
3290
|
+
MLEADERSTYLE: [],
|
|
3109
3291
|
SPATIAL_FILTER: []
|
|
3110
3292
|
},
|
|
3111
3293
|
header: {},
|
|
@@ -3186,6 +3368,9 @@ class LibreDwgConverter {
|
|
|
3186
3368
|
case Dwg_Object_Type.DWG_TYPE_LAYOUT:
|
|
3187
3369
|
db.objects.LAYOUT.push(this.convertLayout(tio, obj));
|
|
3188
3370
|
break;
|
|
3371
|
+
case Dwg_Object_Type.DWG_TYPE_MLEADERSTYLE:
|
|
3372
|
+
db.objects.MLEADERSTYLE.push(this.convertMLeaderStyle(tio, obj));
|
|
3373
|
+
break;
|
|
3189
3374
|
case Dwg_Object_Type.DWG_TYPE_SPATIAL_FILTER:
|
|
3190
3375
|
db.objects.SPATIAL_FILTER.push(
|
|
3191
3376
|
this.convertSpatialFilter(tio, obj)
|
|
@@ -3232,11 +3417,11 @@ class LibreDwgConverter {
|
|
|
3232
3417
|
if (name == "DIMBLK" || name == "DIMBLK1" || name == "DIMBLK2") {
|
|
3233
3418
|
var_name = var_name + "_T";
|
|
3234
3419
|
}
|
|
3235
|
-
let value = libredwg.
|
|
3420
|
+
let value = libredwg.dwg_dynapi_header_data(data, var_name);
|
|
3236
3421
|
if (name == "CELTYPE" || name == "CLAYER" || name == "CLAYER" || name == "DIMSTYLE" || name == "DIMTXSTY" || name == "TEXTSTYLE") {
|
|
3237
3422
|
value = value ? libredwg.dwg_ref_get_object_name(value) : "";
|
|
3238
3423
|
} else if (name == "DRAGVS") {
|
|
3239
|
-
value = value ? libredwg.dwg_ref_get_absref(value) : 2;
|
|
3424
|
+
value = value ? libredwg.dwg_ref_get_absref(value) ?? 2 : 2;
|
|
3240
3425
|
}
|
|
3241
3426
|
header[name] = value;
|
|
3242
3427
|
});
|
|
@@ -3261,8 +3446,8 @@ class LibreDwgConverter {
|
|
|
3261
3446
|
}
|
|
3262
3447
|
convertAppId(item) {
|
|
3263
3448
|
const libredwg = this.libredwg;
|
|
3264
|
-
const name = libredwg.
|
|
3265
|
-
const flag = libredwg.
|
|
3449
|
+
const name = libredwg.dwg_dynapi_entity_data(item, "name");
|
|
3450
|
+
const flag = libredwg.dwg_dynapi_entity_data(item, "flag");
|
|
3266
3451
|
return {
|
|
3267
3452
|
name,
|
|
3268
3453
|
standardFlag: flag
|
|
@@ -3275,18 +3460,15 @@ class LibreDwgConverter {
|
|
|
3275
3460
|
if (block.name) {
|
|
3276
3461
|
commonAttrs.name = block.name;
|
|
3277
3462
|
}
|
|
3278
|
-
const num_owned = libredwg.
|
|
3279
|
-
const flags = libredwg.
|
|
3280
|
-
const description = libredwg.
|
|
3281
|
-
const basePoint = libredwg.
|
|
3282
|
-
const insertionUnits = libredwg.
|
|
3283
|
-
|
|
3284
|
-
|
|
3285
|
-
)
|
|
3286
|
-
const
|
|
3287
|
-
const scalability = libredwg.dwg_dynapi_entity_value(item, "block_scaling").data;
|
|
3288
|
-
const layout_ptr = libredwg.dwg_dynapi_entity_value(item, "layout").data;
|
|
3289
|
-
const layout = idToString(libredwg.dwg_ref_get_absref(layout_ptr));
|
|
3463
|
+
const num_owned = libredwg.dwg_dynapi_entity_data(item, "num_owned");
|
|
3464
|
+
const flags = libredwg.dwg_dynapi_entity_data(item, "flag");
|
|
3465
|
+
const description = libredwg.dwg_dynapi_entity_data(item, "description");
|
|
3466
|
+
const basePoint = libredwg.dwg_dynapi_entity_data(item, "base_pt");
|
|
3467
|
+
const insertionUnits = libredwg.dwg_dynapi_entity_data(item, "insert_units");
|
|
3468
|
+
const explodability = libredwg.dwg_dynapi_entity_data(item, "explodable");
|
|
3469
|
+
const scalability = libredwg.dwg_dynapi_entity_data(item, "block_scaling");
|
|
3470
|
+
const layout_ptr = libredwg.dwg_dynapi_entity_data(item, "layout");
|
|
3471
|
+
const layout = libredwg.dwg_ref_get_id(layout_ptr) ?? "";
|
|
3290
3472
|
let bmpPreview = "";
|
|
3291
3473
|
const uint8ArrayToHexString2 = (bytes) => {
|
|
3292
3474
|
const hexChars = new Array(bytes.length);
|
|
@@ -3302,7 +3484,7 @@ class LibreDwgConverter {
|
|
|
3302
3484
|
let entities = this.convertEntities(obj, commonAttrs.handle);
|
|
3303
3485
|
if (!entities || entities.length == 0) {
|
|
3304
3486
|
entities = [];
|
|
3305
|
-
const entities_ptr = libredwg.
|
|
3487
|
+
const entities_ptr = libredwg.dwg_dynapi_entity_data(item, "entities");
|
|
3306
3488
|
if (entities_ptr) {
|
|
3307
3489
|
const object_ref_ptr_array = libredwg.dwg_ptr_to_object_ref_ptr_array(
|
|
3308
3490
|
entities_ptr,
|
|
@@ -3352,91 +3534,88 @@ class LibreDwgConverter {
|
|
|
3352
3534
|
convertDimStyle(item, obj) {
|
|
3353
3535
|
const libredwg = this.libredwg;
|
|
3354
3536
|
const commonAttrs = this.getCommonTableEntryAttrs(item, obj);
|
|
3355
|
-
const DIMTOL = libredwg.
|
|
3356
|
-
const DIMLIM = libredwg.
|
|
3357
|
-
const DIMTIH = libredwg.
|
|
3358
|
-
const DIMTOH = libredwg.
|
|
3359
|
-
const DIMSE1 = libredwg.
|
|
3360
|
-
const DIMSE2 = libredwg.
|
|
3361
|
-
const DIMALT = libredwg.
|
|
3362
|
-
const DIMTOFL = libredwg.
|
|
3363
|
-
const DIMSAH = libredwg.
|
|
3364
|
-
const DIMTIX = libredwg.
|
|
3365
|
-
const DIMSOXD = libredwg.
|
|
3366
|
-
const DIMALTD = libredwg.
|
|
3367
|
-
const DIMZIN = libredwg.
|
|
3368
|
-
const DIMSD1 = libredwg.
|
|
3369
|
-
const DIMSD2 = libredwg.
|
|
3370
|
-
const DIMTOLJ = libredwg.
|
|
3371
|
-
const DIMJUST = libredwg.
|
|
3372
|
-
const DIMFIT = libredwg.
|
|
3373
|
-
const DIMUPT = libredwg.
|
|
3374
|
-
const DIMTZIN = libredwg.
|
|
3375
|
-
const DIMALTZ = libredwg.
|
|
3376
|
-
const DIMALTTZ = libredwg.
|
|
3377
|
-
const DIMTAD = libredwg.
|
|
3378
|
-
const DIMUNIT = libredwg.
|
|
3379
|
-
const DIMAUNIT = libredwg.
|
|
3380
|
-
const DIMDEC = libredwg.
|
|
3381
|
-
const DIMTDEC = libredwg.
|
|
3382
|
-
const DIMALTU = libredwg.
|
|
3383
|
-
const DIMALTTD = libredwg.
|
|
3384
|
-
const DIMSCALE = libredwg.
|
|
3385
|
-
const DIMASZ = libredwg.
|
|
3386
|
-
const DIMEXO = libredwg.
|
|
3387
|
-
const DIMDLI = libredwg.
|
|
3388
|
-
const DIMEXE = libredwg.
|
|
3389
|
-
const DIMRND = libredwg.
|
|
3390
|
-
const DIMDLE = libredwg.
|
|
3391
|
-
const DIMTP = libredwg.
|
|
3392
|
-
const DIMTM = libredwg.
|
|
3393
|
-
const DIMFXL = libredwg.
|
|
3394
|
-
const DIMJOGANG = libredwg.
|
|
3395
|
-
const DIMTFILL = libredwg.
|
|
3396
|
-
const DIMTFILLCLR = libredwg.
|
|
3397
|
-
const DIMAZIN = libredwg.
|
|
3398
|
-
const DIMARCSYM = libredwg.
|
|
3399
|
-
const DIMTXT = libredwg.
|
|
3400
|
-
const DIMCEN = libredwg.
|
|
3401
|
-
const DIMTSZ = libredwg.
|
|
3402
|
-
const DIMALTF = libredwg.
|
|
3403
|
-
const DIMLFAC = libredwg.
|
|
3404
|
-
const DIMTVP = libredwg.
|
|
3405
|
-
const DIMTFAC = libredwg.
|
|
3406
|
-
const DIMGAP = libredwg.
|
|
3407
|
-
const DIMPOST = libredwg.
|
|
3408
|
-
const DIMAPOST = libredwg.
|
|
3409
|
-
const DIMBLK_T = libredwg.
|
|
3410
|
-
const DIMBLK1_T = libredwg.
|
|
3411
|
-
const DIMBLK2_T = libredwg.
|
|
3412
|
-
const DIMALTRND = libredwg.
|
|
3413
|
-
const DIMCLRD_N = libredwg.
|
|
3414
|
-
const DIMCLRE_N = libredwg.
|
|
3415
|
-
const DIMCLRT_N = libredwg.
|
|
3416
|
-
const DIMCLRD = libredwg.
|
|
3417
|
-
const DIMCLRE = libredwg.
|
|
3418
|
-
const DIMCLRT = libredwg.
|
|
3419
|
-
const DIMADEC = libredwg.
|
|
3420
|
-
const DIMFRAC = libredwg.
|
|
3421
|
-
const DIMLUNIT = libredwg.
|
|
3422
|
-
const DIMDSEP = libredwg.
|
|
3423
|
-
const DIMTMOVE = libredwg.
|
|
3424
|
-
const DIMATFIT = libredwg.
|
|
3425
|
-
const DIMFXLON = libredwg.
|
|
3426
|
-
const DIMTXTDIRECTION = libredwg.
|
|
3427
|
-
|
|
3428
|
-
|
|
3429
|
-
)
|
|
3430
|
-
const
|
|
3431
|
-
const
|
|
3432
|
-
const
|
|
3433
|
-
const
|
|
3434
|
-
const
|
|
3435
|
-
const
|
|
3436
|
-
const
|
|
3437
|
-
const DIMTXSTY = libredwg.dwg_ref_get_absref(DIMTXSTY_Ptr);
|
|
3438
|
-
const DIMLDRBLK_Ptr = libredwg.dwg_dynapi_entity_value(item, "DIMLDRBLK").data;
|
|
3439
|
-
const DIMLDRBLK = libredwg.dwg_ref_get_absref(DIMLDRBLK_Ptr);
|
|
3537
|
+
const DIMTOL = libredwg.dwg_dynapi_entity_data(item, "DIMTOL");
|
|
3538
|
+
const DIMLIM = libredwg.dwg_dynapi_entity_data(item, "DIMLIM");
|
|
3539
|
+
const DIMTIH = libredwg.dwg_dynapi_entity_data(item, "DIMTIH");
|
|
3540
|
+
const DIMTOH = libredwg.dwg_dynapi_entity_data(item, "DIMTOH");
|
|
3541
|
+
const DIMSE1 = libredwg.dwg_dynapi_entity_data(item, "DIMSE1");
|
|
3542
|
+
const DIMSE2 = libredwg.dwg_dynapi_entity_data(item, "DIMSE2");
|
|
3543
|
+
const DIMALT = libredwg.dwg_dynapi_entity_data(item, "DIMALT");
|
|
3544
|
+
const DIMTOFL = libredwg.dwg_dynapi_entity_data(item, "DIMTOFL");
|
|
3545
|
+
const DIMSAH = libredwg.dwg_dynapi_entity_data(item, "DIMSAH");
|
|
3546
|
+
const DIMTIX = libredwg.dwg_dynapi_entity_data(item, "DIMTIX");
|
|
3547
|
+
const DIMSOXD = libredwg.dwg_dynapi_entity_data(item, "DIMSOXD");
|
|
3548
|
+
const DIMALTD = libredwg.dwg_dynapi_entity_data(item, "DIMALTD");
|
|
3549
|
+
const DIMZIN = libredwg.dwg_dynapi_entity_data(item, "DIMZIN");
|
|
3550
|
+
const DIMSD1 = libredwg.dwg_dynapi_entity_data(item, "DIMSD1");
|
|
3551
|
+
const DIMSD2 = libredwg.dwg_dynapi_entity_data(item, "DIMSD2");
|
|
3552
|
+
const DIMTOLJ = libredwg.dwg_dynapi_entity_data(item, "DIMTOLJ");
|
|
3553
|
+
const DIMJUST = libredwg.dwg_dynapi_entity_data(item, "DIMJUST");
|
|
3554
|
+
const DIMFIT = libredwg.dwg_dynapi_entity_data(item, "DIMFIT");
|
|
3555
|
+
const DIMUPT = libredwg.dwg_dynapi_entity_data(item, "DIMUPT");
|
|
3556
|
+
const DIMTZIN = libredwg.dwg_dynapi_entity_data(item, "DIMTZIN");
|
|
3557
|
+
const DIMALTZ = libredwg.dwg_dynapi_entity_data(item, "DIMALTZ");
|
|
3558
|
+
const DIMALTTZ = libredwg.dwg_dynapi_entity_data(item, "DIMALTTZ");
|
|
3559
|
+
const DIMTAD = libredwg.dwg_dynapi_entity_data(item, "DIMTAD");
|
|
3560
|
+
const DIMUNIT = libredwg.dwg_dynapi_entity_data(item, "DIMUNIT");
|
|
3561
|
+
const DIMAUNIT = libredwg.dwg_dynapi_entity_data(item, "DIMAUNIT");
|
|
3562
|
+
const DIMDEC = libredwg.dwg_dynapi_entity_data(item, "DIMDEC");
|
|
3563
|
+
const DIMTDEC = libredwg.dwg_dynapi_entity_data(item, "DIMTDEC");
|
|
3564
|
+
const DIMALTU = libredwg.dwg_dynapi_entity_data(item, "DIMALTU");
|
|
3565
|
+
const DIMALTTD = libredwg.dwg_dynapi_entity_data(item, "DIMALTTD");
|
|
3566
|
+
const DIMSCALE = libredwg.dwg_dynapi_entity_data(item, "DIMSCALE");
|
|
3567
|
+
const DIMASZ = libredwg.dwg_dynapi_entity_data(item, "DIMASZ");
|
|
3568
|
+
const DIMEXO = libredwg.dwg_dynapi_entity_data(item, "DIMEXO");
|
|
3569
|
+
const DIMDLI = libredwg.dwg_dynapi_entity_data(item, "DIMDLI");
|
|
3570
|
+
const DIMEXE = libredwg.dwg_dynapi_entity_data(item, "DIMEXE");
|
|
3571
|
+
const DIMRND = libredwg.dwg_dynapi_entity_data(item, "DIMRND");
|
|
3572
|
+
const DIMDLE = libredwg.dwg_dynapi_entity_data(item, "DIMDLE");
|
|
3573
|
+
const DIMTP = libredwg.dwg_dynapi_entity_data(item, "DIMTP");
|
|
3574
|
+
const DIMTM = libredwg.dwg_dynapi_entity_data(item, "DIMTM");
|
|
3575
|
+
const DIMFXL = libredwg.dwg_dynapi_entity_data(item, "DIMFXL");
|
|
3576
|
+
const DIMJOGANG = libredwg.dwg_dynapi_entity_data(item, "DIMJOGANG");
|
|
3577
|
+
const DIMTFILL = libredwg.dwg_dynapi_entity_data(item, "DIMTFILL");
|
|
3578
|
+
const DIMTFILLCLR = libredwg.dwg_dynapi_entity_data(item, "DIMTFILLCLR");
|
|
3579
|
+
const DIMAZIN = libredwg.dwg_dynapi_entity_data(item, "DIMAZIN");
|
|
3580
|
+
const DIMARCSYM = libredwg.dwg_dynapi_entity_data(item, "DIMARCSYM");
|
|
3581
|
+
const DIMTXT = libredwg.dwg_dynapi_entity_data(item, "DIMTXT");
|
|
3582
|
+
const DIMCEN = libredwg.dwg_dynapi_entity_data(item, "DIMCEN");
|
|
3583
|
+
const DIMTSZ = libredwg.dwg_dynapi_entity_data(item, "DIMTSZ");
|
|
3584
|
+
const DIMALTF = libredwg.dwg_dynapi_entity_data(item, "DIMALTF");
|
|
3585
|
+
const DIMLFAC = libredwg.dwg_dynapi_entity_data(item, "DIMLFAC");
|
|
3586
|
+
const DIMTVP = libredwg.dwg_dynapi_entity_data(item, "DIMTVP");
|
|
3587
|
+
const DIMTFAC = libredwg.dwg_dynapi_entity_data(item, "DIMTFAC");
|
|
3588
|
+
const DIMGAP = libredwg.dwg_dynapi_entity_data(item, "DIMGAP");
|
|
3589
|
+
const DIMPOST = libredwg.dwg_dynapi_entity_data(item, "DIMPOST");
|
|
3590
|
+
const DIMAPOST = libredwg.dwg_dynapi_entity_data(item, "DIMAPOST");
|
|
3591
|
+
const DIMBLK_T = libredwg.dwg_dynapi_entity_data(item, "DIMBLK_T");
|
|
3592
|
+
const DIMBLK1_T = libredwg.dwg_dynapi_entity_data(item, "DIMBLK1_T");
|
|
3593
|
+
const DIMBLK2_T = libredwg.dwg_dynapi_entity_data(item, "DIMBLK2_T");
|
|
3594
|
+
const DIMALTRND = libredwg.dwg_dynapi_entity_data(item, "DIMALTRND");
|
|
3595
|
+
const DIMCLRD_N = libredwg.dwg_dynapi_entity_data(item, "DIMCLRD_N");
|
|
3596
|
+
const DIMCLRE_N = libredwg.dwg_dynapi_entity_data(item, "DIMCLRE_N");
|
|
3597
|
+
const DIMCLRT_N = libredwg.dwg_dynapi_entity_data(item, "DIMCLRT_N");
|
|
3598
|
+
const DIMCLRD = libredwg.dwg_dynapi_entity_data(item, "DIMCLRD");
|
|
3599
|
+
const DIMCLRE = libredwg.dwg_dynapi_entity_data(item, "DIMCLRE");
|
|
3600
|
+
const DIMCLRT = libredwg.dwg_dynapi_entity_data(item, "DIMCLRT");
|
|
3601
|
+
const DIMADEC = libredwg.dwg_dynapi_entity_data(item, "DIMADEC");
|
|
3602
|
+
const DIMFRAC = libredwg.dwg_dynapi_entity_data(item, "DIMFRAC");
|
|
3603
|
+
const DIMLUNIT = libredwg.dwg_dynapi_entity_data(item, "DIMLUNIT");
|
|
3604
|
+
const DIMDSEP = libredwg.dwg_dynapi_entity_data(item, "DIMDSEP");
|
|
3605
|
+
const DIMTMOVE = libredwg.dwg_dynapi_entity_data(item, "DIMTMOVE");
|
|
3606
|
+
const DIMATFIT = libredwg.dwg_dynapi_entity_data(item, "DIMATFIT");
|
|
3607
|
+
const DIMFXLON = libredwg.dwg_dynapi_entity_data(item, "DIMFXLON");
|
|
3608
|
+
const DIMTXTDIRECTION = libredwg.dwg_dynapi_entity_data(item, "DIMTXTDIRECTION");
|
|
3609
|
+
const DIMALTMZF = libredwg.dwg_dynapi_entity_data(item, "DIMALTMZF");
|
|
3610
|
+
const DIMALTMZS = libredwg.dwg_dynapi_entity_data(item, "DIMALTMZS");
|
|
3611
|
+
const DIMMZF = libredwg.dwg_dynapi_entity_data(item, "DIMMZF");
|
|
3612
|
+
const DIMMZS = libredwg.dwg_dynapi_entity_data(item, "DIMMZS");
|
|
3613
|
+
const DIMLWD = libredwg.dwg_dynapi_entity_data(item, "DIMLWD");
|
|
3614
|
+
const DIMLWE = libredwg.dwg_dynapi_entity_data(item, "DIMLWE");
|
|
3615
|
+
const DIMTXSTY_Ptr = libredwg.dwg_dynapi_entity_data(item, "DIMTXSTY");
|
|
3616
|
+
const DIMTXSTY = libredwg.dwg_ref_get_absref(DIMTXSTY_Ptr) ?? void 0;
|
|
3617
|
+
const DIMLDRBLK_Ptr = libredwg.dwg_dynapi_entity_data(item, "DIMLDRBLK");
|
|
3618
|
+
const DIMLDRBLK = libredwg.dwg_ref_get_absref(DIMLDRBLK_Ptr) ?? void 0;
|
|
3440
3619
|
return {
|
|
3441
3620
|
...commonAttrs,
|
|
3442
3621
|
DIMPOST,
|
|
@@ -3524,15 +3703,15 @@ class LibreDwgConverter {
|
|
|
3524
3703
|
convertLayer(item, obj) {
|
|
3525
3704
|
const libredwg = this.libredwg;
|
|
3526
3705
|
const commonAttrs = this.getCommonTableEntryAttrs(item, obj);
|
|
3527
|
-
const flag = libredwg.
|
|
3528
|
-
const frozen = libredwg.
|
|
3529
|
-
const off = libredwg.
|
|
3530
|
-
const frozenInNew = libredwg.
|
|
3531
|
-
const locked = libredwg.
|
|
3532
|
-
const plotFlag = libredwg.
|
|
3533
|
-
const linewt = libredwg.
|
|
3534
|
-
const color = libredwg.
|
|
3535
|
-
const ltypeRef = libredwg.
|
|
3706
|
+
const flag = libredwg.dwg_dynapi_entity_data(item, "flag");
|
|
3707
|
+
const frozen = libredwg.dwg_dynapi_entity_data(item, "frozen");
|
|
3708
|
+
const off = libredwg.dwg_dynapi_entity_data(item, "off");
|
|
3709
|
+
const frozenInNew = libredwg.dwg_dynapi_entity_data(item, "frozen_in_new");
|
|
3710
|
+
const locked = libredwg.dwg_dynapi_entity_data(item, "plotflockedlag");
|
|
3711
|
+
const plotFlag = libredwg.dwg_dynapi_entity_data(item, "plotflag");
|
|
3712
|
+
const linewt = libredwg.dwg_dynapi_entity_data(item, "linewt");
|
|
3713
|
+
const color = libredwg.dwg_dynapi_entity_data(item, "color");
|
|
3714
|
+
const ltypeRef = libredwg.dwg_dynapi_entity_data(item, "ltype");
|
|
3536
3715
|
let ltypeName = "Continuous";
|
|
3537
3716
|
if (ltypeRef) {
|
|
3538
3717
|
try {
|
|
@@ -3571,11 +3750,11 @@ class LibreDwgConverter {
|
|
|
3571
3750
|
convertLineType(item, obj) {
|
|
3572
3751
|
const libredwg = this.libredwg;
|
|
3573
3752
|
const commonAttrs = this.getCommonTableEntryAttrs(item, obj);
|
|
3574
|
-
const flag = libredwg.
|
|
3575
|
-
const description = libredwg.
|
|
3576
|
-
const numDashes = libredwg.
|
|
3577
|
-
const patternLen = libredwg.
|
|
3578
|
-
const dashes = libredwg.
|
|
3753
|
+
const flag = libredwg.dwg_dynapi_entity_data(item, "flag");
|
|
3754
|
+
const description = libredwg.dwg_dynapi_entity_data(item, "description");
|
|
3755
|
+
const numDashes = libredwg.dwg_dynapi_entity_data(item, "numdashes");
|
|
3756
|
+
const patternLen = libredwg.dwg_dynapi_entity_data(item, "pattern_len");
|
|
3757
|
+
const dashes = libredwg.dwg_dynapi_entity_data(item, "dashes");
|
|
3579
3758
|
const dashArray = dashes ? libredwg.dwg_ptr_to_ltype_dash_array(dashes, numDashes) : [];
|
|
3580
3759
|
return {
|
|
3581
3760
|
...commonAttrs,
|
|
@@ -3607,16 +3786,13 @@ class LibreDwgConverter {
|
|
|
3607
3786
|
convertStyle(item, obj) {
|
|
3608
3787
|
const libredwg = this.libredwg;
|
|
3609
3788
|
const commonAttrs = this.getCommonTableEntryAttrs(item, obj);
|
|
3610
|
-
const standardFlag = libredwg.
|
|
3611
|
-
const widthFactor = libredwg.
|
|
3612
|
-
const obliqueAngle = libredwg.
|
|
3613
|
-
const textGenerationFlag = libredwg.
|
|
3614
|
-
|
|
3615
|
-
|
|
3616
|
-
)
|
|
3617
|
-
const lastHeight = libredwg.dwg_dynapi_entity_value(item, "last_height").data;
|
|
3618
|
-
const font = libredwg.dwg_dynapi_entity_value(item, "font_file").data;
|
|
3619
|
-
const bigFont = libredwg.dwg_dynapi_entity_value(item, "bigfont_file").data;
|
|
3789
|
+
const standardFlag = libredwg.dwg_dynapi_entity_data(item, "flag");
|
|
3790
|
+
const widthFactor = libredwg.dwg_dynapi_entity_data(item, "width_factor");
|
|
3791
|
+
const obliqueAngle = libredwg.dwg_dynapi_entity_data(item, "oblique_angle");
|
|
3792
|
+
const textGenerationFlag = libredwg.dwg_dynapi_entity_data(item, "generation");
|
|
3793
|
+
const lastHeight = libredwg.dwg_dynapi_entity_data(item, "last_height");
|
|
3794
|
+
const font = libredwg.dwg_dynapi_entity_data(item, "font_file");
|
|
3795
|
+
const bigFont = libredwg.dwg_dynapi_entity_data(item, "bigfont_file");
|
|
3620
3796
|
return {
|
|
3621
3797
|
...commonAttrs,
|
|
3622
3798
|
standardFlag,
|
|
@@ -3633,58 +3809,40 @@ class LibreDwgConverter {
|
|
|
3633
3809
|
convertViewport(item, obj) {
|
|
3634
3810
|
const libredwg = this.libredwg;
|
|
3635
3811
|
const commonAttrs = this.getCommonTableEntryAttrs(item, obj);
|
|
3636
|
-
const standardFlag = libredwg.
|
|
3637
|
-
const viewHeight = libredwg.
|
|
3638
|
-
const aspectRatio = libredwg.
|
|
3639
|
-
const center = libredwg.
|
|
3640
|
-
const viewTarget = libredwg.
|
|
3641
|
-
const viewDirectionFromTarget = libredwg.
|
|
3642
|
-
|
|
3643
|
-
|
|
3644
|
-
)
|
|
3645
|
-
const
|
|
3646
|
-
const
|
|
3647
|
-
const
|
|
3648
|
-
|
|
3649
|
-
|
|
3650
|
-
)
|
|
3651
|
-
const
|
|
3652
|
-
|
|
3653
|
-
|
|
3654
|
-
)
|
|
3655
|
-
const
|
|
3656
|
-
const
|
|
3657
|
-
const
|
|
3658
|
-
const
|
|
3659
|
-
|
|
3660
|
-
|
|
3661
|
-
)
|
|
3662
|
-
const
|
|
3663
|
-
const
|
|
3664
|
-
const
|
|
3665
|
-
|
|
3666
|
-
|
|
3667
|
-
)
|
|
3668
|
-
const
|
|
3669
|
-
const
|
|
3670
|
-
item,
|
|
3671
|
-
"upper_right"
|
|
3672
|
-
).data;
|
|
3673
|
-
const circleSides = libredwg.dwg_dynapi_entity_value(item, "circle_zoom").data;
|
|
3674
|
-
const ucsIconSetting = libredwg.dwg_dynapi_entity_value(item, "UCSICON").data;
|
|
3675
|
-
const gridSpacing = libredwg.dwg_dynapi_entity_value(item, "GRIDUNIT").data;
|
|
3676
|
-
const snapRotationAngle = libredwg.dwg_dynapi_entity_value(item, "SNAPANG").data;
|
|
3677
|
-
const snapBasePoint = libredwg.dwg_dynapi_entity_value(item, "SNAPBASE").data;
|
|
3678
|
-
const snapSpacing = libredwg.dwg_dynapi_entity_value(item, "SNAPUNIT").data;
|
|
3679
|
-
const ucsOrigin = libredwg.dwg_dynapi_entity_value(item, "ucsorg").data;
|
|
3680
|
-
const ucsXAxis = libredwg.dwg_dynapi_entity_value(item, "ucsxdir").data;
|
|
3681
|
-
const ucsYAxis = libredwg.dwg_dynapi_entity_value(item, "ucsydir").data;
|
|
3682
|
-
const elevation = libredwg.dwg_dynapi_entity_value(item, "ucs_elevation").data;
|
|
3683
|
-
const majorGridLines = libredwg.dwg_dynapi_entity_value(item, "grid_major").data;
|
|
3684
|
-
const background = libredwg.dwg_dynapi_entity_value(item, "background").data;
|
|
3685
|
-
const backgroundObjectId = background ? idToString(libredwg.dwg_ref_get_absref(background)) : void 0;
|
|
3686
|
-
const visualstyle = libredwg.dwg_dynapi_entity_value(item, "visualstyle").data;
|
|
3687
|
-
const visualStyleObjectId = visualstyle ? idToString(libredwg.dwg_ref_get_absref(visualstyle)) : void 0;
|
|
3812
|
+
const standardFlag = libredwg.dwg_dynapi_entity_data(item, "flag");
|
|
3813
|
+
const viewHeight = libredwg.dwg_dynapi_entity_data(item, "VIEWSIZE");
|
|
3814
|
+
const aspectRatio = libredwg.dwg_dynapi_entity_data(item, "aspect_ratio");
|
|
3815
|
+
const center = libredwg.dwg_dynapi_entity_data(item, "VIEWCTR");
|
|
3816
|
+
const viewTarget = libredwg.dwg_dynapi_entity_data(item, "view_target");
|
|
3817
|
+
const viewDirectionFromTarget = libredwg.dwg_dynapi_entity_data(item, "VIEWDIR");
|
|
3818
|
+
const viewTwistAngle = libredwg.dwg_dynapi_entity_data(item, "view_twist");
|
|
3819
|
+
const lensLength = libredwg.dwg_dynapi_entity_data(item, "lens_length");
|
|
3820
|
+
const frontClippingPlane = libredwg.dwg_dynapi_entity_data(item, "front_clip_z");
|
|
3821
|
+
const backClippingPlane = libredwg.dwg_dynapi_entity_data(item, "back_clip_z");
|
|
3822
|
+
const viewMode = libredwg.dwg_dynapi_entity_data(item, "VIEWMODE");
|
|
3823
|
+
const renderMode = libredwg.dwg_dynapi_entity_data(item, "render_mode");
|
|
3824
|
+
const isDefaultLightingOn = libredwg.dwg_dynapi_entity_data(item, "use_default_lights") != 0;
|
|
3825
|
+
const defaultLightningType = libredwg.dwg_dynapi_entity_data(item, "default_lightning_type");
|
|
3826
|
+
const brightness = libredwg.dwg_dynapi_entity_data(item, "brightness");
|
|
3827
|
+
const contrast = libredwg.dwg_dynapi_entity_data(item, "contrast");
|
|
3828
|
+
const ambient_color = libredwg.dwg_dynapi_entity_data(item, "ambient_color");
|
|
3829
|
+
const lowerLeftCorner = libredwg.dwg_dynapi_entity_data(item, "lower_left");
|
|
3830
|
+
const upperRightCorner = libredwg.dwg_dynapi_entity_data(item, "upper_right");
|
|
3831
|
+
const circleSides = libredwg.dwg_dynapi_entity_data(item, "circle_zoom");
|
|
3832
|
+
const ucsIconSetting = libredwg.dwg_dynapi_entity_data(item, "UCSICON");
|
|
3833
|
+
const gridSpacing = libredwg.dwg_dynapi_entity_data(item, "GRIDUNIT");
|
|
3834
|
+
const snapRotationAngle = libredwg.dwg_dynapi_entity_data(item, "SNAPANG");
|
|
3835
|
+
const snapBasePoint = libredwg.dwg_dynapi_entity_data(item, "SNAPBASE");
|
|
3836
|
+
const snapSpacing = libredwg.dwg_dynapi_entity_data(item, "SNAPUNIT");
|
|
3837
|
+
const ucsOrigin = libredwg.dwg_dynapi_entity_data(item, "ucsorg");
|
|
3838
|
+
const ucsXAxis = libredwg.dwg_dynapi_entity_data(item, "ucsxdir");
|
|
3839
|
+
const ucsYAxis = libredwg.dwg_dynapi_entity_data(item, "ucsydir");
|
|
3840
|
+
const elevation = libredwg.dwg_dynapi_entity_data(item, "ucs_elevation");
|
|
3841
|
+
const majorGridLines = libredwg.dwg_dynapi_entity_data(item, "grid_major");
|
|
3842
|
+
const background = libredwg.dwg_dynapi_entity_data(item, "background");
|
|
3843
|
+
const backgroundObjectId = background ? libredwg.dwg_ref_get_id(background) ?? "" : void 0;
|
|
3844
|
+
const visualstyle = libredwg.dwg_dynapi_entity_data(item, "visualstyle");
|
|
3845
|
+
const visualStyleObjectId = visualstyle ? libredwg.dwg_ref_get_id(visualstyle) ?? "" : void 0;
|
|
3688
3846
|
return {
|
|
3689
3847
|
...commonAttrs,
|
|
3690
3848
|
standardFlag,
|
|
@@ -3739,19 +3897,16 @@ class LibreDwgConverter {
|
|
|
3739
3897
|
return {
|
|
3740
3898
|
handle: idToString(handle.value),
|
|
3741
3899
|
ownerHandle: idToString(ownerhandle.absolute_ref),
|
|
3742
|
-
name: libredwg.
|
|
3900
|
+
name: libredwg.dwg_dynapi_entity_data(tio, "name")
|
|
3743
3901
|
};
|
|
3744
3902
|
}
|
|
3745
3903
|
convertDictionary(item, obj) {
|
|
3746
3904
|
const libredwg = this.libredwg;
|
|
3747
3905
|
const commonAttrs = this.getCommonObjectAttrs(obj);
|
|
3748
|
-
const isHardOwner = libredwg.
|
|
3749
|
-
const cloningFlag = libredwg.
|
|
3750
|
-
const numitems = libredwg.
|
|
3751
|
-
const itemhandles_ptr = libredwg.
|
|
3752
|
-
item,
|
|
3753
|
-
"itemhandles"
|
|
3754
|
-
).data;
|
|
3906
|
+
const isHardOwner = libredwg.dwg_dynapi_entity_data(item, "is_hardowner");
|
|
3907
|
+
const cloningFlag = libredwg.dwg_dynapi_entity_data(item, "cloning");
|
|
3908
|
+
const numitems = libredwg.dwg_dynapi_entity_data(item, "numitems");
|
|
3909
|
+
const itemhandles_ptr = libredwg.dwg_dynapi_entity_data(item, "itemhandles");
|
|
3755
3910
|
const itemhandles = libredwg.dwg_ptr_to_object_ref_array(
|
|
3756
3911
|
itemhandles_ptr,
|
|
3757
3912
|
numitems
|
|
@@ -3771,11 +3926,11 @@ class LibreDwgConverter {
|
|
|
3771
3926
|
convertImageDef(item, obj) {
|
|
3772
3927
|
const libredwg = this.libredwg;
|
|
3773
3928
|
const commonAttrs = this.getCommonObjectAttrs(obj);
|
|
3774
|
-
const size = libredwg.
|
|
3775
|
-
const fileName = libredwg.
|
|
3776
|
-
const isLoaded = libredwg.
|
|
3777
|
-
const sizeOfOnePixel = libredwg.
|
|
3778
|
-
const resolutionUnits = libredwg.
|
|
3929
|
+
const size = libredwg.dwg_dynapi_entity_data(item, "image_size");
|
|
3930
|
+
const fileName = libredwg.dwg_dynapi_entity_data(item, "file_path");
|
|
3931
|
+
const isLoaded = libredwg.dwg_dynapi_entity_data(item, "is_loaded");
|
|
3932
|
+
const sizeOfOnePixel = libredwg.dwg_dynapi_entity_data(item, "pixel_size");
|
|
3933
|
+
const resolutionUnits = libredwg.dwg_dynapi_entity_data(item, "resunits");
|
|
3779
3934
|
return {
|
|
3780
3935
|
...commonAttrs,
|
|
3781
3936
|
fileName,
|
|
@@ -3788,38 +3943,25 @@ class LibreDwgConverter {
|
|
|
3788
3943
|
convertLayout(item, obj) {
|
|
3789
3944
|
const libredwg = this.libredwg;
|
|
3790
3945
|
const commonAttrs = this.getCommonObjectAttrs(obj);
|
|
3791
|
-
const layoutName = libredwg.
|
|
3792
|
-
const tabOrder = libredwg.
|
|
3793
|
-
const controlFlag = libredwg.
|
|
3794
|
-
const insertionPoint = libredwg.
|
|
3795
|
-
const minLimit = libredwg.
|
|
3796
|
-
const maxLimit = libredwg.
|
|
3797
|
-
const ucsOrigin = libredwg.
|
|
3798
|
-
const ucsXAxis = libredwg.
|
|
3799
|
-
const ucsYAxis = libredwg.
|
|
3800
|
-
const orthographicType = libredwg.
|
|
3801
|
-
|
|
3802
|
-
|
|
3803
|
-
)
|
|
3804
|
-
const
|
|
3805
|
-
const
|
|
3806
|
-
const
|
|
3807
|
-
const
|
|
3808
|
-
|
|
3809
|
-
|
|
3810
|
-
).data;
|
|
3811
|
-
const paperSpaceTableId = idToString(
|
|
3812
|
-
libredwg.dwg_ref_get_absref(block_header_ref)
|
|
3813
|
-
);
|
|
3814
|
-
const active_viewport_ref = libredwg.dwg_dynapi_entity_value(
|
|
3815
|
-
item,
|
|
3816
|
-
"active_viewport"
|
|
3817
|
-
).data;
|
|
3818
|
-
const viewportId = idToString(
|
|
3819
|
-
libredwg.dwg_ref_get_absref(active_viewport_ref)
|
|
3820
|
-
);
|
|
3821
|
-
const named_ucs_ref = libredwg.dwg_dynapi_entity_value(item, "named_ucs").data;
|
|
3822
|
-
const namedUcsId = named_ucs_ref ? idToString(libredwg.dwg_ref_get_absref(named_ucs_ref)) : void 0;
|
|
3946
|
+
const layoutName = libredwg.dwg_dynapi_entity_data(item, "layout_name");
|
|
3947
|
+
const tabOrder = libredwg.dwg_dynapi_entity_data(item, "tab_order");
|
|
3948
|
+
const controlFlag = libredwg.dwg_dynapi_entity_data(item, "layout_flags");
|
|
3949
|
+
const insertionPoint = libredwg.dwg_dynapi_entity_data(item, "INSBASE");
|
|
3950
|
+
const minLimit = libredwg.dwg_dynapi_entity_data(item, "LIMMIN");
|
|
3951
|
+
const maxLimit = libredwg.dwg_dynapi_entity_data(item, "LIMMAX");
|
|
3952
|
+
const ucsOrigin = libredwg.dwg_dynapi_entity_data(item, "UCSORG");
|
|
3953
|
+
const ucsXAxis = libredwg.dwg_dynapi_entity_data(item, "UCSXDIR");
|
|
3954
|
+
const ucsYAxis = libredwg.dwg_dynapi_entity_data(item, "UCSYDIR");
|
|
3955
|
+
const orthographicType = libredwg.dwg_dynapi_entity_data(item, "UCSORTHOVIEW");
|
|
3956
|
+
const minExtent = libredwg.dwg_dynapi_entity_data(item, "EXTMIN");
|
|
3957
|
+
const maxExtent = libredwg.dwg_dynapi_entity_data(item, "EXTMAX");
|
|
3958
|
+
const elevation = libredwg.dwg_dynapi_entity_data(item, "ucs_elevation");
|
|
3959
|
+
const block_header_ref = libredwg.dwg_dynapi_entity_data(item, "block_header");
|
|
3960
|
+
const paperSpaceTableId = libredwg.dwg_ref_get_id(block_header_ref) ?? "";
|
|
3961
|
+
const active_viewport_ref = libredwg.dwg_dynapi_entity_data(item, "active_viewport");
|
|
3962
|
+
const viewportId = libredwg.dwg_ref_get_id(active_viewport_ref) ?? "";
|
|
3963
|
+
const named_ucs_ref = libredwg.dwg_dynapi_entity_data(item, "named_ucs");
|
|
3964
|
+
const namedUcsId = named_ucs_ref ? libredwg.dwg_ref_get_id(named_ucs_ref) ?? "" : void 0;
|
|
3823
3965
|
return {
|
|
3824
3966
|
...commonAttrs,
|
|
3825
3967
|
layoutName,
|
|
@@ -3843,49 +3985,81 @@ class LibreDwgConverter {
|
|
|
3843
3985
|
// TODO: Set the correct value
|
|
3844
3986
|
};
|
|
3845
3987
|
}
|
|
3988
|
+
convertMLeaderStyle(item, obj) {
|
|
3989
|
+
const libredwg = this.libredwg;
|
|
3990
|
+
const commonAttrs = this.getCommonObjectAttrs(obj);
|
|
3991
|
+
const objectVal = (field) => libredwg.dwg_dynapi_entity_data(item, field);
|
|
3992
|
+
const refToId = (ref) => libredwg.dwg_ref_get_id(ref);
|
|
3993
|
+
const asBool = (value) => value > 0;
|
|
3994
|
+
const mleaderColor = (color) => color != null ? dwgColorToMLeaderRawColor(color) : void 0;
|
|
3995
|
+
return {
|
|
3996
|
+
...commonAttrs,
|
|
3997
|
+
subclassMarker: "AcDbMLeaderStyle",
|
|
3998
|
+
unknown1: objectVal("class_version"),
|
|
3999
|
+
contentType: objectVal("content_type"),
|
|
4000
|
+
drawMLeaderOrderType: objectVal("mleader_order"),
|
|
4001
|
+
drawLeaderOrderType: objectVal("leader_order"),
|
|
4002
|
+
maxLeaderSegmentPoints: objectVal("max_points"),
|
|
4003
|
+
firstSegmentAngleConstraint: objectVal("first_seg_angle"),
|
|
4004
|
+
secondSegmentAngleConstraint: objectVal("second_seg_angle"),
|
|
4005
|
+
leaderLineType: objectVal("type"),
|
|
4006
|
+
leaderLineColor: mleaderColor(objectVal("line_color")),
|
|
4007
|
+
leaderLineTypeId: refToId(objectVal("line_type")),
|
|
4008
|
+
leaderLineWeight: objectVal("linewt"),
|
|
4009
|
+
landingEnabled: asBool(objectVal("has_landing")),
|
|
4010
|
+
landingGap: objectVal("landing_gap"),
|
|
4011
|
+
doglegEnabled: asBool(objectVal("has_dogleg")),
|
|
4012
|
+
doglegLength: objectVal("landing_dist"),
|
|
4013
|
+
description: objectVal("description"),
|
|
4014
|
+
arrowheadId: refToId(objectVal("arrow_head")),
|
|
4015
|
+
arrowheadSize: objectVal("arrow_head_size"),
|
|
4016
|
+
defaultMTextContents: objectVal("text_default"),
|
|
4017
|
+
textStyleId: refToId(objectVal("text_style")),
|
|
4018
|
+
textLeftAttachmentType: objectVal("attach_left"),
|
|
4019
|
+
textAngleType: objectVal("text_angle_type"),
|
|
4020
|
+
textAlignmentType: objectVal("text_align_type"),
|
|
4021
|
+
textRightAttachmentType: objectVal("attach_right"),
|
|
4022
|
+
textColor: mleaderColor(objectVal("text_color")),
|
|
4023
|
+
textHeight: objectVal("text_height"),
|
|
4024
|
+
textFrameEnabled: asBool(objectVal("has_text_frame")),
|
|
4025
|
+
textAlignAlwaysLeft: asBool(objectVal("text_always_left")),
|
|
4026
|
+
alignSpace: objectVal("align_space"),
|
|
4027
|
+
blockContentId: refToId(objectVal("block")),
|
|
4028
|
+
blockContentColor: mleaderColor(objectVal("block_color")),
|
|
4029
|
+
blockContentScale: objectVal("block_scale"),
|
|
4030
|
+
blockContentScaleEnabled: asBool(objectVal("use_block_scale")),
|
|
4031
|
+
blockContentRotation: objectVal("block_rotation"),
|
|
4032
|
+
blockContentRotationEnabled: asBool(objectVal("use_block_rotation")),
|
|
4033
|
+
blockContentConnectionType: objectVal("block_connection"),
|
|
4034
|
+
scale: objectVal("scale"),
|
|
4035
|
+
overwritePropertyValue: asBool(objectVal("is_changed")),
|
|
4036
|
+
annotative: asBool(objectVal("is_annotative")),
|
|
4037
|
+
breakGapSize: objectVal("break_size"),
|
|
4038
|
+
textAttachmentDirection: objectVal("attach_dir"),
|
|
4039
|
+
bottomTextAttachmentDirection: objectVal("attach_bottom"),
|
|
4040
|
+
topTextAttachmentDirection: objectVal("attach_top"),
|
|
4041
|
+
unknown2: asBool(objectVal("text_extended"))
|
|
4042
|
+
};
|
|
4043
|
+
}
|
|
3846
4044
|
convertSpatialFilter(item, obj) {
|
|
3847
4045
|
const libredwg = this.libredwg;
|
|
3848
4046
|
const commonAttrs = this.getCommonObjectAttrs(obj);
|
|
3849
|
-
const origin = libredwg.
|
|
3850
|
-
const numberOfPointsOnClipBoundary = libredwg.
|
|
3851
|
-
|
|
3852
|
-
"num_clip_verts"
|
|
3853
|
-
).data;
|
|
3854
|
-
const clip_verts_ptr = libredwg.dwg_dynapi_entity_value(item, "clip_verts").data;
|
|
4047
|
+
const origin = libredwg.dwg_dynapi_entity_data(item, "origin");
|
|
4048
|
+
const numberOfPointsOnClipBoundary = libredwg.dwg_dynapi_entity_data(item, "num_clip_verts");
|
|
4049
|
+
const clip_verts_ptr = libredwg.dwg_dynapi_entity_data(item, "clip_verts");
|
|
3855
4050
|
const vertices = libredwg.dwg_ptr_to_point2d_array(
|
|
3856
4051
|
clip_verts_ptr,
|
|
3857
4052
|
numberOfPointsOnClipBoundary
|
|
3858
4053
|
);
|
|
3859
|
-
const extrusionDirection = libredwg.
|
|
3860
|
-
|
|
3861
|
-
|
|
3862
|
-
)
|
|
3863
|
-
const
|
|
3864
|
-
|
|
3865
|
-
|
|
3866
|
-
).data;
|
|
3867
|
-
const frontClippingPlaneFlag = libredwg.dwg_dynapi_entity_value(
|
|
3868
|
-
item,
|
|
3869
|
-
"front_clip_on"
|
|
3870
|
-
).data;
|
|
3871
|
-
const frontClippingPlaneDistance = libredwg.dwg_dynapi_entity_value(
|
|
3872
|
-
item,
|
|
3873
|
-
"front_clip_z"
|
|
3874
|
-
).data;
|
|
3875
|
-
const backClippingPlaneFlag = libredwg.dwg_dynapi_entity_value(
|
|
3876
|
-
item,
|
|
3877
|
-
"back_clip_on"
|
|
3878
|
-
).data;
|
|
3879
|
-
const backClippingPlaneDistance = libredwg.dwg_dynapi_entity_value(
|
|
3880
|
-
item,
|
|
3881
|
-
"back_clip_z"
|
|
3882
|
-
).data;
|
|
3883
|
-
const transform_ptr = libredwg.dwg_dynapi_entity_value(item, "transform").data;
|
|
4054
|
+
const extrusionDirection = libredwg.dwg_dynapi_entity_data(item, "extrusion");
|
|
4055
|
+
const clipBoundaryVisible = libredwg.dwg_dynapi_entity_data(item, "display_boundary_on");
|
|
4056
|
+
const frontClippingPlaneFlag = libredwg.dwg_dynapi_entity_data(item, "front_clip_on");
|
|
4057
|
+
const frontClippingPlaneDistance = libredwg.dwg_dynapi_entity_data(item, "front_clip_z");
|
|
4058
|
+
const backClippingPlaneFlag = libredwg.dwg_dynapi_entity_data(item, "back_clip_on");
|
|
4059
|
+
const backClippingPlaneDistance = libredwg.dwg_dynapi_entity_data(item, "back_clip_z");
|
|
4060
|
+
const transform_ptr = libredwg.dwg_dynapi_entity_data(item, "transform");
|
|
3884
4061
|
const matrix = libredwg.dwg_ptr_to_double_array(transform_ptr, 12);
|
|
3885
|
-
const inverse_transform_ptr = libredwg.
|
|
3886
|
-
item,
|
|
3887
|
-
"inverse_transform"
|
|
3888
|
-
).data;
|
|
4062
|
+
const inverse_transform_ptr = libredwg.dwg_dynapi_entity_data(item, "inverse_transform");
|
|
3889
4063
|
const invertBlockMatrix = libredwg.dwg_ptr_to_double_array(
|
|
3890
4064
|
inverse_transform_ptr,
|
|
3891
4065
|
12
|
|
@@ -5545,6 +5719,54 @@ const _LibreDwg = class _LibreDwg {
|
|
|
5545
5719
|
dwg_resolve_handleref(ref_ptr, obj_ptr) {
|
|
5546
5720
|
return this.wasmInstance.dwg_resolve_handleref(ref_ptr, obj_ptr);
|
|
5547
5721
|
}
|
|
5722
|
+
/**
|
|
5723
|
+
* Returns the absolute handle reference of one Dwg_Object_Ref instance.
|
|
5724
|
+
* @group Handle Conversion Methods
|
|
5725
|
+
* @returns Returns null when the reference or absolute_ref is absent.
|
|
5726
|
+
*/
|
|
5727
|
+
dwg_ref_get_absref(ref_ptr) {
|
|
5728
|
+
if (!ref_ptr) return null;
|
|
5729
|
+
const absref = this.wasmInstance.dwg_ref_get_absref(ref_ptr);
|
|
5730
|
+
return absref === 0 ? null : absref;
|
|
5731
|
+
}
|
|
5732
|
+
/**
|
|
5733
|
+
* Returns the handle value of one Dwg_Object_Ref instance.
|
|
5734
|
+
* @group Handle Conversion Methods
|
|
5735
|
+
* @returns Returns null when the reference or handle value is absent.
|
|
5736
|
+
*/
|
|
5737
|
+
dwg_ref_get_handle_value(ref_ptr) {
|
|
5738
|
+
if (!ref_ptr) return null;
|
|
5739
|
+
const value = this.wasmInstance.dwg_ref_get_handle_value(ref_ptr);
|
|
5740
|
+
return value === 0n ? null : value;
|
|
5741
|
+
}
|
|
5742
|
+
/**
|
|
5743
|
+
* Returns the absolute_ref of one Dwg_Object_Ref instance as bigint.
|
|
5744
|
+
* @group Handle Conversion Methods
|
|
5745
|
+
* @returns Returns null when the reference or absolute_ref is absent.
|
|
5746
|
+
*/
|
|
5747
|
+
dwg_ref_get_handle_absolute_ref(ref_ptr) {
|
|
5748
|
+
if (!ref_ptr) return null;
|
|
5749
|
+
const value = this.wasmInstance.dwg_ref_get_handle_absolute_ref(ref_ptr);
|
|
5750
|
+
return value === 0n ? null : value;
|
|
5751
|
+
}
|
|
5752
|
+
/**
|
|
5753
|
+
* Returns the handle value of one Dwg_Object instance.
|
|
5754
|
+
* @group Handle Conversion Methods
|
|
5755
|
+
* @returns Returns null when the object or handle value is absent.
|
|
5756
|
+
*/
|
|
5757
|
+
dwg_obj_get_handle_value(obj_ptr) {
|
|
5758
|
+
if (!obj_ptr) return null;
|
|
5759
|
+
const value = this.wasmInstance.dwg_obj_get_handle_value(obj_ptr);
|
|
5760
|
+
return value === 0n ? null : value;
|
|
5761
|
+
}
|
|
5762
|
+
/**
|
|
5763
|
+
* Returns the absolute_ref of one Dwg_Object_Ref as uppercase hex handle id.
|
|
5764
|
+
* @group Handle Conversion Methods
|
|
5765
|
+
*/
|
|
5766
|
+
dwg_ref_get_id(ref_ptr) {
|
|
5767
|
+
const absref = this.dwg_ref_get_absref(ref_ptr);
|
|
5768
|
+
return absref == null ? void 0 : absref.toString(16).toUpperCase();
|
|
5769
|
+
}
|
|
5548
5770
|
/**
|
|
5549
5771
|
* Returns object (such as line type, layer name, dimension style, and etc.) name by its handle.
|
|
5550
5772
|
* @group Handle Conversion Methods
|
|
@@ -5555,7 +5777,7 @@ const _LibreDwg = class _LibreDwg {
|
|
|
5555
5777
|
const wasmInstance = this.wasmInstance;
|
|
5556
5778
|
const obj = wasmInstance.dwg_ref_get_object(ref_ptr);
|
|
5557
5779
|
const obj_tio = wasmInstance.dwg_object_to_object_tio(obj);
|
|
5558
|
-
const obj_name = this.
|
|
5780
|
+
const obj_name = this.dwg_dynapi_entity_data(obj_tio, "name");
|
|
5559
5781
|
return obj_name;
|
|
5560
5782
|
}
|
|
5561
5783
|
/**
|
|
@@ -6063,6 +6285,13 @@ const _LibreDwg = class _LibreDwg {
|
|
|
6063
6285
|
}
|
|
6064
6286
|
return value;
|
|
6065
6287
|
}
|
|
6288
|
+
/**
|
|
6289
|
+
* Returns the decoded field data of one object or entity.
|
|
6290
|
+
* @group Dynamic API Methods
|
|
6291
|
+
*/
|
|
6292
|
+
dwg_dynapi_entity_data(obj, field) {
|
|
6293
|
+
return this.dwg_dynapi_entity_value(obj, field).data;
|
|
6294
|
+
}
|
|
6066
6295
|
/**
|
|
6067
6296
|
* Header field value getter. Used to get the field value of dwg/dxf header.
|
|
6068
6297
|
* @group Dynamic API Methods
|
|
@@ -6073,6 +6302,13 @@ const _LibreDwg = class _LibreDwg {
|
|
|
6073
6302
|
dwg_dynapi_header_value(data, field) {
|
|
6074
6303
|
return this.wasmInstance.dwg_dynapi_header_value(data, field);
|
|
6075
6304
|
}
|
|
6305
|
+
/**
|
|
6306
|
+
* Returns the field data of dwg/dxf header.
|
|
6307
|
+
* @group Dynamic API Methods
|
|
6308
|
+
*/
|
|
6309
|
+
dwg_dynapi_header_data(data, field) {
|
|
6310
|
+
return this.dwg_dynapi_header_value(data, field).data;
|
|
6311
|
+
}
|
|
6076
6312
|
/**
|
|
6077
6313
|
* The common field value getter. Used to get the value of object or entity common fields.
|
|
6078
6314
|
* @group Dynamic API Methods
|
|
@@ -6083,6 +6319,13 @@ const _LibreDwg = class _LibreDwg {
|
|
|
6083
6319
|
dwg_dynapi_common_value(obj, field) {
|
|
6084
6320
|
return this.wasmInstance.dwg_dynapi_common_value(obj, field);
|
|
6085
6321
|
}
|
|
6322
|
+
/**
|
|
6323
|
+
* Returns the field data of object or entity common fields.
|
|
6324
|
+
* @group Dynamic API Methods
|
|
6325
|
+
*/
|
|
6326
|
+
dwg_dynapi_common_data(obj, field) {
|
|
6327
|
+
return this.dwg_dynapi_common_value(obj, field).data;
|
|
6328
|
+
}
|
|
6086
6329
|
/**
|
|
6087
6330
|
* The field of one object or entity may not be primitive type. It means one field may consist of
|
|
6088
6331
|
* multiple sub-fields. This method is used to get the sub-field value of those complex field.
|
|
@@ -6095,6 +6338,31 @@ const _LibreDwg = class _LibreDwg {
|
|
|
6095
6338
|
dwg_dynapi_subclass_value(obj, subclass, field) {
|
|
6096
6339
|
return this.wasmInstance.dwg_dynapi_subclass_value(obj, subclass, field);
|
|
6097
6340
|
}
|
|
6341
|
+
/**
|
|
6342
|
+
* Returns the sub-field data of one complex field.
|
|
6343
|
+
* @group Dynamic API Methods
|
|
6344
|
+
*/
|
|
6345
|
+
dwg_dynapi_subclass_data(obj, subclass, field) {
|
|
6346
|
+
return this.dwg_dynapi_subclass_value(obj, subclass, field).data;
|
|
6347
|
+
}
|
|
6348
|
+
/**
|
|
6349
|
+
* Returns the struct size of a dynapi subclass.
|
|
6350
|
+
*/
|
|
6351
|
+
dwg_dynapi_subclass_size(subclass) {
|
|
6352
|
+
return this.wasmInstance.dwg_dynapi_subclass_size(subclass);
|
|
6353
|
+
}
|
|
6354
|
+
/**
|
|
6355
|
+
* Returns the byte offset of a field within an entity struct.
|
|
6356
|
+
*/
|
|
6357
|
+
dwg_dynapi_entity_field_offset(entity, field) {
|
|
6358
|
+
return this.wasmInstance.dwg_dynapi_entity_field_offset(entity, field);
|
|
6359
|
+
}
|
|
6360
|
+
/**
|
|
6361
|
+
* Returns the byte offset of a field within a dynapi subclass struct.
|
|
6362
|
+
*/
|
|
6363
|
+
dwg_dynapi_subclass_field_offset(subclass, field) {
|
|
6364
|
+
return this.wasmInstance.dwg_dynapi_subclass_field_offset(subclass, field);
|
|
6365
|
+
}
|
|
6098
6366
|
/**
|
|
6099
6367
|
* Returns the handle of one Dwg_Object instance.
|
|
6100
6368
|
* @group Dwg_Object Methods
|
|
@@ -6206,7 +6474,7 @@ const _LibreDwg = class _LibreDwg {
|
|
|
6206
6474
|
*/
|
|
6207
6475
|
dwg_entity_get_block_name(ptr, field) {
|
|
6208
6476
|
const wasmInstance = this.wasmInstance;
|
|
6209
|
-
const block_header_ref =
|
|
6477
|
+
const block_header_ref = this.dwg_dynapi_entity_data(ptr, field);
|
|
6210
6478
|
const block_header_obj = wasmInstance.dwg_ref_get_object(block_header_ref);
|
|
6211
6479
|
const block_header_tio = wasmInstance.dwg_object_to_object_tio(block_header_obj);
|
|
6212
6480
|
const block = this.dwg_entity_block_header_get_block(block_header_tio);
|
|
@@ -6222,10 +6490,10 @@ const _LibreDwg = class _LibreDwg {
|
|
|
6222
6490
|
*/
|
|
6223
6491
|
dwg_entity_get_dimstyle_name(ptr, field = "dimstyle") {
|
|
6224
6492
|
const wasmInstance = this.wasmInstance;
|
|
6225
|
-
const dimstyle_ref =
|
|
6493
|
+
const dimstyle_ref = this.dwg_dynapi_entity_data(ptr, field);
|
|
6226
6494
|
const dimstyle_obj = wasmInstance.dwg_ref_get_object(dimstyle_ref);
|
|
6227
6495
|
const dimstyle_tio = wasmInstance.dwg_object_to_object_tio(dimstyle_obj);
|
|
6228
|
-
const dimstyle_name = this.
|
|
6496
|
+
const dimstyle_name = this.dwg_dynapi_entity_data(dimstyle_tio, "name");
|
|
6229
6497
|
return dimstyle_name;
|
|
6230
6498
|
}
|
|
6231
6499
|
/**
|
|
@@ -6236,11 +6504,11 @@ const _LibreDwg = class _LibreDwg {
|
|
|
6236
6504
|
*/
|
|
6237
6505
|
dwg_entity_block_header_get_block(ptr) {
|
|
6238
6506
|
const wasmInstance = this.wasmInstance;
|
|
6239
|
-
const block_ref =
|
|
6507
|
+
const block_ref = this.dwg_dynapi_entity_data(ptr, "block_entity");
|
|
6240
6508
|
const block_obj = wasmInstance.dwg_ref_get_object(block_ref);
|
|
6241
6509
|
const block_tio = wasmInstance.dwg_object_to_entity_tio(block_obj);
|
|
6242
|
-
const name =
|
|
6243
|
-
const base_pt =
|
|
6510
|
+
const name = this.dwg_dynapi_entity_data(block_tio, "name");
|
|
6511
|
+
const base_pt = this.dwg_dynapi_entity_data(block_tio, "base_pt");
|
|
6244
6512
|
return {
|
|
6245
6513
|
name,
|
|
6246
6514
|
base_pt
|
|
@@ -6310,10 +6578,10 @@ const _LibreDwg = class _LibreDwg {
|
|
|
6310
6578
|
*/
|
|
6311
6579
|
dwg_entity_mtext_get_style_name(ptr) {
|
|
6312
6580
|
const wasmInstance = this.wasmInstance;
|
|
6313
|
-
const style_ref =
|
|
6581
|
+
const style_ref = this.dwg_dynapi_entity_data(ptr, "style");
|
|
6314
6582
|
const style_obj = wasmInstance.dwg_ref_get_object(style_ref);
|
|
6315
6583
|
const style_tio = wasmInstance.dwg_object_to_object_tio(style_obj);
|
|
6316
|
-
const name =
|
|
6584
|
+
const name = this.dwg_dynapi_entity_data(style_tio, "name");
|
|
6317
6585
|
return name;
|
|
6318
6586
|
}
|
|
6319
6587
|
/**
|