@mlightcad/libredwg-web 0.5.0 → 0.6.0

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/README.md CHANGED
@@ -1,148 +1,148 @@
1
- # libredwg-web
2
-
3
- This is a DWG/DXF JavaScript parser based on libredwg. It can be used in browser and Node.js environments.
4
-
5
- - [Live demo](https://mlightcad.github.io/libredwg-web/)
6
- - [API docs](https://mlightcad.github.io/libredwg-web/docs/)
7
-
8
- ## Build WebAssembly
9
-
10
- Download and install emscripten according to [this doc](https://emscripten.org/docs/getting_started/downloads.html). Please make sure the following command is executed to activate `PATH` and other environment variables in the current terminal before building web assembly.
11
-
12
- Download and install [automake](https://www.gnu.org/software/automake/)
13
-
14
- Download and install [pnpm](https://pnpm.io)
15
-
16
- All can also be installed using homebrew:
17
-
18
- ```bash
19
- brew install emscripten
20
- brew install automake
21
- brew install pnpm
22
- ```
23
-
24
- ```bash
25
- # Activate PATH and other environment variables for emscripten in the current terminal if needed
26
- source ./emsdk_env.sh
27
-
28
- # run autogen
29
- ./autogen.sh
30
-
31
- # change directory
32
- cd bindings/javascript
33
-
34
- # Install npm dependencies to build JavaScript bindings for libredwg
35
- pnpm install
36
-
37
- # Check for dependencies, available tools, and system configurations and prepare the software package for building libredwg on a specific system
38
- pnpm build:prepare
39
-
40
- # Compile and build libredwg
41
- pnpm build:obj
42
-
43
- # Use emscripten to build web assembly for libredwg
44
- pnpm build:wasm
45
-
46
- # Copy web assembly (wasm file and JavaScript glue code file) from build directory to distribution directory of this package
47
- pnpm copy
48
-
49
- # Build web assembly wrapper so that it is easier to use it
50
- pnpm build
51
- ```
52
-
53
- In order to reduce the size of wasm file, the following functionalities are not included by default when building web assembly.
54
-
55
- - write dwg file
56
- - read/write dxf file
57
- - import/export json file
58
-
59
- If you want those functionalities, just modify command `build:prepare` defined in [package.json](./package.json) and remove the following options.
60
-
61
- - disable-write
62
- - disable-json
63
- - disable-dxf
64
-
65
- ## Usage
66
-
67
- There are two approaches to use this package. No matter which approach to use, please do remember copying wasm file (libredwg.wasm) to the same folder as your JavaScript bundle file when deploying your application.
68
-
69
- ```bash
70
- npm install @mlightcad/libredwg-web
71
- ```
72
-
73
- ### Use Raw Web Assembly
74
-
75
- The raw web assembly module (wasm file and JavaScript glue code file) is stored in folder [wasm](./wasm/).
76
-
77
- ```javascript
78
- import { createModule } from "@mlightcad/libredwg-web/wasm/libredwg-web.js";
79
-
80
- // Create libredwg module
81
- const libredwg = await createModule();
82
-
83
- // Store file content to one temporary file and read it
84
- const fileName = 'tmp.dwg';
85
- libredwg.FS.writeFile(
86
- fileName,
87
- new Uint8Array(fileContent)
88
- );
89
- const result = libredwg.dwg_read_file(fileName);
90
- if (result.error != 0) {
91
- console.log('Failed to open dwg file with error code: ', result.error);
92
- }
93
- libredwg.FS.unlink(fileName);
94
-
95
- // Get pointer to Dwg_Data
96
- const data = result.data;
97
- ```
98
-
99
- ### Use Web Assembly Wrapper
100
-
101
- Web assembly wrapper is stored in folder [dist](./dist/). It provides one class `LibreDwg` to wrap the web assembly. This class provides
102
-
103
- - Method to convert dwg data to [DwgDatabase](https://mlightcad.github.io/libredwg-web/docs/interfaces/database_database.DwgDatabase.html) instance with the strong type definition so that it is easy to use.
104
- - More methods that the raw web assembly API doesn't provide.
105
-
106
- ```typescript
107
- import { Dwg_File_Type, LibreDwg } from '@mlightcad/libredwg-web';
108
- const libredwg = await LibreDwg.create();
109
- const dwg = libredwg.dwg_read_data(fileContent, Dwg_File_Type.DWG);
110
- const db = this.libredwg.convert(dwg);
111
-
112
- // Affter conversion, 'dwg' isn't needed any more. So you can call
113
- // function 'dwg_free' to free its memory.
114
- this.libredwg.dwg_free(db);
115
- ```
116
-
117
- ### Usage with node.js
118
-
119
- ```typescript
120
- import { Dwg_File_Type, LibreDwg } from '@mlightcad/libredwg-web'
121
- // manually reference the wasm directory
122
- const libredwg = await LibreDwg.create(
123
- './node_modules/@mlightcad/libredwg-web/wasm/'
124
- )
125
-
126
- ```
127
-
128
- ## Interfaces
129
-
130
- There are two kinds of interfaces defined to access dwg/dxf drawing data.
131
-
132
- ### Interfaces with prifix 'Dwg'
133
-
134
- Those interfaces are much more easier to use with better data structure. It is quite similar to interfaces defined in project [@mlightcad/dxf-json](https://github.com/mlightcad/dxf-json). Those interfaces describe most of commonly used objects in the dwg/dxf drawing.
135
-
136
- ### Interfaces with prefix 'Dwg_'
137
-
138
- Those interfaces are JavaScript version of `structs` defined in libredwg C++ code. Only a few `structs` have the correponding JavaScript interface. Most of them are defined to make it easier to convert libredwg data structure to [DwgDatabase](https://mlightcad.github.io/libredwg-web/docs/interfaces/database_database.DwgDatabase.html).
139
-
140
- So it is recommend to use interfaces with prefix 'Dwg'.
141
-
142
- ## Demo App
143
-
144
- One demo app is provided in folder [examples](./examples/). You can run the following command to launch it.
145
-
146
- ```javascript
147
- pnpm demo
1
+ # libredwg-web
2
+
3
+ This is a DWG/DXF JavaScript parser based on libredwg. It can be used in browser and Node.js environments.
4
+
5
+ - [Live demo](https://mlightcad.github.io/libredwg-web/)
6
+ - [API docs](https://mlightcad.github.io/libredwg-web/docs/)
7
+
8
+ ## Build WebAssembly
9
+
10
+ Download and install emscripten according to [this doc](https://emscripten.org/docs/getting_started/downloads.html). Please make sure the following command is executed to activate `PATH` and other environment variables in the current terminal before building web assembly.
11
+
12
+ Download and install [automake](https://www.gnu.org/software/automake/)
13
+
14
+ Download and install [pnpm](https://pnpm.io)
15
+
16
+ All can also be installed using homebrew:
17
+
18
+ ```bash
19
+ brew install emscripten
20
+ brew install automake
21
+ brew install pnpm
22
+ ```
23
+
24
+ ```bash
25
+ # Activate PATH and other environment variables for emscripten in the current terminal if needed
26
+ source ./emsdk_env.sh
27
+
28
+ # run autogen
29
+ ./autogen.sh
30
+
31
+ # change directory
32
+ cd bindings/javascript
33
+
34
+ # Install npm dependencies to build JavaScript bindings for libredwg
35
+ pnpm install
36
+
37
+ # Check for dependencies, available tools, and system configurations and prepare the software package for building libredwg on a specific system
38
+ pnpm build:prepare
39
+
40
+ # Compile and build libredwg
41
+ pnpm build:obj
42
+
43
+ # Use emscripten to build web assembly for libredwg
44
+ pnpm build:wasm
45
+
46
+ # Copy web assembly (wasm file and JavaScript glue code file) from build directory to distribution directory of this package
47
+ pnpm copy
48
+
49
+ # Build web assembly wrapper so that it is easier to use it
50
+ pnpm build
51
+ ```
52
+
53
+ In order to reduce the size of wasm file, the following functionalities are not included by default when building web assembly.
54
+
55
+ - write dwg file
56
+ - read/write dxf file
57
+ - import/export json file
58
+
59
+ If you want those functionalities, just modify command `build:prepare` defined in [package.json](./package.json) and remove the following options.
60
+
61
+ - disable-write
62
+ - disable-json
63
+ - disable-dxf
64
+
65
+ ## Usage
66
+
67
+ There are two approaches to use this package. No matter which approach to use, please do remember copying wasm file (libredwg.wasm) to the same folder as your JavaScript bundle file when deploying your application.
68
+
69
+ ```bash
70
+ npm install @mlightcad/libredwg-web
71
+ ```
72
+
73
+ ### Use Raw Web Assembly
74
+
75
+ The raw web assembly module (wasm file and JavaScript glue code file) is stored in folder [wasm](./wasm/).
76
+
77
+ ```javascript
78
+ import { createModule } from "@mlightcad/libredwg-web/wasm/libredwg-web.js";
79
+
80
+ // Create libredwg module
81
+ const libredwg = await createModule();
82
+
83
+ // Store file content to one temporary file and read it
84
+ const fileName = 'tmp.dwg';
85
+ libredwg.FS.writeFile(
86
+ fileName,
87
+ new Uint8Array(fileContent)
88
+ );
89
+ const result = libredwg.dwg_read_file(fileName);
90
+ if (result.error != 0) {
91
+ console.log('Failed to open dwg file with error code: ', result.error);
92
+ }
93
+ libredwg.FS.unlink(fileName);
94
+
95
+ // Get pointer to Dwg_Data
96
+ const data = result.data;
97
+ ```
98
+
99
+ ### Use Web Assembly Wrapper
100
+
101
+ Web assembly wrapper is stored in folder [dist](./dist/). It provides one class `LibreDwg` to wrap the web assembly. This class provides
102
+
103
+ - Method to convert dwg data to [DwgDatabase](https://mlightcad.github.io/libredwg-web/docs/interfaces/database_database.DwgDatabase.html) instance with the strong type definition so that it is easy to use.
104
+ - More methods that the raw web assembly API doesn't provide.
105
+
106
+ ```typescript
107
+ import { Dwg_File_Type, LibreDwg } from '@mlightcad/libredwg-web';
108
+ const libredwg = await LibreDwg.create();
109
+ const dwg = libredwg.dwg_read_data(fileContent, Dwg_File_Type.DWG);
110
+ const db = this.libredwg.convert(dwg);
111
+
112
+ // Affter conversion, 'dwg' isn't needed any more. So you can call
113
+ // function 'dwg_free' to free its memory.
114
+ this.libredwg.dwg_free(db);
115
+ ```
116
+
117
+ ### Usage with node.js
118
+
119
+ ```typescript
120
+ import { Dwg_File_Type, LibreDwg } from '@mlightcad/libredwg-web'
121
+ // manually reference the wasm directory
122
+ const libredwg = await LibreDwg.create(
123
+ './node_modules/@mlightcad/libredwg-web/wasm/'
124
+ )
125
+
126
+ ```
127
+
128
+ ## Interfaces
129
+
130
+ There are two kinds of interfaces defined to access dwg/dxf drawing data.
131
+
132
+ ### Interfaces with prifix 'Dwg'
133
+
134
+ Those interfaces are much more easier to use with better data structure. It is quite similar to interfaces defined in project [@mlightcad/dxf-json](https://github.com/mlightcad/dxf-json). Those interfaces describe most of commonly used objects in the dwg/dxf drawing.
135
+
136
+ ### Interfaces with prefix 'Dwg_'
137
+
138
+ Those interfaces are JavaScript version of `structs` defined in libredwg C++ code. Only a few `structs` have the correponding JavaScript interface. Most of them are defined to make it easier to convert libredwg data structure to [DwgDatabase](https://mlightcad.github.io/libredwg-web/docs/interfaces/database_database.DwgDatabase.html).
139
+
140
+ So it is recommend to use interfaces with prefix 'Dwg'.
141
+
142
+ ## Demo App
143
+
144
+ One demo app is provided in folder [examples](./examples/). You can run the following command to launch it.
145
+
146
+ ```javascript
147
+ pnpm demo
148
148
  ```
@@ -9,6 +9,16 @@ const isModelSpace = (name) => {
9
9
  const isPaperSpace = (name) => {
10
10
  return name && name.toUpperCase().startsWith(MODEL_SPACE_PREFIX);
11
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
+ };
12
22
  var DwgCodePage = /* @__PURE__ */ ((DwgCodePage2) => {
13
23
  DwgCodePage2[DwgCodePage2["CP_UTF8"] = 0] = "CP_UTF8";
14
24
  DwgCodePage2[DwgCodePage2["CP_US_ASCII"] = 1] = "CP_US_ASCII";
@@ -6679,14 +6689,26 @@ class LibreEntityConverter {
6679
6689
  const gridSpacing = libredwg.dwg_dynapi_entity_value(entity, "GRIDUNIT").data;
6680
6690
  const viewDirection = libredwg.dwg_dynapi_entity_value(entity, "VIEWDIR").data;
6681
6691
  const targetPoint = libredwg.dwg_dynapi_entity_value(entity, "view_target").data;
6682
- const perspectiveLensLength = libredwg.dwg_dynapi_entity_value(entity, "lens_length").data;
6692
+ const perspectiveLensLength = libredwg.dwg_dynapi_entity_value(
6693
+ entity,
6694
+ "lens_length"
6695
+ ).data;
6683
6696
  const frontClipZ = libredwg.dwg_dynapi_entity_value(entity, "front_clip_z").data;
6684
6697
  const backClipZ = libredwg.dwg_dynapi_entity_value(entity, "back_clip_z").data;
6685
6698
  const viewHeight = libredwg.dwg_dynapi_entity_value(entity, "VIEWSIZE").data;
6686
6699
  const snapAngle = libredwg.dwg_dynapi_entity_value(entity, "SNAPANG").data;
6687
- const viewTwistAngle = libredwg.dwg_dynapi_entity_value(entity, "twist_angle").data;
6688
- const circleZoomPercent = libredwg.dwg_dynapi_entity_value(entity, "circle_zoom").data;
6689
- const statusBitFlags = libredwg.dwg_dynapi_entity_value(entity, "status_flag").data;
6700
+ const viewTwistAngle = libredwg.dwg_dynapi_entity_value(
6701
+ entity,
6702
+ "twist_angle"
6703
+ ).data;
6704
+ const circleZoomPercent = libredwg.dwg_dynapi_entity_value(
6705
+ entity,
6706
+ "circle_zoom"
6707
+ ).data;
6708
+ const statusBitFlags = libredwg.dwg_dynapi_entity_value(
6709
+ entity,
6710
+ "status_flag"
6711
+ ).data;
6690
6712
  const sheetName = libredwg.dwg_dynapi_entity_value(entity, "style_sheet").data;
6691
6713
  const renderMode = libredwg.dwg_dynapi_entity_value(entity, "render_mode").data;
6692
6714
  const ucsPerViewport = libredwg.dwg_dynapi_entity_value(entity, "UCSVP").data;
@@ -6697,19 +6719,40 @@ class LibreEntityConverter {
6697
6719
  const ucsId = libredwg.dwg_ref_get_absref(named_ucs_ref);
6698
6720
  const base_ucs_ref = libredwg.dwg_dynapi_entity_value(entity, "base_ucs").data;
6699
6721
  const ucsBaseId = libredwg.dwg_ref_get_absref(base_ucs_ref);
6700
- const orthographicType = libredwg.dwg_dynapi_entity_value(entity, "UCSORTHOVIEW").data;
6722
+ const orthographicType = libredwg.dwg_dynapi_entity_value(
6723
+ entity,
6724
+ "UCSORTHOVIEW"
6725
+ ).data;
6701
6726
  const elevation = libredwg.dwg_dynapi_entity_value(entity, "ucs_elevation").data;
6702
- const shadePlotMode = libredwg.dwg_dynapi_entity_value(entity, "shadeplot_mode").data;
6703
- const isDefaultLighting = libredwg.dwg_dynapi_entity_value(entity, "use_default_lights").data;
6704
- const defaultLightingType = libredwg.dwg_dynapi_entity_value(entity, "default_lighting_type").data;
6727
+ const shadePlotMode = libredwg.dwg_dynapi_entity_value(
6728
+ entity,
6729
+ "shadeplot_mode"
6730
+ ).data;
6731
+ const isDefaultLighting = libredwg.dwg_dynapi_entity_value(
6732
+ entity,
6733
+ "use_default_lights"
6734
+ ).data;
6735
+ const defaultLightingType = libredwg.dwg_dynapi_entity_value(
6736
+ entity,
6737
+ "default_lighting_type"
6738
+ ).data;
6705
6739
  const brightness = libredwg.dwg_dynapi_entity_value(entity, "brightness").data;
6706
6740
  const contrast = libredwg.dwg_dynapi_entity_value(entity, "contrast").data;
6707
- const majorGridFrequency = libredwg.dwg_dynapi_entity_value(entity, "grid_major").data;
6708
- const background_ref = libredwg.dwg_dynapi_entity_value(entity, "background").data;
6741
+ const majorGridFrequency = libredwg.dwg_dynapi_entity_value(
6742
+ entity,
6743
+ "grid_major"
6744
+ ).data;
6745
+ const background_ref = libredwg.dwg_dynapi_entity_value(
6746
+ entity,
6747
+ "background"
6748
+ ).data;
6709
6749
  const backgroundId = libredwg.dwg_ref_get_absref(background_ref);
6710
6750
  const shadeplot_ref = libredwg.dwg_dynapi_entity_value(entity, "shadeplot").data;
6711
6751
  const shadePlotId = libredwg.dwg_ref_get_absref(shadeplot_ref);
6712
- const visualstyle_ref = libredwg.dwg_dynapi_entity_value(entity, "visualstyle").data;
6752
+ const visualstyle_ref = libredwg.dwg_dynapi_entity_value(
6753
+ entity,
6754
+ "visualstyle"
6755
+ ).data;
6713
6756
  const visualStyleId = libredwg.dwg_ref_get_absref(visualstyle_ref);
6714
6757
  const sun_ref = libredwg.dwg_dynapi_entity_value(entity, "sun").data;
6715
6758
  const sunId = libredwg.dwg_ref_get_absref(sun_ref);
@@ -6741,20 +6784,20 @@ class LibreEntityConverter {
6741
6784
  ucsOrigin,
6742
6785
  ucsXAxis,
6743
6786
  ucsYAxis,
6744
- ucsId: ucsId.toString(),
6745
- ucsBaseId: ucsBaseId.toString(),
6787
+ ucsId: idToString(ucsId),
6788
+ ucsBaseId: idToString(ucsBaseId),
6746
6789
  orthographicType,
6747
6790
  elevation,
6748
6791
  shadePlotMode,
6749
6792
  majorGridFrequency,
6750
- backgroundId: backgroundId.toString(),
6751
- shadePlotId: shadePlotId.toString(),
6752
- visualStyleId: visualStyleId.toString(),
6793
+ backgroundId: idToString(backgroundId),
6794
+ shadePlotId: idToString(shadePlotId),
6795
+ visualStyleId: idToString(visualStyleId),
6753
6796
  isDefaultLighting: !!isDefaultLighting,
6754
6797
  defaultLightingType,
6755
6798
  brightness,
6756
6799
  contrast,
6757
- sunId: sunId.toString()
6800
+ sunId: idToString(sunId)
6758
6801
  };
6759
6802
  }
6760
6803
  convertWipeout(entity, commonAttrs) {
@@ -6891,8 +6934,8 @@ class LibreEntityConverter {
6891
6934
  const lineTypeScale = libredwg.dwg_object_entity_get_ltype_scale(entity);
6892
6935
  const isVisible = !libredwg.dwg_object_entity_get_invisible(entity);
6893
6936
  return {
6894
- handle: handle.value,
6895
- ownerBlockRecordSoftId: ownerhandle.absolute_ref,
6937
+ handle: idToString(handle.value),
6938
+ ownerBlockRecordSoftId: idToString(ownerhandle.absolute_ref),
6896
6939
  layer,
6897
6940
  color: rgbColor,
6898
6941
  colorIndex,
@@ -6908,13 +6951,13 @@ class LibreEntityConverter {
6908
6951
  getLayerName(entity) {
6909
6952
  const libredwg = this.libredwg;
6910
6953
  const layer = libredwg.dwg_object_entity_get_layer_object_ref(entity);
6911
- const name = this.layers.get(layer.handleref.value);
6954
+ const name = this.layers.get(idToString(layer.handleref.value));
6912
6955
  return name ?? "0";
6913
6956
  }
6914
6957
  getLtypeName(entity) {
6915
6958
  const libredwg = this.libredwg;
6916
6959
  const ltype = libredwg.dwg_object_entity_get_ltype_object_ref(entity);
6917
- const name = this.ltypes.get(ltype.handleref.value);
6960
+ const name = this.ltypes.get(idToString(ltype.handleref.value));
6918
6961
  return name ?? "";
6919
6962
  }
6920
6963
  }
@@ -7091,7 +7134,10 @@ class LibreDwgConverter {
7091
7134
  let entities = this.convertEntities(obj, commonAttrs.handle);
7092
7135
  if (entities.length == 0) {
7093
7136
  const entities_ptr = libredwg.dwg_dynapi_entity_value(item, "entities").data;
7094
- const object_ref_ptr_array = libredwg.dwg_ptr_to_object_ref_ptr_array(entities_ptr, num_owned);
7137
+ const object_ref_ptr_array = libredwg.dwg_ptr_to_object_ref_ptr_array(
7138
+ entities_ptr,
7139
+ num_owned
7140
+ );
7095
7141
  const converter = this.entityConverter;
7096
7142
  entities = [];
7097
7143
  for (let index = 0; index < num_owned; index++) {
@@ -7453,9 +7499,9 @@ class LibreDwgConverter {
7453
7499
  const elevation = libredwg.dwg_dynapi_entity_value(item, "ucs_elevation").data;
7454
7500
  const majorGridLines = libredwg.dwg_dynapi_entity_value(item, "grid_major").data;
7455
7501
  const background = libredwg.dwg_dynapi_entity_value(item, "background").data;
7456
- const backgroundObjectId = background ? libredwg.dwg_ref_get_absref(background).toString() : void 0;
7502
+ const backgroundObjectId = background ? idToString(libredwg.dwg_ref_get_absref(background)) : void 0;
7457
7503
  const visualstyle = libredwg.dwg_dynapi_entity_value(item, "visualstyle").data;
7458
- const visualStyleObjectId = visualstyle ? libredwg.dwg_ref_get_absref(visualstyle).toString() : void 0;
7504
+ const visualStyleObjectId = visualstyle ? idToString(libredwg.dwg_ref_get_absref(visualstyle)) : void 0;
7459
7505
  return {
7460
7506
  ...commonAttrs,
7461
7507
  standardFlag,
@@ -7507,8 +7553,8 @@ class LibreDwgConverter {
7507
7553
  const ownerhandle = libredwg.dwg_object_object_get_ownerhandle_object(object_tio);
7508
7554
  const handle = libredwg.dwg_object_get_handle_object(obj);
7509
7555
  return {
7510
- handle: handle.value,
7511
- ownerHandle: ownerhandle.absolute_ref,
7556
+ handle: idToString(handle.value),
7557
+ ownerHandle: idToString(ownerhandle.absolute_ref),
7512
7558
  name: libredwg.dwg_dynapi_entity_value(tio, "name").data
7513
7559
  };
7514
7560
  }
@@ -7548,6 +7594,22 @@ class LibreDwgConverter {
7548
7594
  const minExtent = libredwg.dwg_dynapi_entity_value(item, "EXTMIN").data;
7549
7595
  const maxExtent = libredwg.dwg_dynapi_entity_value(item, "EXTMAX").data;
7550
7596
  const elevation = libredwg.dwg_dynapi_entity_value(item, "ucs_elevation").data;
7597
+ const block_header_ref = libredwg.dwg_dynapi_entity_value(
7598
+ item,
7599
+ "block_header"
7600
+ ).data;
7601
+ const paperSpaceTableId = idToString(
7602
+ libredwg.dwg_ref_get_absref(block_header_ref)
7603
+ );
7604
+ const active_viewport_ref = libredwg.dwg_dynapi_entity_value(
7605
+ item,
7606
+ "active_viewport"
7607
+ ).data;
7608
+ const viewportId = idToString(
7609
+ libredwg.dwg_ref_get_absref(active_viewport_ref)
7610
+ );
7611
+ const named_ucs_ref = libredwg.dwg_dynapi_entity_value(item, "named_ucs").data;
7612
+ const namedUcsId = isValidPointer(named_ucs_ref) ? idToString(libredwg.dwg_ref_get_absref(named_ucs_ref)) : void 0;
7551
7613
  return {
7552
7614
  ...commonAttrs,
7553
7615
  layoutName,
@@ -7563,11 +7625,9 @@ class LibreDwgConverter {
7563
7625
  ucsXAxis,
7564
7626
  ucsYAxis,
7565
7627
  orthographicType,
7566
- paperSpaceTableId: "",
7567
- // TODO: Set the correct value
7568
- viewportId: "",
7569
- // TODO: Set the correct value
7570
- // namedUcsId?: string;
7628
+ paperSpaceTableId,
7629
+ viewportId,
7630
+ namedUcsId,
7571
7631
  // orthographicUcsId?: string;
7572
7632
  shadePlotId: ""
7573
7633
  // TODO: Set the correct value
@@ -9060,8 +9120,8 @@ const _LibreDwg = class _LibreDwg {
9060
9120
  return converter.convert(data);
9061
9121
  }
9062
9122
  /**
9063
- * Converts Dwg_Data instance to DwgDatabase instance and returns conversion statistics.
9064
- * DwgDatabase instance doesn't depend on Dwg_Data instance any more after conversion.
9123
+ * Converts Dwg_Data instance to DwgDatabase instance and returns conversion statistics.
9124
+ * DwgDatabase instance doesn't depend on Dwg_Data instance any more after conversion.
9065
9125
  * So you can call function dwg_free to free memory occupied by Dwg_Data.
9066
9126
  * @param data Pointer to Dwg_Data instance.
9067
9127
  * @returns Returns the converted DwgDatabase and conversion statistics.
@@ -9985,6 +10045,8 @@ export {
9985
10045
  createModule,
9986
10046
  dwgCodePageToEncoding,
9987
10047
  dwgVersions,
10048
+ idToString,
9988
10049
  isModelSpace,
9989
- isPaperSpace
10050
+ isPaperSpace,
10051
+ isValidPointer
9990
10052
  };