@mlightcad/libredwg-converter 3.16.5 → 3.16.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/libredwg-converter.umd.cjs +1 -1
- package/dist/libredwg-parser-worker.js +22 -18
- package/dist/libredwg-web.wasm +0 -0
- package/lib/AcDbLibreDwgConverter.d.ts +5 -0
- package/lib/AcDbLibreDwgConverter.d.ts.map +1 -1
- package/lib/AcDbLibreDwgConverter.js +148 -71
- package/lib/AcDbLibreDwgConverter.js.map +1 -1
- package/package.json +4 -4
package/dist/libredwg-web.wasm
CHANGED
|
Binary file
|
|
@@ -131,5 +131,10 @@ export declare class AcDbLibreDwgConverter extends AcDbDatabaseConverter<DwgData
|
|
|
131
131
|
private groupAndFlattenByType;
|
|
132
132
|
private isModelSpace;
|
|
133
133
|
private normalizeHeaderStringValue;
|
|
134
|
+
/**
|
|
135
|
+
* Coerces a LibreDWG header value to a 3D point when it looks like one.
|
|
136
|
+
* Needed because some UCS direction fields are mistyped as `number` upstream.
|
|
137
|
+
*/
|
|
138
|
+
private asHeaderPoint3d;
|
|
134
139
|
}
|
|
135
140
|
//# sourceMappingURL=AcDbLibreDwgConverter.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AcDbLibreDwgConverter.d.ts","sourceRoot":"","sources":["../src/AcDbLibreDwgConverter.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,8BAA8B,EAE9B,YAAY,EACZ,qBAAqB,EACrB,2BAA2B,EAuB3B,qBAAqB,EAkBtB,MAAM,uBAAuB,CAAA;AAC9B,OAAO,EAGL,WAAW,EAGZ,MAAM,yBAAyB,CAAA;AAuBhC;;;;GAIG;AACH,qBAAa,qBAAsB,SAAQ,qBAAqB,CAAC,WAAW,CAAC;gBAC/D,MAAM,GAAE,2BAAgC;cAQpC,KAAK,CAAC,IAAI,EAAE,WAAW,EAAE,OAAO,CAAC,EAAE,MAAM;IAwBzD,SAA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AO,CAAC,6BAA6B;IAoBrC,OAAO,CAAC,iCAAiC;IAyCzC,OAAO,CAAC,4BAA4B;IAmBpC,OAAO,CAAC,4BAA4B;IAmBpC,OAAO,CAAC,8BAA8B;IAmBtC,OAAO,CAAC,8BAA8B;IAmBtC,OAAO,CAAC,+BAA+B;IAsBvC,OAAO,CAAC,sCAAsC;IAuB9C,OAAO,CAAC,eAAe;IAYvB;;;OAGG;IACH,OAAO,CAAC,aAAa;IAiErB;;;OAGG;IACH,OAAO,CAAC,gBAAgB;IAoCxB;;OAEG;IACH,OAAO,CAAC,oBAAoB;IA6B5B,8EAA8E;IAC9E,OAAO,CAAC,mBAAmB;IAS3B,OAAO,CAAC,wBAAwB;IAUhC;;;;;;;;;;;;OAYG;IACH,OAAO,CAAC,qBAAqB;IAuB7B,OAAO,CAAC,YAAY;IAIpB,OAAO,CAAC,0BAA0B;IAMlC;;;OAGG;IACH,OAAO,CAAC,eAAe;CAcxB"}
|
|
@@ -472,8 +472,11 @@ var AcDbLibreDwgConverter = /** @class */ (function (_super) {
|
|
|
472
472
|
if (item.viewMode) {
|
|
473
473
|
record.gsView.viewMode = item.viewMode;
|
|
474
474
|
}
|
|
475
|
-
if (item.ucsIconSetting) {
|
|
476
|
-
|
|
475
|
+
if (item.ucsIconSetting != null) {
|
|
476
|
+
var icon = Math.trunc(item.ucsIconSetting);
|
|
477
|
+
if (icon >= 0 && icon <= 3) {
|
|
478
|
+
record.setUcsIconSysVar(icon);
|
|
479
|
+
}
|
|
477
480
|
}
|
|
478
481
|
if (item.ucsOrigin) {
|
|
479
482
|
record.gsView.ucsOrigin.copy(item.ucsOrigin);
|
|
@@ -518,8 +521,15 @@ var AcDbLibreDwgConverter = /** @class */ (function (_super) {
|
|
|
518
521
|
});
|
|
519
522
|
};
|
|
520
523
|
AcDbLibreDwgConverter.prototype.processBlockTables = function (model, db) {
|
|
521
|
-
var
|
|
524
|
+
var e_2, _a, e_3, _b;
|
|
522
525
|
var btrs = model.tables.BLOCK_RECORD.entries;
|
|
526
|
+
// Pass 1: register every BTR shell (and metadata) before appending entities.
|
|
527
|
+
// Paper-space INSERTs often appear earlier in BLOCK_RECORD order than the
|
|
528
|
+
// symbol blocks they reference (e.g. *Paper_Space before 注解2). Filling
|
|
529
|
+
// layout entities in the same loop used to fire entityAppended while
|
|
530
|
+
// getAt(blockName) was still undefined, so the viewer committed an empty
|
|
531
|
+
// group and never retried.
|
|
532
|
+
var pendingEntities = [];
|
|
523
533
|
btrs.forEach(function (btr) {
|
|
524
534
|
var _a;
|
|
525
535
|
var dbBlock = db.tables.blockTable.getAt(btr.name);
|
|
@@ -545,11 +555,49 @@ var AcDbLibreDwgConverter = /** @class */ (function (_super) {
|
|
|
545
555
|
dbBlock.previewIcon = acdbHexStringsToBytes([btr.bmpPreview]);
|
|
546
556
|
}
|
|
547
557
|
dbBlock.origin.copy(btr.basePoint);
|
|
548
|
-
//
|
|
549
|
-
if (
|
|
550
|
-
|
|
558
|
+
// Model space is filled later by processEntities (chunked + progress).
|
|
559
|
+
if (dbBlock.isModelSapce || !btr.entities || btr.entities.length === 0) {
|
|
560
|
+
return;
|
|
551
561
|
}
|
|
562
|
+
pendingEntities.push({
|
|
563
|
+
entities: btr.entities,
|
|
564
|
+
block: dbBlock,
|
|
565
|
+
isPaperSpace: dbBlock.isPaperSapce
|
|
566
|
+
});
|
|
552
567
|
});
|
|
568
|
+
try {
|
|
569
|
+
// Pass 2a: symbol / anonymous block bodies first so paper INSERTs can
|
|
570
|
+
// resolve nested definitions (and rendering-cache templates stay non-empty).
|
|
571
|
+
for (var pendingEntities_1 = __values(pendingEntities), pendingEntities_1_1 = pendingEntities_1.next(); !pendingEntities_1_1.done; pendingEntities_1_1 = pendingEntities_1.next()) {
|
|
572
|
+
var pending_1 = pendingEntities_1_1.value;
|
|
573
|
+
if (pending_1.isPaperSpace)
|
|
574
|
+
continue;
|
|
575
|
+
this.processEntitiesInBlock(pending_1.entities, pending_1.block);
|
|
576
|
+
}
|
|
577
|
+
}
|
|
578
|
+
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
579
|
+
finally {
|
|
580
|
+
try {
|
|
581
|
+
if (pendingEntities_1_1 && !pendingEntities_1_1.done && (_a = pendingEntities_1.return)) _a.call(pendingEntities_1);
|
|
582
|
+
}
|
|
583
|
+
finally { if (e_2) throw e_2.error; }
|
|
584
|
+
}
|
|
585
|
+
try {
|
|
586
|
+
// Pass 2b: paper layouts last — entityAppended converts these into the scene.
|
|
587
|
+
for (var pendingEntities_2 = __values(pendingEntities), pendingEntities_2_1 = pendingEntities_2.next(); !pendingEntities_2_1.done; pendingEntities_2_1 = pendingEntities_2.next()) {
|
|
588
|
+
var pending_2 = pendingEntities_2_1.value;
|
|
589
|
+
if (!pending_2.isPaperSpace)
|
|
590
|
+
continue;
|
|
591
|
+
this.processEntitiesInBlock(pending_2.entities, pending_2.block);
|
|
592
|
+
}
|
|
593
|
+
}
|
|
594
|
+
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
595
|
+
finally {
|
|
596
|
+
try {
|
|
597
|
+
if (pendingEntities_2_1 && !pendingEntities_2_1.done && (_b = pendingEntities_2.return)) _b.call(pendingEntities_2);
|
|
598
|
+
}
|
|
599
|
+
finally { if (e_3) throw e_3.error; }
|
|
600
|
+
}
|
|
553
601
|
};
|
|
554
602
|
AcDbLibreDwgConverter.prototype.processBlocks = function (_model, _db) {
|
|
555
603
|
// Do nothing because entities are already processsed in method processBlockTables
|
|
@@ -712,6 +760,21 @@ var AcDbLibreDwgConverter = /** @class */ (function (_super) {
|
|
|
712
760
|
db.chamferc = headerExt.CHAMFERC;
|
|
713
761
|
if (headerExt.CHAMFERD != null)
|
|
714
762
|
db.chamferd = headerExt.CHAMFERD;
|
|
763
|
+
// Drawing-backed UCS header vars (match DXF $UCS* / AcDbDxfHeaderReader).
|
|
764
|
+
if (header.UCSBASE != null)
|
|
765
|
+
db.ucsbase = String(header.UCSBASE);
|
|
766
|
+
if (header.UCSNAME != null)
|
|
767
|
+
db.ucsname = String(header.UCSNAME);
|
|
768
|
+
if (header.UCSORG)
|
|
769
|
+
db.ucsorg = header.UCSORG;
|
|
770
|
+
// libredwg-web types UCSXDIR/UCSYDIR as number; runtime values are points.
|
|
771
|
+
var ucsXDir = this.asHeaderPoint3d(header.UCSXDIR);
|
|
772
|
+
if (ucsXDir)
|
|
773
|
+
db.ucsxdir = ucsXDir;
|
|
774
|
+
var ucsYDir = this.asHeaderPoint3d(header.UCSYDIR);
|
|
775
|
+
if (ucsYDir)
|
|
776
|
+
db.ucsydir = ucsYDir;
|
|
777
|
+
// WORLDUCS is derived by AcDbDatabase when UCSORG/UCSXDIR/UCSYDIR change.
|
|
715
778
|
db.textstyle = (_l = header.TEXTSTYLE) !== null && _l !== void 0 ? _l : DEFAULT_TEXT_STYLE;
|
|
716
779
|
// Match DXF header reader: new dimensions must inherit $DIMSTYLE.
|
|
717
780
|
// Without this, DWG loads leave db.dimstyle as the constructor default
|
|
@@ -776,7 +839,7 @@ var AcDbLibreDwgConverter = /** @class */ (function (_super) {
|
|
|
776
839
|
* placeholder is created by {@link acdbImportDynBlockMetadata}.
|
|
777
840
|
*/
|
|
778
841
|
AcDbLibreDwgConverter.prototype.processDynBlockMetadata = function (model, db) {
|
|
779
|
-
var
|
|
842
|
+
var e_4, _a;
|
|
780
843
|
var _b, _c;
|
|
781
844
|
var normalize = function (handle) {
|
|
782
845
|
return handle == null || handle === '' || handle === 0
|
|
@@ -797,12 +860,12 @@ var AcDbLibreDwgConverter = /** @class */ (function (_super) {
|
|
|
797
860
|
}
|
|
798
861
|
}
|
|
799
862
|
}
|
|
800
|
-
catch (
|
|
863
|
+
catch (e_4_1) { e_4 = { error: e_4_1 }; }
|
|
801
864
|
finally {
|
|
802
865
|
try {
|
|
803
866
|
if (_e && !_e.done && (_a = _d.return)) _a.call(_d);
|
|
804
867
|
}
|
|
805
|
-
finally { if (
|
|
868
|
+
finally { if (e_4) throw e_4.error; }
|
|
806
869
|
}
|
|
807
870
|
var dictObjects = model.objects.DICTIONARY;
|
|
808
871
|
if (!(dictObjects === null || dictObjects === void 0 ? void 0 : dictObjects.length))
|
|
@@ -889,7 +952,7 @@ var AcDbLibreDwgConverter = /** @class */ (function (_super) {
|
|
|
889
952
|
var layoutDict = db.objects.layout;
|
|
890
953
|
var layouts = model.objects.LAYOUT;
|
|
891
954
|
layouts.forEach(function (layout) {
|
|
892
|
-
var
|
|
955
|
+
var e_5, _a, e_6, _b;
|
|
893
956
|
var dbLayout = new AcDbLayout();
|
|
894
957
|
dbLayout.layoutName = layout.layoutName;
|
|
895
958
|
dbLayout.tabOrder = layout.tabOrder;
|
|
@@ -915,12 +978,12 @@ var AcDbLibreDwgConverter = /** @class */ (function (_super) {
|
|
|
915
978
|
}
|
|
916
979
|
}
|
|
917
980
|
}
|
|
918
|
-
catch (
|
|
981
|
+
catch (e_5_1) { e_5 = { error: e_5_1 }; }
|
|
919
982
|
finally {
|
|
920
983
|
try {
|
|
921
984
|
if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
|
|
922
985
|
}
|
|
923
|
-
finally { if (
|
|
986
|
+
finally { if (e_5) throw e_5.error; }
|
|
924
987
|
}
|
|
925
988
|
if (!dbLayout.blockTableRecordId && layout.paperSpaceTableId) {
|
|
926
989
|
var btr = db.tables.blockTable.getIdAt(String(layout.paperSpaceTableId));
|
|
@@ -942,12 +1005,12 @@ var AcDbLibreDwgConverter = /** @class */ (function (_super) {
|
|
|
942
1005
|
break;
|
|
943
1006
|
}
|
|
944
1007
|
}
|
|
945
|
-
catch (
|
|
1008
|
+
catch (e_6_1) { e_6 = { error: e_6_1 }; }
|
|
946
1009
|
finally {
|
|
947
1010
|
try {
|
|
948
1011
|
if (_f && !_f.done && (_b = _e.return)) _b.call(_e);
|
|
949
1012
|
}
|
|
950
|
-
finally { if (
|
|
1013
|
+
finally { if (e_6) throw e_6.error; }
|
|
951
1014
|
}
|
|
952
1015
|
}
|
|
953
1016
|
}
|
|
@@ -1007,7 +1070,7 @@ var AcDbLibreDwgConverter = /** @class */ (function (_super) {
|
|
|
1007
1070
|
});
|
|
1008
1071
|
};
|
|
1009
1072
|
AcDbLibreDwgConverter.prototype.processScales = function (model, db) {
|
|
1010
|
-
var
|
|
1073
|
+
var e_7, _a;
|
|
1011
1074
|
var scales = this.optionalObjectArray(model, 'SCALE');
|
|
1012
1075
|
if (!(scales === null || scales === void 0 ? void 0 : scales.length))
|
|
1013
1076
|
return;
|
|
@@ -1022,16 +1085,16 @@ var AcDbLibreDwgConverter = /** @class */ (function (_super) {
|
|
|
1022
1085
|
scaleDict.setAt(key, dbScale);
|
|
1023
1086
|
}
|
|
1024
1087
|
}
|
|
1025
|
-
catch (
|
|
1088
|
+
catch (e_7_1) { e_7 = { error: e_7_1 }; }
|
|
1026
1089
|
finally {
|
|
1027
1090
|
try {
|
|
1028
1091
|
if (scales_1_1 && !scales_1_1.done && (_a = scales_1.return)) _a.call(scales_1);
|
|
1029
1092
|
}
|
|
1030
|
-
finally { if (
|
|
1093
|
+
finally { if (e_7) throw e_7.error; }
|
|
1031
1094
|
}
|
|
1032
1095
|
};
|
|
1033
1096
|
AcDbLibreDwgConverter.prototype.processDictionaryVars = function (model, db) {
|
|
1034
|
-
var
|
|
1097
|
+
var e_8, _a;
|
|
1035
1098
|
var dictVars = this.optionalObjectArray(model, 'DICTIONARYVAR');
|
|
1036
1099
|
if (!(dictVars === null || dictVars === void 0 ? void 0 : dictVars.length))
|
|
1037
1100
|
return;
|
|
@@ -1045,16 +1108,16 @@ var AcDbLibreDwgConverter = /** @class */ (function (_super) {
|
|
|
1045
1108
|
dictVarDict.setAt(dbVar.objectId, dbVar);
|
|
1046
1109
|
}
|
|
1047
1110
|
}
|
|
1048
|
-
catch (
|
|
1111
|
+
catch (e_8_1) { e_8 = { error: e_8_1 }; }
|
|
1049
1112
|
finally {
|
|
1050
1113
|
try {
|
|
1051
1114
|
if (dictVars_1_1 && !dictVars_1_1.done && (_a = dictVars_1.return)) _a.call(dictVars_1);
|
|
1052
1115
|
}
|
|
1053
|
-
finally { if (
|
|
1116
|
+
finally { if (e_8) throw e_8.error; }
|
|
1054
1117
|
}
|
|
1055
1118
|
};
|
|
1056
1119
|
AcDbLibreDwgConverter.prototype.processMTextObjectContextData = function (model, db) {
|
|
1057
|
-
var
|
|
1120
|
+
var e_9, _a;
|
|
1058
1121
|
var _b;
|
|
1059
1122
|
var contexts = (_b = this.optionalObjectArray(model, 'MTEXTOBJECTCONTEXTDATA')) !== null && _b !== void 0 ? _b : this.optionalObjectArray(model, 'ACDB_MTEXTOBJECTCONTEXTDATA_CLASS');
|
|
1060
1123
|
if (!(contexts === null || contexts === void 0 ? void 0 : contexts.length))
|
|
@@ -1069,16 +1132,16 @@ var AcDbLibreDwgConverter = /** @class */ (function (_super) {
|
|
|
1069
1132
|
contextDict.setAt(dbContext.objectId, dbContext);
|
|
1070
1133
|
}
|
|
1071
1134
|
}
|
|
1072
|
-
catch (
|
|
1135
|
+
catch (e_9_1) { e_9 = { error: e_9_1 }; }
|
|
1073
1136
|
finally {
|
|
1074
1137
|
try {
|
|
1075
1138
|
if (contexts_1_1 && !contexts_1_1.done && (_a = contexts_1.return)) _a.call(contexts_1);
|
|
1076
1139
|
}
|
|
1077
|
-
finally { if (
|
|
1140
|
+
finally { if (e_9) throw e_9.error; }
|
|
1078
1141
|
}
|
|
1079
1142
|
};
|
|
1080
1143
|
AcDbLibreDwgConverter.prototype.processDimensionObjectContextData = function (model, db) {
|
|
1081
|
-
var
|
|
1144
|
+
var e_10, _a, e_11, _b;
|
|
1082
1145
|
var keys = [
|
|
1083
1146
|
'ALDIMOBJECTCONTEXTDATA',
|
|
1084
1147
|
'ACDB_ALDIMOBJECTCONTEXTDATA_CLASS',
|
|
@@ -1106,7 +1169,7 @@ var AcDbLibreDwgConverter = /** @class */ (function (_super) {
|
|
|
1106
1169
|
if (!(contexts === null || contexts === void 0 ? void 0 : contexts.length))
|
|
1107
1170
|
continue;
|
|
1108
1171
|
try {
|
|
1109
|
-
for (var contexts_2 = (
|
|
1172
|
+
for (var contexts_2 = (e_11 = void 0, __values(contexts)), contexts_2_1 = contexts_2.next(); !contexts_2_1.done; contexts_2_1 = contexts_2.next()) {
|
|
1110
1173
|
var context = contexts_2_1.value;
|
|
1111
1174
|
var dbContext = objectConverter.convertDimensionObjectContextData(context);
|
|
1112
1175
|
if (dbContext.objectId) {
|
|
@@ -1114,25 +1177,25 @@ var AcDbLibreDwgConverter = /** @class */ (function (_super) {
|
|
|
1114
1177
|
}
|
|
1115
1178
|
}
|
|
1116
1179
|
}
|
|
1117
|
-
catch (
|
|
1180
|
+
catch (e_11_1) { e_11 = { error: e_11_1 }; }
|
|
1118
1181
|
finally {
|
|
1119
1182
|
try {
|
|
1120
1183
|
if (contexts_2_1 && !contexts_2_1.done && (_b = contexts_2.return)) _b.call(contexts_2);
|
|
1121
1184
|
}
|
|
1122
|
-
finally { if (
|
|
1185
|
+
finally { if (e_11) throw e_11.error; }
|
|
1123
1186
|
}
|
|
1124
1187
|
}
|
|
1125
1188
|
}
|
|
1126
|
-
catch (
|
|
1189
|
+
catch (e_10_1) { e_10 = { error: e_10_1 }; }
|
|
1127
1190
|
finally {
|
|
1128
1191
|
try {
|
|
1129
1192
|
if (keys_1_1 && !keys_1_1.done && (_a = keys_1.return)) _a.call(keys_1);
|
|
1130
1193
|
}
|
|
1131
|
-
finally { if (
|
|
1194
|
+
finally { if (e_10) throw e_10.error; }
|
|
1132
1195
|
}
|
|
1133
1196
|
};
|
|
1134
1197
|
AcDbLibreDwgConverter.prototype.processTextObjectContextData = function (model, db) {
|
|
1135
|
-
var
|
|
1198
|
+
var e_12, _a;
|
|
1136
1199
|
var _b;
|
|
1137
1200
|
var contexts = (_b = this.optionalObjectArray(model, 'TEXTOBJECTCONTEXTDATA')) !== null && _b !== void 0 ? _b : this.optionalObjectArray(model, 'ACDB_TEXTOBJECTCONTEXTDATA_CLASS');
|
|
1138
1201
|
if (!(contexts === null || contexts === void 0 ? void 0 : contexts.length))
|
|
@@ -1147,16 +1210,16 @@ var AcDbLibreDwgConverter = /** @class */ (function (_super) {
|
|
|
1147
1210
|
contextDict.setAt(dbContext.objectId, dbContext);
|
|
1148
1211
|
}
|
|
1149
1212
|
}
|
|
1150
|
-
catch (
|
|
1213
|
+
catch (e_12_1) { e_12 = { error: e_12_1 }; }
|
|
1151
1214
|
finally {
|
|
1152
1215
|
try {
|
|
1153
1216
|
if (contexts_3_1 && !contexts_3_1.done && (_a = contexts_3.return)) _a.call(contexts_3);
|
|
1154
1217
|
}
|
|
1155
|
-
finally { if (
|
|
1218
|
+
finally { if (e_12) throw e_12.error; }
|
|
1156
1219
|
}
|
|
1157
1220
|
};
|
|
1158
1221
|
AcDbLibreDwgConverter.prototype.processHatchScaleContextData = function (model, db) {
|
|
1159
|
-
var
|
|
1222
|
+
var e_13, _a;
|
|
1160
1223
|
var _b;
|
|
1161
1224
|
var contexts = (_b = this.optionalObjectArray(model, 'HATCHSCALECONTEXTDATA')) !== null && _b !== void 0 ? _b : this.optionalObjectArray(model, 'ACDB_HATCHSCALECONTEXTDATA_CLASS');
|
|
1162
1225
|
if (!(contexts === null || contexts === void 0 ? void 0 : contexts.length))
|
|
@@ -1171,16 +1234,16 @@ var AcDbLibreDwgConverter = /** @class */ (function (_super) {
|
|
|
1171
1234
|
contextDict.setAt(dbContext.objectId, dbContext);
|
|
1172
1235
|
}
|
|
1173
1236
|
}
|
|
1174
|
-
catch (
|
|
1237
|
+
catch (e_13_1) { e_13 = { error: e_13_1 }; }
|
|
1175
1238
|
finally {
|
|
1176
1239
|
try {
|
|
1177
1240
|
if (contexts_4_1 && !contexts_4_1.done && (_a = contexts_4.return)) _a.call(contexts_4);
|
|
1178
1241
|
}
|
|
1179
|
-
finally { if (
|
|
1242
|
+
finally { if (e_13) throw e_13.error; }
|
|
1180
1243
|
}
|
|
1181
1244
|
};
|
|
1182
1245
|
AcDbLibreDwgConverter.prototype.processBlkRefObjectContextData = function (model, db) {
|
|
1183
|
-
var
|
|
1246
|
+
var e_14, _a;
|
|
1184
1247
|
var _b;
|
|
1185
1248
|
var contexts = (_b = this.optionalObjectArray(model, 'BLKREFOBJECTCONTEXTDATA')) !== null && _b !== void 0 ? _b : this.optionalObjectArray(model, 'ACDB_BLKREFOBJECTCONTEXTDATA_CLASS');
|
|
1186
1249
|
if (!(contexts === null || contexts === void 0 ? void 0 : contexts.length))
|
|
@@ -1195,16 +1258,16 @@ var AcDbLibreDwgConverter = /** @class */ (function (_super) {
|
|
|
1195
1258
|
contextDict.setAt(dbContext.objectId, dbContext);
|
|
1196
1259
|
}
|
|
1197
1260
|
}
|
|
1198
|
-
catch (
|
|
1261
|
+
catch (e_14_1) { e_14 = { error: e_14_1 }; }
|
|
1199
1262
|
finally {
|
|
1200
1263
|
try {
|
|
1201
1264
|
if (contexts_5_1 && !contexts_5_1.done && (_a = contexts_5.return)) _a.call(contexts_5);
|
|
1202
1265
|
}
|
|
1203
|
-
finally { if (
|
|
1266
|
+
finally { if (e_14) throw e_14.error; }
|
|
1204
1267
|
}
|
|
1205
1268
|
};
|
|
1206
1269
|
AcDbLibreDwgConverter.prototype.processLeaderObjectContextData = function (model, db) {
|
|
1207
|
-
var
|
|
1270
|
+
var e_15, _a;
|
|
1208
1271
|
var _b;
|
|
1209
1272
|
var contexts = (_b = this.optionalObjectArray(model, 'LEADEROBJECTCONTEXTDATA')) !== null && _b !== void 0 ? _b : this.optionalObjectArray(model, 'ACDB_LEADEROBJECTCONTEXTDATA_CLASS');
|
|
1210
1273
|
if (!(contexts === null || contexts === void 0 ? void 0 : contexts.length))
|
|
@@ -1219,16 +1282,16 @@ var AcDbLibreDwgConverter = /** @class */ (function (_super) {
|
|
|
1219
1282
|
contextDict.setAt(dbContext.objectId, dbContext);
|
|
1220
1283
|
}
|
|
1221
1284
|
}
|
|
1222
|
-
catch (
|
|
1285
|
+
catch (e_15_1) { e_15 = { error: e_15_1 }; }
|
|
1223
1286
|
finally {
|
|
1224
1287
|
try {
|
|
1225
1288
|
if (contexts_6_1 && !contexts_6_1.done && (_a = contexts_6.return)) _a.call(contexts_6);
|
|
1226
1289
|
}
|
|
1227
|
-
finally { if (
|
|
1290
|
+
finally { if (e_15) throw e_15.error; }
|
|
1228
1291
|
}
|
|
1229
1292
|
};
|
|
1230
1293
|
AcDbLibreDwgConverter.prototype.processMLeaderObjectContextData = function (model, db) {
|
|
1231
|
-
var
|
|
1294
|
+
var e_16, _a;
|
|
1232
1295
|
var _b;
|
|
1233
1296
|
var contexts = (_b = this.optionalObjectArray(model, 'MLEADEROBJECTCONTEXTDATA')) !== null && _b !== void 0 ? _b : this.optionalObjectArray(model, 'ACDB_MLEADEROBJECTCONTEXTDATA_CLASS');
|
|
1234
1297
|
if (!(contexts === null || contexts === void 0 ? void 0 : contexts.length))
|
|
@@ -1243,16 +1306,16 @@ var AcDbLibreDwgConverter = /** @class */ (function (_super) {
|
|
|
1243
1306
|
contextDict.setAt(dbContext.objectId, dbContext);
|
|
1244
1307
|
}
|
|
1245
1308
|
}
|
|
1246
|
-
catch (
|
|
1309
|
+
catch (e_16_1) { e_16 = { error: e_16_1 }; }
|
|
1247
1310
|
finally {
|
|
1248
1311
|
try {
|
|
1249
1312
|
if (contexts_7_1 && !contexts_7_1.done && (_a = contexts_7.return)) _a.call(contexts_7);
|
|
1250
1313
|
}
|
|
1251
|
-
finally { if (
|
|
1314
|
+
finally { if (e_16) throw e_16.error; }
|
|
1252
1315
|
}
|
|
1253
1316
|
};
|
|
1254
1317
|
AcDbLibreDwgConverter.prototype.processMTextAttributeObjectContextData = function (model, db) {
|
|
1255
|
-
var
|
|
1318
|
+
var e_17, _a;
|
|
1256
1319
|
var _b;
|
|
1257
1320
|
var contexts = (_b = this.optionalObjectArray(model, 'MTEXTATTRIBUTEOBJECTCONTEXTDATA')) !== null && _b !== void 0 ? _b : this.optionalObjectArray(model, 'ACDB_MTEXTATTRIBUTEOBJECTCONTEXTDATA_CLASS');
|
|
1258
1321
|
if (!(contexts === null || contexts === void 0 ? void 0 : contexts.length))
|
|
@@ -1267,16 +1330,16 @@ var AcDbLibreDwgConverter = /** @class */ (function (_super) {
|
|
|
1267
1330
|
contextDict.setAt(dbContext.objectId, dbContext);
|
|
1268
1331
|
}
|
|
1269
1332
|
}
|
|
1270
|
-
catch (
|
|
1333
|
+
catch (e_17_1) { e_17 = { error: e_17_1 }; }
|
|
1271
1334
|
finally {
|
|
1272
1335
|
try {
|
|
1273
1336
|
if (contexts_8_1 && !contexts_8_1.done && (_a = contexts_8.return)) _a.call(contexts_8);
|
|
1274
1337
|
}
|
|
1275
|
-
finally { if (
|
|
1338
|
+
finally { if (e_17) throw e_17.error; }
|
|
1276
1339
|
}
|
|
1277
1340
|
};
|
|
1278
1341
|
AcDbLibreDwgConverter.prototype.processXRecords = function (model, db) {
|
|
1279
|
-
var
|
|
1342
|
+
var e_18, _a;
|
|
1280
1343
|
var xrecords = model.objects.XRECORD;
|
|
1281
1344
|
if (!(xrecords === null || xrecords === void 0 ? void 0 : xrecords.length))
|
|
1282
1345
|
return;
|
|
@@ -1290,12 +1353,12 @@ var AcDbLibreDwgConverter = /** @class */ (function (_super) {
|
|
|
1290
1353
|
xrecordDict.setAt(dbXrecord.objectId, dbXrecord);
|
|
1291
1354
|
}
|
|
1292
1355
|
}
|
|
1293
|
-
catch (
|
|
1356
|
+
catch (e_18_1) { e_18 = { error: e_18_1 }; }
|
|
1294
1357
|
finally {
|
|
1295
1358
|
try {
|
|
1296
1359
|
if (xrecords_1_1 && !xrecords_1_1.done && (_a = xrecords_1.return)) _a.call(xrecords_1);
|
|
1297
1360
|
}
|
|
1298
|
-
finally { if (
|
|
1361
|
+
finally { if (e_18) throw e_18.error; }
|
|
1299
1362
|
}
|
|
1300
1363
|
};
|
|
1301
1364
|
/**
|
|
@@ -1303,7 +1366,7 @@ var AcDbLibreDwgConverter = /** @class */ (function (_super) {
|
|
|
1303
1366
|
* the ACAD_GROUP dictionary so ObjectARX-style names are available.
|
|
1304
1367
|
*/
|
|
1305
1368
|
AcDbLibreDwgConverter.prototype.processGroups = function (model, db) {
|
|
1306
|
-
var
|
|
1369
|
+
var e_19, _a, e_20, _b, e_21, _c, e_22, _d;
|
|
1307
1370
|
var _e, _f, _g, _h;
|
|
1308
1371
|
var groups = (_e = model.objects.GROUP) !== null && _e !== void 0 ? _e : this.optionalObjectArray(model, 'GROUP');
|
|
1309
1372
|
if (!(groups === null || groups === void 0 ? void 0 : groups.length))
|
|
@@ -1326,12 +1389,12 @@ var AcDbLibreDwgConverter = /** @class */ (function (_super) {
|
|
|
1326
1389
|
byHandle.set(normalize(dbGroup.objectId), dbGroup);
|
|
1327
1390
|
}
|
|
1328
1391
|
}
|
|
1329
|
-
catch (
|
|
1392
|
+
catch (e_19_1) { e_19 = { error: e_19_1 }; }
|
|
1330
1393
|
finally {
|
|
1331
1394
|
try {
|
|
1332
1395
|
if (groups_1_1 && !groups_1_1.done && (_a = groups_1.return)) _a.call(groups_1);
|
|
1333
1396
|
}
|
|
1334
|
-
finally { if (
|
|
1397
|
+
finally { if (e_19) throw e_19.error; }
|
|
1335
1398
|
}
|
|
1336
1399
|
// Resolve ACAD_GROUP dictionary entry names → group.name / dict keys.
|
|
1337
1400
|
var acadGroupHandle = '';
|
|
@@ -1345,12 +1408,12 @@ var AcDbLibreDwgConverter = /** @class */ (function (_super) {
|
|
|
1345
1408
|
}
|
|
1346
1409
|
}
|
|
1347
1410
|
}
|
|
1348
|
-
catch (
|
|
1411
|
+
catch (e_20_1) { e_20 = { error: e_20_1 }; }
|
|
1349
1412
|
finally {
|
|
1350
1413
|
try {
|
|
1351
1414
|
if (_k && !_k.done && (_b = _j.return)) _b.call(_j);
|
|
1352
1415
|
}
|
|
1353
|
-
finally { if (
|
|
1416
|
+
finally { if (e_20) throw e_20.error; }
|
|
1354
1417
|
}
|
|
1355
1418
|
if (!acadGroupHandle)
|
|
1356
1419
|
return;
|
|
@@ -1366,7 +1429,7 @@ var AcDbLibreDwgConverter = /** @class */ (function (_super) {
|
|
|
1366
1429
|
continue;
|
|
1367
1430
|
var storedKey = void 0;
|
|
1368
1431
|
try {
|
|
1369
|
-
for (var _p = (
|
|
1432
|
+
for (var _p = (e_22 = void 0, __values(groupDict.entries())), _q = _p.next(); !_q.done; _q = _p.next()) {
|
|
1370
1433
|
var _r = __read(_q.value, 2), key = _r[0], existing = _r[1];
|
|
1371
1434
|
if (normalize(existing.objectId) === handle) {
|
|
1372
1435
|
storedKey = key;
|
|
@@ -1374,12 +1437,12 @@ var AcDbLibreDwgConverter = /** @class */ (function (_super) {
|
|
|
1374
1437
|
}
|
|
1375
1438
|
}
|
|
1376
1439
|
}
|
|
1377
|
-
catch (
|
|
1440
|
+
catch (e_22_1) { e_22 = { error: e_22_1 }; }
|
|
1378
1441
|
finally {
|
|
1379
1442
|
try {
|
|
1380
1443
|
if (_q && !_q.done && (_d = _p.return)) _d.call(_p);
|
|
1381
1444
|
}
|
|
1382
|
-
finally { if (
|
|
1445
|
+
finally { if (e_22) throw e_22.error; }
|
|
1383
1446
|
}
|
|
1384
1447
|
var occupied = groupDict.getAt(entryName);
|
|
1385
1448
|
if (occupied && occupied !== group) {
|
|
@@ -1396,12 +1459,12 @@ var AcDbLibreDwgConverter = /** @class */ (function (_super) {
|
|
|
1396
1459
|
group.name = entryName;
|
|
1397
1460
|
}
|
|
1398
1461
|
}
|
|
1399
|
-
catch (
|
|
1462
|
+
catch (e_21_1) { e_21 = { error: e_21_1 }; }
|
|
1400
1463
|
finally {
|
|
1401
1464
|
try {
|
|
1402
1465
|
if (_m && !_m.done && (_c = _l.return)) _c.call(_l);
|
|
1403
1466
|
}
|
|
1404
|
-
finally { if (
|
|
1467
|
+
finally { if (e_21) throw e_21.error; }
|
|
1405
1468
|
}
|
|
1406
1469
|
};
|
|
1407
1470
|
/**
|
|
@@ -1409,7 +1472,7 @@ var AcDbLibreDwgConverter = /** @class */ (function (_super) {
|
|
|
1409
1472
|
* dictionaries have been materialized.
|
|
1410
1473
|
*/
|
|
1411
1474
|
AcDbLibreDwgConverter.prototype.finishCannoscale = function (model, db) {
|
|
1412
|
-
var
|
|
1475
|
+
var e_23, _a;
|
|
1413
1476
|
var _b, _c;
|
|
1414
1477
|
var tryRead = function (variableDict) {
|
|
1415
1478
|
var cannoscaleVar = variableDict.getAt('CANNOSCALE');
|
|
@@ -1450,19 +1513,19 @@ var AcDbLibreDwgConverter = /** @class */ (function (_super) {
|
|
|
1450
1513
|
return;
|
|
1451
1514
|
}
|
|
1452
1515
|
}
|
|
1453
|
-
catch (
|
|
1516
|
+
catch (e_23_1) { e_23 = { error: e_23_1 }; }
|
|
1454
1517
|
finally {
|
|
1455
1518
|
try {
|
|
1456
1519
|
if (_e && !_e.done && (_a = _d.return)) _a.call(_d);
|
|
1457
1520
|
}
|
|
1458
|
-
finally { if (
|
|
1521
|
+
finally { if (e_23) throw e_23.error; }
|
|
1459
1522
|
}
|
|
1460
1523
|
};
|
|
1461
1524
|
/**
|
|
1462
1525
|
* Reads ANNOALLVISIBLE from AcDbVariableDictionary → DICTIONARYVAR.
|
|
1463
1526
|
*/
|
|
1464
1527
|
AcDbLibreDwgConverter.prototype.finishAnnoallvisible = function (model, db) {
|
|
1465
|
-
var
|
|
1528
|
+
var e_24, _a;
|
|
1466
1529
|
var _b, _c;
|
|
1467
1530
|
var tryRead = function (variableDict) {
|
|
1468
1531
|
var annoVar = variableDict.getAt('ANNOALLVISIBLE');
|
|
@@ -1495,12 +1558,12 @@ var AcDbLibreDwgConverter = /** @class */ (function (_super) {
|
|
|
1495
1558
|
return;
|
|
1496
1559
|
}
|
|
1497
1560
|
}
|
|
1498
|
-
catch (
|
|
1561
|
+
catch (e_24_1) { e_24 = { error: e_24_1 }; }
|
|
1499
1562
|
finally {
|
|
1500
1563
|
try {
|
|
1501
1564
|
if (_e && !_e.done && (_a = _d.return)) _a.call(_d);
|
|
1502
1565
|
}
|
|
1503
|
-
finally { if (
|
|
1566
|
+
finally { if (e_24) throw e_24.error; }
|
|
1504
1567
|
}
|
|
1505
1568
|
};
|
|
1506
1569
|
/** Reads optional object arrays that newer libredwg-web builds may expose. */
|
|
@@ -1529,7 +1592,7 @@ var AcDbLibreDwgConverter = /** @class */ (function (_super) {
|
|
|
1529
1592
|
* @returns A new array of entities grouped by their `type` property.
|
|
1530
1593
|
*/
|
|
1531
1594
|
AcDbLibreDwgConverter.prototype.groupAndFlattenByType = function (entities) {
|
|
1532
|
-
var
|
|
1595
|
+
var e_25, _a, e_26, _b;
|
|
1533
1596
|
var groups = {};
|
|
1534
1597
|
var order = [];
|
|
1535
1598
|
try {
|
|
@@ -1542,12 +1605,12 @@ var AcDbLibreDwgConverter = /** @class */ (function (_super) {
|
|
|
1542
1605
|
groups[entity.type].push(entity);
|
|
1543
1606
|
}
|
|
1544
1607
|
}
|
|
1545
|
-
catch (
|
|
1608
|
+
catch (e_25_1) { e_25 = { error: e_25_1 }; }
|
|
1546
1609
|
finally {
|
|
1547
1610
|
try {
|
|
1548
1611
|
if (entities_1_1 && !entities_1_1.done && (_a = entities_1.return)) _a.call(entities_1);
|
|
1549
1612
|
}
|
|
1550
|
-
finally { if (
|
|
1613
|
+
finally { if (e_25) throw e_25.error; }
|
|
1551
1614
|
}
|
|
1552
1615
|
var result = [];
|
|
1553
1616
|
try {
|
|
@@ -1560,12 +1623,12 @@ var AcDbLibreDwgConverter = /** @class */ (function (_super) {
|
|
|
1560
1623
|
}
|
|
1561
1624
|
}
|
|
1562
1625
|
}
|
|
1563
|
-
catch (
|
|
1626
|
+
catch (e_26_1) { e_26 = { error: e_26_1 }; }
|
|
1564
1627
|
finally {
|
|
1565
1628
|
try {
|
|
1566
1629
|
if (order_1_1 && !order_1_1.done && (_b = order_1.return)) _b.call(order_1);
|
|
1567
1630
|
}
|
|
1568
|
-
finally { if (
|
|
1631
|
+
finally { if (e_26) throw e_26.error; }
|
|
1569
1632
|
}
|
|
1570
1633
|
return result;
|
|
1571
1634
|
};
|
|
@@ -1578,6 +1641,20 @@ var AcDbLibreDwgConverter = /** @class */ (function (_super) {
|
|
|
1578
1641
|
var trimmed = value.trim();
|
|
1579
1642
|
return trimmed.length > 0 ? trimmed : undefined;
|
|
1580
1643
|
};
|
|
1644
|
+
/**
|
|
1645
|
+
* Coerces a LibreDWG header value to a 3D point when it looks like one.
|
|
1646
|
+
* Needed because some UCS direction fields are mistyped as `number` upstream.
|
|
1647
|
+
*/
|
|
1648
|
+
AcDbLibreDwgConverter.prototype.asHeaderPoint3d = function (value) {
|
|
1649
|
+
if (value != null &&
|
|
1650
|
+
typeof value === 'object' &&
|
|
1651
|
+
typeof value.x === 'number' &&
|
|
1652
|
+
typeof value.y === 'number' &&
|
|
1653
|
+
typeof value.z === 'number') {
|
|
1654
|
+
return value;
|
|
1655
|
+
}
|
|
1656
|
+
return undefined;
|
|
1657
|
+
};
|
|
1581
1658
|
return AcDbLibreDwgConverter;
|
|
1582
1659
|
}(AcDbDatabaseConverter));
|
|
1583
1660
|
export { AcDbLibreDwgConverter };
|