@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.
@@ -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(libredwg.dwg_ref_get_absref(imagedefreactor_ref));
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
- let colorIndex = color.index;
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
- const tio = libredwg.dwg_object_to_object_tio(obj);
7021
- if (tio) {
7022
- const fixedtype = libredwg.dwg_object_get_fixedtype(obj);
7023
- switch (fixedtype) {
7024
- case Dwg_Object_Type.DWG_TYPE_LAYER:
7025
- {
7026
- const layer = this.convertLayer(tio, obj);
7027
- db.tables.LAYER.entries.push(layer);
7028
- this.entityConverter.layers.set(layer.handle, layer.name);
7029
- }
7030
- break;
7031
- case Dwg_Object_Type.DWG_TYPE_LTYPE:
7032
- {
7033
- const ltype = this.convertLineType(tio, obj);
7034
- db.tables.LTYPE.entries.push(ltype);
7035
- this.entityConverter.ltypes.set(ltype.handle, ltype.name);
7036
- }
7037
- break;
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
- const tio = libredwg.dwg_object_to_object_tio(obj);
7044
- if (tio) {
7045
- const fixedtype = libredwg.dwg_object_get_fixedtype(obj);
7046
- switch (fixedtype) {
7047
- case Dwg_Object_Type.DWG_TYPE_BLOCK_HEADER:
7048
- {
7049
- const btr = this.convertBlockRecord(tio, obj);
7050
- db.tables.BLOCK_RECORD.entries.push(btr);
7051
- if (isModelSpace(btr.name) || isPaperSpace(btr.name)) {
7052
- btr.entities.forEach((entity) => db.entities.push(entity));
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
- break;
7056
- case Dwg_Object_Type.DWG_TYPE_DIMSTYLE:
7057
- db.tables.DIMSTYLE.entries.push(this.convertDimStyle(tio, obj));
7058
- break;
7059
- case Dwg_Object_Type.DWG_TYPE_STYLE:
7060
- db.tables.STYLE.entries.push(this.convertStyle(tio, obj));
7061
- break;
7062
- case Dwg_Object_Type.DWG_TYPE_VPORT:
7063
- db.tables.VPORT.entries.push(this.convertViewport(tio, obj));
7064
- break;
7065
- case Dwg_Object_Type.DWG_TYPE_IMAGEDEF:
7066
- db.objects.IMAGEDEF.push(this.convertImageDef(tio, obj));
7067
- break;
7068
- case Dwg_Object_Type.DWG_TYPE_LAYOUT:
7069
- db.objects.LAYOUT.push(this.convertLayout(tio, obj));
7070
- break;
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
- for (let index = 0; index < num_owned; index++) {
7156
- const object = libredwg.dwg_ref_get_object(object_ref_ptr_array[index]);
7157
- const entity = converter.convert(object);
7158
- if (entity) {
7159
- entity.ownerBlockRecordSoftId = commonAttrs.handle;
7160
- entities.push(entity);
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 = isValidPointer(named_ucs_ref) ? idToString(libredwg.dwg_ref_get_absref(named_ucs_ref)) : void 0;
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(libredwg.dwg_ref_get_absref(imagedefreactor_ref));
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
- let colorIndex = color.index;
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
- const tio = libredwg.dwg_object_to_object_tio(obj);
7026
- if (tio) {
7027
- const fixedtype = libredwg.dwg_object_get_fixedtype(obj);
7028
- switch (fixedtype) {
7029
- case Dwg_Object_Type.DWG_TYPE_LAYER:
7030
- {
7031
- const layer = this.convertLayer(tio, obj);
7032
- db.tables.LAYER.entries.push(layer);
7033
- this.entityConverter.layers.set(layer.handle, layer.name);
7034
- }
7035
- break;
7036
- case Dwg_Object_Type.DWG_TYPE_LTYPE:
7037
- {
7038
- const ltype = this.convertLineType(tio, obj);
7039
- db.tables.LTYPE.entries.push(ltype);
7040
- this.entityConverter.ltypes.set(ltype.handle, ltype.name);
7041
- }
7042
- break;
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
- const tio = libredwg.dwg_object_to_object_tio(obj);
7049
- if (tio) {
7050
- const fixedtype = libredwg.dwg_object_get_fixedtype(obj);
7051
- switch (fixedtype) {
7052
- case Dwg_Object_Type.DWG_TYPE_BLOCK_HEADER:
7053
- {
7054
- const btr = this.convertBlockRecord(tio, obj);
7055
- db.tables.BLOCK_RECORD.entries.push(btr);
7056
- if (isModelSpace(btr.name) || isPaperSpace(btr.name)) {
7057
- btr.entities.forEach((entity) => db.entities.push(entity));
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
- break;
7061
- case Dwg_Object_Type.DWG_TYPE_DIMSTYLE:
7062
- db.tables.DIMSTYLE.entries.push(this.convertDimStyle(tio, obj));
7063
- break;
7064
- case Dwg_Object_Type.DWG_TYPE_STYLE:
7065
- db.tables.STYLE.entries.push(this.convertStyle(tio, obj));
7066
- break;
7067
- case Dwg_Object_Type.DWG_TYPE_VPORT:
7068
- db.tables.VPORT.entries.push(this.convertViewport(tio, obj));
7069
- break;
7070
- case Dwg_Object_Type.DWG_TYPE_IMAGEDEF:
7071
- db.objects.IMAGEDEF.push(this.convertImageDef(tio, obj));
7072
- break;
7073
- case Dwg_Object_Type.DWG_TYPE_LAYOUT:
7074
- db.objects.LAYOUT.push(this.convertLayout(tio, obj));
7075
- break;
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
- for (let index = 0; index < num_owned; index++) {
7161
- const object = libredwg.dwg_ref_get_object(object_ref_ptr_array[index]);
7162
- const entity = converter.convert(object);
7163
- if (entity) {
7164
- entity.ownerBlockRecordSoftId = commonAttrs.handle;
7165
- entities.push(entity);
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 = isValidPointer(named_ucs_ref) ? idToString(libredwg.dwg_ref_get_absref(named_ucs_ref)) : void 0;
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, idToString, isModelSpace, isPaperSpace, isValidPointer } from '../database';
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
- const tio = libredwg.dwg_object_to_object_tio(obj);
52
- if (tio) {
53
- const fixedtype = libredwg.dwg_object_get_fixedtype(obj);
54
- switch (fixedtype) {
55
- case Dwg_Object_Type.DWG_TYPE_LAYER:
56
- {
57
- const layer = this.convertLayer(tio, obj);
58
- db.tables.LAYER.entries.push(layer);
59
- this.entityConverter.layers.set(layer.handle, layer.name);
60
- }
61
- break;
62
- case Dwg_Object_Type.DWG_TYPE_LTYPE:
63
- {
64
- const ltype = this.convertLineType(tio, obj);
65
- db.tables.LTYPE.entries.push(ltype);
66
- this.entityConverter.ltypes.set(ltype.handle, ltype.name);
67
- }
68
- break;
69
- default:
70
- break;
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
- const tio = libredwg.dwg_object_to_object_tio(obj);
77
- if (tio) {
78
- const fixedtype = libredwg.dwg_object_get_fixedtype(obj);
79
- switch (fixedtype) {
80
- case Dwg_Object_Type.DWG_TYPE_BLOCK_HEADER:
81
- {
82
- const btr = this.convertBlockRecord(tio, obj);
83
- db.tables.BLOCK_RECORD.entries.push(btr);
84
- // db.entities should contains entities in model space and paper space only
85
- if (isModelSpace(btr.name) || isPaperSpace(btr.name)) {
86
- btr.entities.forEach(entity => db.entities.push(entity));
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
- break;
90
- case Dwg_Object_Type.DWG_TYPE_DIMSTYLE:
91
- db.tables.DIMSTYLE.entries.push(this.convertDimStyle(tio, obj));
92
- break;
93
- case Dwg_Object_Type.DWG_TYPE_STYLE:
94
- db.tables.STYLE.entries.push(this.convertStyle(tio, obj));
95
- break;
96
- case Dwg_Object_Type.DWG_TYPE_VPORT:
97
- db.tables.VPORT.entries.push(this.convertViewport(tio, obj));
98
- break;
99
- case Dwg_Object_Type.DWG_TYPE_IMAGEDEF:
100
- db.objects.IMAGEDEF.push(this.convertImageDef(tio, obj));
101
- break;
102
- case Dwg_Object_Type.DWG_TYPE_LAYOUT:
103
- db.objects.LAYOUT.push(this.convertLayout(tio, obj));
104
- break;
105
- default:
106
- break;
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
- const object_ref_ptr_array = libredwg.dwg_ptr_to_object_ref_ptr_array(entities_ptr, num_owned);
205
- const converter = this.entityConverter;
206
- entities = [];
207
- for (let index = 0; index < num_owned; index++) {
208
- const object = libredwg.dwg_ref_get_object(object_ref_ptr_array[index]);
209
- const entity = converter.convert(object);
210
- if (entity) {
211
- entity.ownerBlockRecordSoftId = commonAttrs.handle;
212
- entities.push(entity);
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 = isValidPointer(named_ucs_ref)
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, idToString } from '../database';
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
- let colorIndex = color.index;
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,4 @@
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
+ //# sourceMappingURL=utils.d.ts.map
@@ -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
@@ -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;
@@ -1,20 +1,2 @@
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
- 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
@@ -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 = { __assert_fail: ___assert_fail, __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 };
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"];
@@ -1,4 +1,5 @@
1
- import { DwgAttachmentPoint, DwgTextHorizontalAlign, isModelSpace } from '../database';
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,4 @@
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
+ //# sourceMappingURL=common.d.ts.map
@@ -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
@@ -0,0 +1,2 @@
1
+ export * from './common';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,2 @@
1
+ export * from './common';
2
+ //# sourceMappingURL=index.js.map
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "description": "A DWG/DXF JavaScript parser based on libredwg",
4
4
  "license": "GPL-2.0-only",
5
5
  "private": false,
6
- "version": "0.6.2",
6
+ "version": "0.6.4",
7
7
  "author": "MLight Lee <mlight.lee@outlook.com>",
8
8
  "type": "module",
9
9
  "repository": {