@mlightcad/libredwg-web 0.6.2 → 0.6.4
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 +85 -86
- package/dist/libredwg-web.umd.cjs +84 -85
- package/lib/converter/converter.js +71 -64
- package/lib/converter/entityConverter.js +3 -2
- package/lib/converter/utils.d.ts +4 -0
- package/lib/converter/utils.js +12 -0
- package/lib/database/common.d.ts +0 -4
- package/lib/database/common.js +1 -19
- package/lib/libredwg-web.js +32 -33
- package/lib/svg/svgConverter.js +2 -1
- package/lib/utils/common.d.ts +4 -0
- package/lib/utils/common.js +12 -0
- package/lib/utils/index.d.ts +2 -0
- package/lib/utils/index.js +2 -0
- package/package.json +1 -1
package/dist/libredwg-web.js
CHANGED
|
@@ -1,24 +1,6 @@
|
|
|
1
1
|
var __defProp = Object.defineProperty;
|
|
2
2
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
3
|
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
4
|
-
const MODEL_SPACE = "*MODEL_SPACE";
|
|
5
|
-
const MODEL_SPACE_PREFIX = "*PAPER_SPACE";
|
|
6
|
-
const isModelSpace = (name) => {
|
|
7
|
-
return name && name.toUpperCase() == MODEL_SPACE;
|
|
8
|
-
};
|
|
9
|
-
const isPaperSpace = (name) => {
|
|
10
|
-
return name && name.toUpperCase().startsWith(MODEL_SPACE_PREFIX);
|
|
11
|
-
};
|
|
12
|
-
const idToString = (id) => {
|
|
13
|
-
return id.toString(16).toUpperCase();
|
|
14
|
-
};
|
|
15
|
-
const isValidPointer = (ptr) => {
|
|
16
|
-
if (typeof ptr === "bigint") {
|
|
17
|
-
return ptr !== 0n;
|
|
18
|
-
} else {
|
|
19
|
-
return ptr !== 0;
|
|
20
|
-
}
|
|
21
|
-
};
|
|
22
4
|
var DwgCodePage = /* @__PURE__ */ ((DwgCodePage2) => {
|
|
23
5
|
DwgCodePage2[DwgCodePage2["CP_UTF8"] = 0] = "CP_UTF8";
|
|
24
6
|
DwgCodePage2[DwgCodePage2["CP_US_ASCII"] = 1] = "CP_US_ASCII";
|
|
@@ -5256,6 +5238,17 @@ var Dwg_Hatch_Edge_Type = /* @__PURE__ */ ((Dwg_Hatch_Edge_Type2) => {
|
|
|
5256
5238
|
Dwg_Hatch_Edge_Type2[Dwg_Hatch_Edge_Type2["Spline"] = 4] = "Spline";
|
|
5257
5239
|
return Dwg_Hatch_Edge_Type2;
|
|
5258
5240
|
})(Dwg_Hatch_Edge_Type || {});
|
|
5241
|
+
const MODEL_SPACE = "*MODEL_SPACE";
|
|
5242
|
+
const MODEL_SPACE_PREFIX = "*PAPER_SPACE";
|
|
5243
|
+
const isModelSpace = (name) => {
|
|
5244
|
+
return name && name.toUpperCase() == MODEL_SPACE;
|
|
5245
|
+
};
|
|
5246
|
+
const isPaperSpace = (name) => {
|
|
5247
|
+
return name && name.toUpperCase().startsWith(MODEL_SPACE_PREFIX);
|
|
5248
|
+
};
|
|
5249
|
+
const idToString = (id) => {
|
|
5250
|
+
return id.toString(16).toUpperCase();
|
|
5251
|
+
};
|
|
5259
5252
|
class LibreEntityConverter {
|
|
5260
5253
|
constructor(instance) {
|
|
5261
5254
|
__publicField(this, "libredwg");
|
|
@@ -5839,7 +5832,9 @@ class LibreEntityConverter {
|
|
|
5839
5832
|
entity,
|
|
5840
5833
|
"imagedefreactor"
|
|
5841
5834
|
).data;
|
|
5842
|
-
const imageDefReactorHandle = idToString(
|
|
5835
|
+
const imageDefReactorHandle = idToString(
|
|
5836
|
+
libredwg.dwg_ref_get_absref(imagedefreactor_ref)
|
|
5837
|
+
);
|
|
5843
5838
|
return {
|
|
5844
5839
|
type: "IMAGE",
|
|
5845
5840
|
...commonAttrs,
|
|
@@ -6933,7 +6928,7 @@ class LibreEntityConverter {
|
|
|
6933
6928
|
const libredwg = this.libredwg;
|
|
6934
6929
|
const color = libredwg.dwg_object_entity_get_color_object(entity);
|
|
6935
6930
|
const method = color.method;
|
|
6936
|
-
|
|
6931
|
+
const colorIndex = color.index;
|
|
6937
6932
|
let rgbColor = void 0;
|
|
6938
6933
|
if (method == 194 || (color.rgb >>> 24 & 255) === 194) {
|
|
6939
6934
|
rgbColor = color.rgb & 16777215;
|
|
@@ -7017,57 +7012,61 @@ class LibreDwgConverter {
|
|
|
7017
7012
|
const num_objects = libredwg.dwg_get_num_objects(data);
|
|
7018
7013
|
for (let i = 0; i < num_objects; i++) {
|
|
7019
7014
|
const obj = libredwg.dwg_get_object(data, i);
|
|
7020
|
-
|
|
7021
|
-
|
|
7022
|
-
|
|
7023
|
-
|
|
7024
|
-
|
|
7025
|
-
|
|
7026
|
-
|
|
7027
|
-
|
|
7028
|
-
|
|
7029
|
-
|
|
7030
|
-
|
|
7031
|
-
|
|
7032
|
-
|
|
7033
|
-
|
|
7034
|
-
|
|
7035
|
-
|
|
7036
|
-
|
|
7037
|
-
|
|
7015
|
+
if (obj) {
|
|
7016
|
+
const tio = libredwg.dwg_object_to_object_tio(obj);
|
|
7017
|
+
if (tio) {
|
|
7018
|
+
const fixedtype = libredwg.dwg_object_get_fixedtype(obj);
|
|
7019
|
+
switch (fixedtype) {
|
|
7020
|
+
case Dwg_Object_Type.DWG_TYPE_LAYER:
|
|
7021
|
+
{
|
|
7022
|
+
const layer = this.convertLayer(tio, obj);
|
|
7023
|
+
db.tables.LAYER.entries.push(layer);
|
|
7024
|
+
this.entityConverter.layers.set(layer.handle, layer.name);
|
|
7025
|
+
}
|
|
7026
|
+
break;
|
|
7027
|
+
case Dwg_Object_Type.DWG_TYPE_LTYPE:
|
|
7028
|
+
{
|
|
7029
|
+
const ltype = this.convertLineType(tio, obj);
|
|
7030
|
+
db.tables.LTYPE.entries.push(ltype);
|
|
7031
|
+
this.entityConverter.ltypes.set(ltype.handle, ltype.name);
|
|
7032
|
+
}
|
|
7033
|
+
break;
|
|
7034
|
+
}
|
|
7038
7035
|
}
|
|
7039
7036
|
}
|
|
7040
7037
|
}
|
|
7041
7038
|
for (let i = 0; i < num_objects; i++) {
|
|
7042
7039
|
const obj = libredwg.dwg_get_object(data, i);
|
|
7043
|
-
|
|
7044
|
-
|
|
7045
|
-
|
|
7046
|
-
|
|
7047
|
-
|
|
7048
|
-
|
|
7049
|
-
|
|
7050
|
-
|
|
7051
|
-
|
|
7052
|
-
btr.
|
|
7040
|
+
if (obj) {
|
|
7041
|
+
const tio = libredwg.dwg_object_to_object_tio(obj);
|
|
7042
|
+
if (tio) {
|
|
7043
|
+
const fixedtype = libredwg.dwg_object_get_fixedtype(obj);
|
|
7044
|
+
switch (fixedtype) {
|
|
7045
|
+
case Dwg_Object_Type.DWG_TYPE_BLOCK_HEADER:
|
|
7046
|
+
{
|
|
7047
|
+
const btr = this.convertBlockRecord(tio, obj);
|
|
7048
|
+
db.tables.BLOCK_RECORD.entries.push(btr);
|
|
7049
|
+
if (isModelSpace(btr.name) || isPaperSpace(btr.name)) {
|
|
7050
|
+
btr.entities.forEach((entity) => db.entities.push(entity));
|
|
7051
|
+
}
|
|
7053
7052
|
}
|
|
7054
|
-
|
|
7055
|
-
|
|
7056
|
-
|
|
7057
|
-
|
|
7058
|
-
|
|
7059
|
-
|
|
7060
|
-
|
|
7061
|
-
|
|
7062
|
-
|
|
7063
|
-
|
|
7064
|
-
|
|
7065
|
-
|
|
7066
|
-
|
|
7067
|
-
|
|
7068
|
-
|
|
7069
|
-
|
|
7070
|
-
|
|
7053
|
+
break;
|
|
7054
|
+
case Dwg_Object_Type.DWG_TYPE_DIMSTYLE:
|
|
7055
|
+
db.tables.DIMSTYLE.entries.push(this.convertDimStyle(tio, obj));
|
|
7056
|
+
break;
|
|
7057
|
+
case Dwg_Object_Type.DWG_TYPE_STYLE:
|
|
7058
|
+
db.tables.STYLE.entries.push(this.convertStyle(tio, obj));
|
|
7059
|
+
break;
|
|
7060
|
+
case Dwg_Object_Type.DWG_TYPE_VPORT:
|
|
7061
|
+
db.tables.VPORT.entries.push(this.convertViewport(tio, obj));
|
|
7062
|
+
break;
|
|
7063
|
+
case Dwg_Object_Type.DWG_TYPE_IMAGEDEF:
|
|
7064
|
+
db.objects.IMAGEDEF.push(this.convertImageDef(tio, obj));
|
|
7065
|
+
break;
|
|
7066
|
+
case Dwg_Object_Type.DWG_TYPE_LAYOUT:
|
|
7067
|
+
db.objects.LAYOUT.push(this.convertLayout(tio, obj));
|
|
7068
|
+
break;
|
|
7069
|
+
}
|
|
7071
7070
|
}
|
|
7072
7071
|
}
|
|
7073
7072
|
}
|
|
@@ -7087,9 +7086,9 @@ class LibreDwgConverter {
|
|
|
7087
7086
|
}
|
|
7088
7087
|
let value = libredwg.dwg_dynapi_header_value(data, var_name).data;
|
|
7089
7088
|
if (name == "CELTYPE" || name == "CLAYER" || name == "CLAYER" || name == "DIMSTYLE" || name == "DIMTXSTY" || name == "TEXTSTYLE") {
|
|
7090
|
-
value = libredwg.dwg_ref_get_object_name(value);
|
|
7089
|
+
value = !!value ? libredwg.dwg_ref_get_object_name(value) : "";
|
|
7091
7090
|
} else if (name == "DRAGVS") {
|
|
7092
|
-
value = libredwg.dwg_ref_get_absref(value);
|
|
7091
|
+
value = !!value ? libredwg.dwg_ref_get_absref(value) : 2;
|
|
7093
7092
|
}
|
|
7094
7093
|
header[name] = value;
|
|
7095
7094
|
});
|
|
@@ -7144,20 +7143,24 @@ class LibreDwgConverter {
|
|
|
7144
7143
|
bmpPreview = uint8ArrayToHexString(bmpPreviewBinaryData);
|
|
7145
7144
|
}
|
|
7146
7145
|
let entities = this.convertEntities(obj, commonAttrs.handle);
|
|
7147
|
-
if (entities.length == 0) {
|
|
7148
|
-
const entities_ptr = libredwg.dwg_dynapi_entity_value(item, "entities").data;
|
|
7149
|
-
const object_ref_ptr_array = libredwg.dwg_ptr_to_object_ref_ptr_array(
|
|
7150
|
-
entities_ptr,
|
|
7151
|
-
num_owned
|
|
7152
|
-
);
|
|
7153
|
-
const converter = this.entityConverter;
|
|
7146
|
+
if (!entities || entities.length == 0) {
|
|
7154
7147
|
entities = [];
|
|
7155
|
-
|
|
7156
|
-
|
|
7157
|
-
const
|
|
7158
|
-
|
|
7159
|
-
|
|
7160
|
-
|
|
7148
|
+
const entities_ptr = libredwg.dwg_dynapi_entity_value(item, "entities").data;
|
|
7149
|
+
if (entities_ptr) {
|
|
7150
|
+
const object_ref_ptr_array = libredwg.dwg_ptr_to_object_ref_ptr_array(
|
|
7151
|
+
entities_ptr,
|
|
7152
|
+
num_owned
|
|
7153
|
+
);
|
|
7154
|
+
const converter = this.entityConverter;
|
|
7155
|
+
for (let index = 0; index < num_owned; index++) {
|
|
7156
|
+
const object = libredwg.dwg_ref_get_object(
|
|
7157
|
+
object_ref_ptr_array[index]
|
|
7158
|
+
);
|
|
7159
|
+
const entity = converter.convert(object);
|
|
7160
|
+
if (entity) {
|
|
7161
|
+
entity.ownerBlockRecordSoftId = commonAttrs.handle;
|
|
7162
|
+
entities.push(entity);
|
|
7163
|
+
}
|
|
7161
7164
|
}
|
|
7162
7165
|
}
|
|
7163
7166
|
}
|
|
@@ -7621,7 +7624,7 @@ class LibreDwgConverter {
|
|
|
7621
7624
|
libredwg.dwg_ref_get_absref(active_viewport_ref)
|
|
7622
7625
|
);
|
|
7623
7626
|
const named_ucs_ref = libredwg.dwg_dynapi_entity_value(item, "named_ucs").data;
|
|
7624
|
-
const namedUcsId =
|
|
7627
|
+
const namedUcsId = !!named_ucs_ref ? idToString(libredwg.dwg_ref_get_absref(named_ucs_ref)) : void 0;
|
|
7625
7628
|
return {
|
|
7626
7629
|
...commonAttrs,
|
|
7627
7630
|
layoutName,
|
|
@@ -10056,9 +10059,5 @@ export {
|
|
|
10056
10059
|
LibreDwg,
|
|
10057
10060
|
createModule,
|
|
10058
10061
|
dwgCodePageToEncoding,
|
|
10059
|
-
dwgVersions
|
|
10060
|
-
idToString,
|
|
10061
|
-
isModelSpace,
|
|
10062
|
-
isPaperSpace,
|
|
10063
|
-
isValidPointer
|
|
10062
|
+
dwgVersions
|
|
10064
10063
|
};
|
|
@@ -6,24 +6,6 @@ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { en
|
|
|
6
6
|
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
7
7
|
|
|
8
8
|
var _documentCurrentScript = typeof document !== "undefined" ? document.currentScript : null;
|
|
9
|
-
const MODEL_SPACE = "*MODEL_SPACE";
|
|
10
|
-
const MODEL_SPACE_PREFIX = "*PAPER_SPACE";
|
|
11
|
-
const isModelSpace = (name) => {
|
|
12
|
-
return name && name.toUpperCase() == MODEL_SPACE;
|
|
13
|
-
};
|
|
14
|
-
const isPaperSpace = (name) => {
|
|
15
|
-
return name && name.toUpperCase().startsWith(MODEL_SPACE_PREFIX);
|
|
16
|
-
};
|
|
17
|
-
const idToString = (id) => {
|
|
18
|
-
return id.toString(16).toUpperCase();
|
|
19
|
-
};
|
|
20
|
-
const isValidPointer = (ptr) => {
|
|
21
|
-
if (typeof ptr === "bigint") {
|
|
22
|
-
return ptr !== 0n;
|
|
23
|
-
} else {
|
|
24
|
-
return ptr !== 0;
|
|
25
|
-
}
|
|
26
|
-
};
|
|
27
9
|
var DwgCodePage = /* @__PURE__ */ ((DwgCodePage2) => {
|
|
28
10
|
DwgCodePage2[DwgCodePage2["CP_UTF8"] = 0] = "CP_UTF8";
|
|
29
11
|
DwgCodePage2[DwgCodePage2["CP_US_ASCII"] = 1] = "CP_US_ASCII";
|
|
@@ -5261,6 +5243,17 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
5261
5243
|
Dwg_Hatch_Edge_Type2[Dwg_Hatch_Edge_Type2["Spline"] = 4] = "Spline";
|
|
5262
5244
|
return Dwg_Hatch_Edge_Type2;
|
|
5263
5245
|
})(Dwg_Hatch_Edge_Type || {});
|
|
5246
|
+
const MODEL_SPACE = "*MODEL_SPACE";
|
|
5247
|
+
const MODEL_SPACE_PREFIX = "*PAPER_SPACE";
|
|
5248
|
+
const isModelSpace = (name) => {
|
|
5249
|
+
return name && name.toUpperCase() == MODEL_SPACE;
|
|
5250
|
+
};
|
|
5251
|
+
const isPaperSpace = (name) => {
|
|
5252
|
+
return name && name.toUpperCase().startsWith(MODEL_SPACE_PREFIX);
|
|
5253
|
+
};
|
|
5254
|
+
const idToString = (id) => {
|
|
5255
|
+
return id.toString(16).toUpperCase();
|
|
5256
|
+
};
|
|
5264
5257
|
class LibreEntityConverter {
|
|
5265
5258
|
constructor(instance) {
|
|
5266
5259
|
__publicField(this, "libredwg");
|
|
@@ -5844,7 +5837,9 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
5844
5837
|
entity,
|
|
5845
5838
|
"imagedefreactor"
|
|
5846
5839
|
).data;
|
|
5847
|
-
const imageDefReactorHandle = idToString(
|
|
5840
|
+
const imageDefReactorHandle = idToString(
|
|
5841
|
+
libredwg.dwg_ref_get_absref(imagedefreactor_ref)
|
|
5842
|
+
);
|
|
5848
5843
|
return {
|
|
5849
5844
|
type: "IMAGE",
|
|
5850
5845
|
...commonAttrs,
|
|
@@ -6938,7 +6933,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
6938
6933
|
const libredwg = this.libredwg;
|
|
6939
6934
|
const color = libredwg.dwg_object_entity_get_color_object(entity);
|
|
6940
6935
|
const method = color.method;
|
|
6941
|
-
|
|
6936
|
+
const colorIndex = color.index;
|
|
6942
6937
|
let rgbColor = void 0;
|
|
6943
6938
|
if (method == 194 || (color.rgb >>> 24 & 255) === 194) {
|
|
6944
6939
|
rgbColor = color.rgb & 16777215;
|
|
@@ -7022,57 +7017,61 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
7022
7017
|
const num_objects = libredwg.dwg_get_num_objects(data);
|
|
7023
7018
|
for (let i = 0; i < num_objects; i++) {
|
|
7024
7019
|
const obj = libredwg.dwg_get_object(data, i);
|
|
7025
|
-
|
|
7026
|
-
|
|
7027
|
-
|
|
7028
|
-
|
|
7029
|
-
|
|
7030
|
-
|
|
7031
|
-
|
|
7032
|
-
|
|
7033
|
-
|
|
7034
|
-
|
|
7035
|
-
|
|
7036
|
-
|
|
7037
|
-
|
|
7038
|
-
|
|
7039
|
-
|
|
7040
|
-
|
|
7041
|
-
|
|
7042
|
-
|
|
7020
|
+
if (obj) {
|
|
7021
|
+
const tio = libredwg.dwg_object_to_object_tio(obj);
|
|
7022
|
+
if (tio) {
|
|
7023
|
+
const fixedtype = libredwg.dwg_object_get_fixedtype(obj);
|
|
7024
|
+
switch (fixedtype) {
|
|
7025
|
+
case Dwg_Object_Type.DWG_TYPE_LAYER:
|
|
7026
|
+
{
|
|
7027
|
+
const layer = this.convertLayer(tio, obj);
|
|
7028
|
+
db.tables.LAYER.entries.push(layer);
|
|
7029
|
+
this.entityConverter.layers.set(layer.handle, layer.name);
|
|
7030
|
+
}
|
|
7031
|
+
break;
|
|
7032
|
+
case Dwg_Object_Type.DWG_TYPE_LTYPE:
|
|
7033
|
+
{
|
|
7034
|
+
const ltype = this.convertLineType(tio, obj);
|
|
7035
|
+
db.tables.LTYPE.entries.push(ltype);
|
|
7036
|
+
this.entityConverter.ltypes.set(ltype.handle, ltype.name);
|
|
7037
|
+
}
|
|
7038
|
+
break;
|
|
7039
|
+
}
|
|
7043
7040
|
}
|
|
7044
7041
|
}
|
|
7045
7042
|
}
|
|
7046
7043
|
for (let i = 0; i < num_objects; i++) {
|
|
7047
7044
|
const obj = libredwg.dwg_get_object(data, i);
|
|
7048
|
-
|
|
7049
|
-
|
|
7050
|
-
|
|
7051
|
-
|
|
7052
|
-
|
|
7053
|
-
|
|
7054
|
-
|
|
7055
|
-
|
|
7056
|
-
|
|
7057
|
-
btr.
|
|
7045
|
+
if (obj) {
|
|
7046
|
+
const tio = libredwg.dwg_object_to_object_tio(obj);
|
|
7047
|
+
if (tio) {
|
|
7048
|
+
const fixedtype = libredwg.dwg_object_get_fixedtype(obj);
|
|
7049
|
+
switch (fixedtype) {
|
|
7050
|
+
case Dwg_Object_Type.DWG_TYPE_BLOCK_HEADER:
|
|
7051
|
+
{
|
|
7052
|
+
const btr = this.convertBlockRecord(tio, obj);
|
|
7053
|
+
db.tables.BLOCK_RECORD.entries.push(btr);
|
|
7054
|
+
if (isModelSpace(btr.name) || isPaperSpace(btr.name)) {
|
|
7055
|
+
btr.entities.forEach((entity) => db.entities.push(entity));
|
|
7056
|
+
}
|
|
7058
7057
|
}
|
|
7059
|
-
|
|
7060
|
-
|
|
7061
|
-
|
|
7062
|
-
|
|
7063
|
-
|
|
7064
|
-
|
|
7065
|
-
|
|
7066
|
-
|
|
7067
|
-
|
|
7068
|
-
|
|
7069
|
-
|
|
7070
|
-
|
|
7071
|
-
|
|
7072
|
-
|
|
7073
|
-
|
|
7074
|
-
|
|
7075
|
-
|
|
7058
|
+
break;
|
|
7059
|
+
case Dwg_Object_Type.DWG_TYPE_DIMSTYLE:
|
|
7060
|
+
db.tables.DIMSTYLE.entries.push(this.convertDimStyle(tio, obj));
|
|
7061
|
+
break;
|
|
7062
|
+
case Dwg_Object_Type.DWG_TYPE_STYLE:
|
|
7063
|
+
db.tables.STYLE.entries.push(this.convertStyle(tio, obj));
|
|
7064
|
+
break;
|
|
7065
|
+
case Dwg_Object_Type.DWG_TYPE_VPORT:
|
|
7066
|
+
db.tables.VPORT.entries.push(this.convertViewport(tio, obj));
|
|
7067
|
+
break;
|
|
7068
|
+
case Dwg_Object_Type.DWG_TYPE_IMAGEDEF:
|
|
7069
|
+
db.objects.IMAGEDEF.push(this.convertImageDef(tio, obj));
|
|
7070
|
+
break;
|
|
7071
|
+
case Dwg_Object_Type.DWG_TYPE_LAYOUT:
|
|
7072
|
+
db.objects.LAYOUT.push(this.convertLayout(tio, obj));
|
|
7073
|
+
break;
|
|
7074
|
+
}
|
|
7076
7075
|
}
|
|
7077
7076
|
}
|
|
7078
7077
|
}
|
|
@@ -7092,9 +7091,9 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
7092
7091
|
}
|
|
7093
7092
|
let value = libredwg.dwg_dynapi_header_value(data, var_name).data;
|
|
7094
7093
|
if (name == "CELTYPE" || name == "CLAYER" || name == "CLAYER" || name == "DIMSTYLE" || name == "DIMTXSTY" || name == "TEXTSTYLE") {
|
|
7095
|
-
value = libredwg.dwg_ref_get_object_name(value);
|
|
7094
|
+
value = !!value ? libredwg.dwg_ref_get_object_name(value) : "";
|
|
7096
7095
|
} else if (name == "DRAGVS") {
|
|
7097
|
-
value = libredwg.dwg_ref_get_absref(value);
|
|
7096
|
+
value = !!value ? libredwg.dwg_ref_get_absref(value) : 2;
|
|
7098
7097
|
}
|
|
7099
7098
|
header[name] = value;
|
|
7100
7099
|
});
|
|
@@ -7149,20 +7148,24 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
7149
7148
|
bmpPreview = uint8ArrayToHexString(bmpPreviewBinaryData);
|
|
7150
7149
|
}
|
|
7151
7150
|
let entities = this.convertEntities(obj, commonAttrs.handle);
|
|
7152
|
-
if (entities.length == 0) {
|
|
7153
|
-
const entities_ptr = libredwg.dwg_dynapi_entity_value(item, "entities").data;
|
|
7154
|
-
const object_ref_ptr_array = libredwg.dwg_ptr_to_object_ref_ptr_array(
|
|
7155
|
-
entities_ptr,
|
|
7156
|
-
num_owned
|
|
7157
|
-
);
|
|
7158
|
-
const converter = this.entityConverter;
|
|
7151
|
+
if (!entities || entities.length == 0) {
|
|
7159
7152
|
entities = [];
|
|
7160
|
-
|
|
7161
|
-
|
|
7162
|
-
const
|
|
7163
|
-
|
|
7164
|
-
|
|
7165
|
-
|
|
7153
|
+
const entities_ptr = libredwg.dwg_dynapi_entity_value(item, "entities").data;
|
|
7154
|
+
if (entities_ptr) {
|
|
7155
|
+
const object_ref_ptr_array = libredwg.dwg_ptr_to_object_ref_ptr_array(
|
|
7156
|
+
entities_ptr,
|
|
7157
|
+
num_owned
|
|
7158
|
+
);
|
|
7159
|
+
const converter = this.entityConverter;
|
|
7160
|
+
for (let index = 0; index < num_owned; index++) {
|
|
7161
|
+
const object = libredwg.dwg_ref_get_object(
|
|
7162
|
+
object_ref_ptr_array[index]
|
|
7163
|
+
);
|
|
7164
|
+
const entity = converter.convert(object);
|
|
7165
|
+
if (entity) {
|
|
7166
|
+
entity.ownerBlockRecordSoftId = commonAttrs.handle;
|
|
7167
|
+
entities.push(entity);
|
|
7168
|
+
}
|
|
7166
7169
|
}
|
|
7167
7170
|
}
|
|
7168
7171
|
}
|
|
@@ -7626,7 +7629,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
7626
7629
|
libredwg.dwg_ref_get_absref(active_viewport_ref)
|
|
7627
7630
|
);
|
|
7628
7631
|
const named_ucs_ref = libredwg.dwg_dynapi_entity_value(item, "named_ucs").data;
|
|
7629
|
-
const namedUcsId =
|
|
7632
|
+
const namedUcsId = !!named_ucs_ref ? idToString(libredwg.dwg_ref_get_absref(named_ucs_ref)) : void 0;
|
|
7630
7633
|
return {
|
|
7631
7634
|
...commonAttrs,
|
|
7632
7635
|
layoutName,
|
|
@@ -10061,9 +10064,5 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
10061
10064
|
exports2.createModule = createModule;
|
|
10062
10065
|
exports2.dwgCodePageToEncoding = dwgCodePageToEncoding;
|
|
10063
10066
|
exports2.dwgVersions = dwgVersions;
|
|
10064
|
-
exports2.idToString = idToString;
|
|
10065
|
-
exports2.isModelSpace = isModelSpace;
|
|
10066
|
-
exports2.isPaperSpace = isPaperSpace;
|
|
10067
|
-
exports2.isValidPointer = isValidPointer;
|
|
10068
10067
|
Object.defineProperty(exports2, Symbol.toStringTag, { value: "Module" });
|
|
10069
10068
|
});
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { HEADER_VARIABLES
|
|
1
|
+
import { HEADER_VARIABLES } from '../database';
|
|
2
2
|
import { Dwg_Object_Type } from '../types';
|
|
3
3
|
import { LibreEntityConverter } from './entityConverter';
|
|
4
|
+
import { idToString, isModelSpace, isPaperSpace } from './utils';
|
|
4
5
|
/**
|
|
5
6
|
* Class used to convert Dwg_Data instance to DwgDatabase instance.
|
|
6
7
|
*/
|
|
@@ -48,62 +49,66 @@ export class LibreDwgConverter {
|
|
|
48
49
|
const num_objects = libredwg.dwg_get_num_objects(data);
|
|
49
50
|
for (let i = 0; i < num_objects; i++) {
|
|
50
51
|
const obj = libredwg.dwg_get_object(data, i);
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
52
|
+
if (obj) {
|
|
53
|
+
const tio = libredwg.dwg_object_to_object_tio(obj);
|
|
54
|
+
if (tio) {
|
|
55
|
+
const fixedtype = libredwg.dwg_object_get_fixedtype(obj);
|
|
56
|
+
switch (fixedtype) {
|
|
57
|
+
case Dwg_Object_Type.DWG_TYPE_LAYER:
|
|
58
|
+
{
|
|
59
|
+
const layer = this.convertLayer(tio, obj);
|
|
60
|
+
db.tables.LAYER.entries.push(layer);
|
|
61
|
+
this.entityConverter.layers.set(layer.handle, layer.name);
|
|
62
|
+
}
|
|
63
|
+
break;
|
|
64
|
+
case Dwg_Object_Type.DWG_TYPE_LTYPE:
|
|
65
|
+
{
|
|
66
|
+
const ltype = this.convertLineType(tio, obj);
|
|
67
|
+
db.tables.LTYPE.entries.push(ltype);
|
|
68
|
+
this.entityConverter.ltypes.set(ltype.handle, ltype.name);
|
|
69
|
+
}
|
|
70
|
+
break;
|
|
71
|
+
default:
|
|
72
|
+
break;
|
|
73
|
+
}
|
|
71
74
|
}
|
|
72
75
|
}
|
|
73
76
|
}
|
|
74
77
|
for (let i = 0; i < num_objects; i++) {
|
|
75
78
|
const obj = libredwg.dwg_get_object(data, i);
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
btr.
|
|
79
|
+
if (obj) {
|
|
80
|
+
const tio = libredwg.dwg_object_to_object_tio(obj);
|
|
81
|
+
if (tio) {
|
|
82
|
+
const fixedtype = libredwg.dwg_object_get_fixedtype(obj);
|
|
83
|
+
switch (fixedtype) {
|
|
84
|
+
case Dwg_Object_Type.DWG_TYPE_BLOCK_HEADER:
|
|
85
|
+
{
|
|
86
|
+
const btr = this.convertBlockRecord(tio, obj);
|
|
87
|
+
db.tables.BLOCK_RECORD.entries.push(btr);
|
|
88
|
+
// db.entities should contains entities in model space and paper space only
|
|
89
|
+
if (isModelSpace(btr.name) || isPaperSpace(btr.name)) {
|
|
90
|
+
btr.entities.forEach(entity => db.entities.push(entity));
|
|
91
|
+
}
|
|
87
92
|
}
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
93
|
+
break;
|
|
94
|
+
case Dwg_Object_Type.DWG_TYPE_DIMSTYLE:
|
|
95
|
+
db.tables.DIMSTYLE.entries.push(this.convertDimStyle(tio, obj));
|
|
96
|
+
break;
|
|
97
|
+
case Dwg_Object_Type.DWG_TYPE_STYLE:
|
|
98
|
+
db.tables.STYLE.entries.push(this.convertStyle(tio, obj));
|
|
99
|
+
break;
|
|
100
|
+
case Dwg_Object_Type.DWG_TYPE_VPORT:
|
|
101
|
+
db.tables.VPORT.entries.push(this.convertViewport(tio, obj));
|
|
102
|
+
break;
|
|
103
|
+
case Dwg_Object_Type.DWG_TYPE_IMAGEDEF:
|
|
104
|
+
db.objects.IMAGEDEF.push(this.convertImageDef(tio, obj));
|
|
105
|
+
break;
|
|
106
|
+
case Dwg_Object_Type.DWG_TYPE_LAYOUT:
|
|
107
|
+
db.objects.LAYOUT.push(this.convertLayout(tio, obj));
|
|
108
|
+
break;
|
|
109
|
+
default:
|
|
110
|
+
break;
|
|
111
|
+
}
|
|
107
112
|
}
|
|
108
113
|
}
|
|
109
114
|
}
|
|
@@ -130,10 +135,10 @@ export class LibreDwgConverter {
|
|
|
130
135
|
name == 'DIMSTYLE' ||
|
|
131
136
|
name == 'DIMTXSTY' ||
|
|
132
137
|
name == 'TEXTSTYLE') {
|
|
133
|
-
value = libredwg.dwg_ref_get_object_name(value);
|
|
138
|
+
value = !!value ? libredwg.dwg_ref_get_object_name(value) : '';
|
|
134
139
|
}
|
|
135
140
|
else if (name == 'DRAGVS') {
|
|
136
|
-
value = libredwg.dwg_ref_get_absref(value);
|
|
141
|
+
value = !!value ? libredwg.dwg_ref_get_absref(value) : 2;
|
|
137
142
|
}
|
|
138
143
|
// @ts-expect-error header variable name
|
|
139
144
|
header[name] = value;
|
|
@@ -198,18 +203,20 @@ export class LibreDwgConverter {
|
|
|
198
203
|
// I guess it is one bug on libredwg. I logged [one bug](https://github.com/LibreDWG/libredwg/issues/1199)
|
|
199
204
|
// on libredwg too. In this time, I try to use property 'entities' of block header to iterate entities.
|
|
200
205
|
let entities = this.convertEntities(obj, commonAttrs.handle);
|
|
201
|
-
if (entities.length == 0) {
|
|
206
|
+
if (!entities || entities.length == 0) {
|
|
207
|
+
entities = [];
|
|
202
208
|
const entities_ptr = libredwg.dwg_dynapi_entity_value(item, 'entities')
|
|
203
209
|
.data;
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
210
|
+
if (entities_ptr) {
|
|
211
|
+
const object_ref_ptr_array = libredwg.dwg_ptr_to_object_ref_ptr_array(entities_ptr, num_owned);
|
|
212
|
+
const converter = this.entityConverter;
|
|
213
|
+
for (let index = 0; index < num_owned; index++) {
|
|
214
|
+
const object = libredwg.dwg_ref_get_object(object_ref_ptr_array[index]);
|
|
215
|
+
const entity = converter.convert(object);
|
|
216
|
+
if (entity) {
|
|
217
|
+
entity.ownerBlockRecordSoftId = commonAttrs.handle;
|
|
218
|
+
entities.push(entity);
|
|
219
|
+
}
|
|
213
220
|
}
|
|
214
221
|
}
|
|
215
222
|
}
|
|
@@ -802,7 +809,7 @@ export class LibreDwgConverter {
|
|
|
802
809
|
const viewportId = idToString(libredwg.dwg_ref_get_absref(active_viewport_ref));
|
|
803
810
|
const named_ucs_ref = libredwg.dwg_dynapi_entity_value(item, 'named_ucs')
|
|
804
811
|
.data;
|
|
805
|
-
const namedUcsId =
|
|
812
|
+
const namedUcsId = !!named_ucs_ref
|
|
806
813
|
? idToString(libredwg.dwg_ref_get_absref(named_ucs_ref))
|
|
807
814
|
: undefined;
|
|
808
815
|
// BITCODE_H base_ucs;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { DwgBoundaryPathEdgeType, DwgHatchAssociativity, DwgHatchSolidFill
|
|
1
|
+
import { DwgBoundaryPathEdgeType, DwgHatchAssociativity, DwgHatchSolidFill } from '../database';
|
|
2
2
|
import { Dwg_Hatch_Edge_Type, Dwg_Object_Type } from '../types';
|
|
3
|
+
import { idToString } from './utils';
|
|
3
4
|
export class LibreEntityConverter {
|
|
4
5
|
libredwg;
|
|
5
6
|
layers = new Map();
|
|
@@ -1567,7 +1568,7 @@ export class LibreEntityConverter {
|
|
|
1567
1568
|
// - 0xc5 for foreground color
|
|
1568
1569
|
// - 0xc8 for none (also c3 and rgb of 0x101)
|
|
1569
1570
|
const method = color.method;
|
|
1570
|
-
|
|
1571
|
+
const colorIndex = color.index;
|
|
1571
1572
|
let rgbColor = undefined;
|
|
1572
1573
|
if (method == 0xc2 || ((color.rgb >>> 24) & 0xff) === 0xc2) {
|
|
1573
1574
|
rgbColor = color.rgb & 0x00ffffff;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
const MODEL_SPACE = '*MODEL_SPACE';
|
|
2
|
+
const MODEL_SPACE_PREFIX = '*PAPER_SPACE';
|
|
3
|
+
export const isModelSpace = (name) => {
|
|
4
|
+
return name && name.toUpperCase() == MODEL_SPACE;
|
|
5
|
+
};
|
|
6
|
+
export const isPaperSpace = (name) => {
|
|
7
|
+
return name && name.toUpperCase().startsWith(MODEL_SPACE_PREFIX);
|
|
8
|
+
};
|
|
9
|
+
export const idToString = (id) => {
|
|
10
|
+
return id.toString(16).toUpperCase();
|
|
11
|
+
};
|
|
12
|
+
//# sourceMappingURL=utils.js.map
|
package/lib/database/common.d.ts
CHANGED
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
export declare const isModelSpace: (name: string) => boolean | "";
|
|
2
|
-
export declare const isPaperSpace: (name: string) => boolean | "";
|
|
3
|
-
export declare const idToString: (id: number | bigint) => string;
|
|
4
|
-
export declare const isValidPointer: (ptr: number | bigint) => boolean;
|
|
5
1
|
export interface DwgPoint2D {
|
|
6
2
|
x: number;
|
|
7
3
|
y: number;
|
package/lib/database/common.js
CHANGED
|
@@ -1,20 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
const MODEL_SPACE_PREFIX = '*PAPER_SPACE';
|
|
3
|
-
export const isModelSpace = (name) => {
|
|
4
|
-
return name && name.toUpperCase() == MODEL_SPACE;
|
|
5
|
-
};
|
|
6
|
-
export const isPaperSpace = (name) => {
|
|
7
|
-
return name && name.toUpperCase().startsWith(MODEL_SPACE_PREFIX);
|
|
8
|
-
};
|
|
9
|
-
export const idToString = (id) => {
|
|
10
|
-
return id.toString(16).toUpperCase();
|
|
11
|
-
};
|
|
12
|
-
export const isValidPointer = (ptr) => {
|
|
13
|
-
if (typeof ptr === 'bigint') {
|
|
14
|
-
return ptr !== 0n;
|
|
15
|
-
}
|
|
16
|
-
else {
|
|
17
|
-
return ptr !== 0;
|
|
18
|
-
}
|
|
19
|
-
};
|
|
1
|
+
export {};
|
|
20
2
|
//# sourceMappingURL=common.js.map
|
package/lib/libredwg-web.js
CHANGED
|
@@ -199,38 +199,6 @@ var createModule = (() => {
|
|
|
199
199
|
} }
|
|
200
200
|
var stackRestore = val => __emscripten_stack_restore(val);
|
|
201
201
|
var stackSave = () => _emscripten_stack_get_current();
|
|
202
|
-
var UTF8Decoder = typeof TextDecoder != "undefined" ? new TextDecoder : undefined;
|
|
203
|
-
var UTF8ArrayToString = (heapOrArray, idx = 0, maxBytesToRead = NaN) => { var endIdx = idx + maxBytesToRead; var endPtr = idx; while (heapOrArray[endPtr] && !(endPtr >= endIdx))
|
|
204
|
-
++endPtr; if (endPtr - idx > 16 && heapOrArray.buffer && UTF8Decoder) {
|
|
205
|
-
return UTF8Decoder.decode(heapOrArray.subarray(idx, endPtr));
|
|
206
|
-
} var str = ""; while (idx < endPtr) {
|
|
207
|
-
var u0 = heapOrArray[idx++];
|
|
208
|
-
if (!(u0 & 128)) {
|
|
209
|
-
str += String.fromCharCode(u0);
|
|
210
|
-
continue;
|
|
211
|
-
}
|
|
212
|
-
var u1 = heapOrArray[idx++] & 63;
|
|
213
|
-
if ((u0 & 224) == 192) {
|
|
214
|
-
str += String.fromCharCode((u0 & 31) << 6 | u1);
|
|
215
|
-
continue;
|
|
216
|
-
}
|
|
217
|
-
var u2 = heapOrArray[idx++] & 63;
|
|
218
|
-
if ((u0 & 240) == 224) {
|
|
219
|
-
u0 = (u0 & 15) << 12 | u1 << 6 | u2;
|
|
220
|
-
}
|
|
221
|
-
else {
|
|
222
|
-
u0 = (u0 & 7) << 18 | u1 << 12 | u2 << 6 | heapOrArray[idx++] & 63;
|
|
223
|
-
}
|
|
224
|
-
if (u0 < 65536) {
|
|
225
|
-
str += String.fromCharCode(u0);
|
|
226
|
-
}
|
|
227
|
-
else {
|
|
228
|
-
var ch = u0 - 65536;
|
|
229
|
-
str += String.fromCharCode(55296 | ch >> 10, 56320 | ch & 1023);
|
|
230
|
-
}
|
|
231
|
-
} return str; };
|
|
232
|
-
var UTF8ToString = (ptr, maxBytesToRead) => ptr ? UTF8ArrayToString(HEAPU8, ptr, maxBytesToRead) : "";
|
|
233
|
-
var ___assert_fail = (condition, filename, line, func) => abort(`Assertion failed: ${UTF8ToString(condition)}, at: ` + [filename ? UTF8ToString(filename) : "unknown filename", line, func ? UTF8ToString(func) : "unknown function"]);
|
|
234
202
|
class ExceptionInfo {
|
|
235
203
|
constructor(excPtr) { this.excPtr = excPtr; this.ptr = excPtr - 24; }
|
|
236
204
|
set_type(type) { HEAPU32[this.ptr + 4 >> 2] = type; }
|
|
@@ -306,6 +274,36 @@ var createModule = (() => {
|
|
|
306
274
|
} var outputParts = []; for (var i = samePartsLength; i < fromParts.length; i++) {
|
|
307
275
|
outputParts.push("..");
|
|
308
276
|
} outputParts = outputParts.concat(toParts.slice(samePartsLength)); return outputParts.join("/"); } };
|
|
277
|
+
var UTF8Decoder = typeof TextDecoder != "undefined" ? new TextDecoder : undefined;
|
|
278
|
+
var UTF8ArrayToString = (heapOrArray, idx = 0, maxBytesToRead = NaN) => { var endIdx = idx + maxBytesToRead; var endPtr = idx; while (heapOrArray[endPtr] && !(endPtr >= endIdx))
|
|
279
|
+
++endPtr; if (endPtr - idx > 16 && heapOrArray.buffer && UTF8Decoder) {
|
|
280
|
+
return UTF8Decoder.decode(heapOrArray.subarray(idx, endPtr));
|
|
281
|
+
} var str = ""; while (idx < endPtr) {
|
|
282
|
+
var u0 = heapOrArray[idx++];
|
|
283
|
+
if (!(u0 & 128)) {
|
|
284
|
+
str += String.fromCharCode(u0);
|
|
285
|
+
continue;
|
|
286
|
+
}
|
|
287
|
+
var u1 = heapOrArray[idx++] & 63;
|
|
288
|
+
if ((u0 & 224) == 192) {
|
|
289
|
+
str += String.fromCharCode((u0 & 31) << 6 | u1);
|
|
290
|
+
continue;
|
|
291
|
+
}
|
|
292
|
+
var u2 = heapOrArray[idx++] & 63;
|
|
293
|
+
if ((u0 & 240) == 224) {
|
|
294
|
+
u0 = (u0 & 15) << 12 | u1 << 6 | u2;
|
|
295
|
+
}
|
|
296
|
+
else {
|
|
297
|
+
u0 = (u0 & 7) << 18 | u1 << 12 | u2 << 6 | heapOrArray[idx++] & 63;
|
|
298
|
+
}
|
|
299
|
+
if (u0 < 65536) {
|
|
300
|
+
str += String.fromCharCode(u0);
|
|
301
|
+
}
|
|
302
|
+
else {
|
|
303
|
+
var ch = u0 - 65536;
|
|
304
|
+
str += String.fromCharCode(55296 | ch >> 10, 56320 | ch & 1023);
|
|
305
|
+
}
|
|
306
|
+
} return str; };
|
|
309
307
|
var FS_stdin_getChar_buffer = [];
|
|
310
308
|
var lengthBytesUTF8 = str => { var len = 0; for (var i = 0; i < str.length; ++i) {
|
|
311
309
|
var c = str.charCodeAt(i);
|
|
@@ -1248,6 +1246,7 @@ var createModule = (() => {
|
|
|
1248
1246
|
} return size; } stream_ops.read = (stream, buffer, offset, length, position) => { FS.forceLoadFile(node); return writeChunks(stream, buffer, offset, length, position); }; stream_ops.mmap = (stream, length, position, prot, flags) => { FS.forceLoadFile(node); var ptr = mmapAlloc(length); if (!ptr) {
|
|
1249
1247
|
throw new FS.ErrnoError(48);
|
|
1250
1248
|
} writeChunks(stream, HEAP8, ptr, length, position); return { ptr, allocated: true }; }; node.stream_ops = stream_ops; return node; } };
|
|
1249
|
+
var UTF8ToString = (ptr, maxBytesToRead) => ptr ? UTF8ArrayToString(HEAPU8, ptr, maxBytesToRead) : "";
|
|
1251
1250
|
var SYSCALLS = { DEFAULT_POLLMASK: 5, calculateAt(dirfd, path, allowEmpty) { if (PATH.isAbs(path)) {
|
|
1252
1251
|
return path;
|
|
1253
1252
|
} var dir; if (dirfd === -100) {
|
|
@@ -2314,7 +2313,7 @@ var createModule = (() => {
|
|
|
2314
2313
|
init_RegisteredPointer();
|
|
2315
2314
|
UnboundTypeError = Module["UnboundTypeError"] = extendError(Error, "UnboundTypeError");
|
|
2316
2315
|
init_emval();
|
|
2317
|
-
var wasmImports = {
|
|
2316
|
+
var wasmImports = { __cxa_throw: ___cxa_throw, __syscall_fcntl64: ___syscall_fcntl64, __syscall_fstat64: ___syscall_fstat64, __syscall_ioctl: ___syscall_ioctl, __syscall_lstat64: ___syscall_lstat64, __syscall_newfstatat: ___syscall_newfstatat, __syscall_openat: ___syscall_openat, __syscall_stat64: ___syscall_stat64, _abort_js: __abort_js, _embind_register_bigint: __embind_register_bigint, _embind_register_bool: __embind_register_bool, _embind_register_class: __embind_register_class, _embind_register_class_property: __embind_register_class_property, _embind_register_emval: __embind_register_emval, _embind_register_enum: __embind_register_enum, _embind_register_enum_value: __embind_register_enum_value, _embind_register_float: __embind_register_float, _embind_register_function: __embind_register_function, _embind_register_integer: __embind_register_integer, _embind_register_memory_view: __embind_register_memory_view, _embind_register_std_string: __embind_register_std_string, _embind_register_std_wstring: __embind_register_std_wstring, _embind_register_void: __embind_register_void, _emval_call: __emval_call, _emval_call_method: __emval_call_method, _emval_decref: __emval_decref, _emval_get_global: __emval_get_global, _emval_get_method_caller: __emval_get_method_caller, _emval_incref: __emval_incref, _emval_new_array: __emval_new_array, _emval_new_cstring: __emval_new_cstring, _emval_new_object: __emval_new_object, _emval_run_destructors: __emval_run_destructors, _emval_set_property: __emval_set_property, _emval_take_value: __emval_take_value, _gmtime_js: __gmtime_js, _mktime_js: __mktime_js, _tzset_js: __tzset_js, emscripten_date_now: _emscripten_date_now, emscripten_resize_heap: _emscripten_resize_heap, environ_get: _environ_get, environ_sizes_get: _environ_sizes_get, fd_close: _fd_close, fd_read: _fd_read, fd_seek: _fd_seek, fd_write: _fd_write };
|
|
2318
2317
|
var wasmExports = await createWasm();
|
|
2319
2318
|
var ___wasm_call_ctors = wasmExports["__wasm_call_ctors"];
|
|
2320
2319
|
var _malloc = wasmExports["malloc"];
|
package/lib/svg/svgConverter.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { isModelSpace } from '../converter/utils';
|
|
2
|
+
import { DwgAttachmentPoint, DwgTextHorizontalAlign } from '../database';
|
|
2
3
|
import { Box2D } from './box2d';
|
|
3
4
|
import { evaluateBSpline } from './bspline';
|
|
4
5
|
import { Color } from './color';
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
const MODEL_SPACE = '*MODEL_SPACE';
|
|
2
|
+
const MODEL_SPACE_PREFIX = '*PAPER_SPACE';
|
|
3
|
+
export const isModelSpace = (name) => {
|
|
4
|
+
return name && name.toUpperCase() == MODEL_SPACE;
|
|
5
|
+
};
|
|
6
|
+
export const isPaperSpace = (name) => {
|
|
7
|
+
return name && name.toUpperCase().startsWith(MODEL_SPACE_PREFIX);
|
|
8
|
+
};
|
|
9
|
+
export const idToString = (id) => {
|
|
10
|
+
return id.toString(16).toUpperCase();
|
|
11
|
+
};
|
|
12
|
+
//# sourceMappingURL=common.js.map
|
package/package.json
CHANGED