mxcad 1.0.340 → 1.0.342

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,37 +1,41 @@
1
- # Quick Start
2
1
 
3
- > **mxcad must be used together with mxdraw.** If you are not familiar with the mxdraw library, please refer to: <https://github.com/mxcad/mxdraw/>
2
+ # Preface
4
3
 
5
- > **Contact:** 710714273@qq.com
4
+ The development of mxcad requires dependency on mxdraw, and the two need to work together. Therefore, if you are unfamiliar with the mxdraw library, please refer to:<https://github.com/mxcad/mxdraw/>
6
5
 
7
- [](https://www.webcadsdk.com/img/WX-Two-dimensional-code.png)
8
- **Official Website:** <https://www.webcadsdk.com/>
6
+ If you have any questions during the use of mxcad, feel free to contact us. Contact: 710714273@qq.com
9
7
 
10
- mxcad supports rendering `.mxweb` format files (a proprietary frontend CAD format). CAD drawing files (DWG, DXF) can be converted into `.mxweb` files using the file conversion tool provided in our [mxdraw CloudDraw Development Kit](https://help.mxdraw.com/?pid=32). The converted `.mxweb` files can then be loaded and edited in a web browser via mxcad. Edited `.mxweb` files can also be converted back to standard CAD file formats using the same conversion tool.
8
+ ![](https://www.webcadsdk.com/img/WX-Two-dimensional-code.png);
11
9
 
12
- ---
10
+ Official mxcad website: <https://www.webcadsdk.com/>
11
+
12
+ # Quick Start with mxcad
13
+
14
+ mxcad supports online rendering of `.mxweb` format files (this file format is our unique front-end CAD format). CAD drawing files (DWG, DXF) can be converted into .mxweb files via the drawing conversion program provided in our [mxdraw CloudDraw development package](https://www.webcadsdk.com/). The converted `.mxweb` files will be handed over to mxcad for browsing and editing in web pages. The edited `.mxweb` files can similarly be converted back into CAD drawing files through the drawing conversion program.
15
+
16
+ For specific steps on converting CAD drawing files to `.mxweb` format, please refer to the [drawing conversion steps](#drawing-conversion-steps) below.
13
17
 
14
18
  ## Using mxcad with Vite
15
19
 
16
- In this section, we'll walk through creating a simple mxcad project using Vite.
20
+ In this section, we will introduce how to create a simple mxcad project locally. The created project will use a build setup based on Vite.
17
21
 
18
- Ensure you have [Node.js](https://nodejs.org/en) installed, then navigate to your desired project directory:
22
+ First, ensure that you have installed [Node.js](https://nodejs.org/en), then navigate to the directory where you need to create the project:
19
23
 
20
- 1. Run the following commands in your terminal to initialize the project and install Vite and mxcad:
24
+ 1. Run the following commands in the command line to initialize the project and install Vite and mxcad
21
25
 
22
26
  ```sh
23
27
  npm init -y
24
28
  npm install vite -D
25
29
  npm install mxcad
26
30
  ```
27
- :::tip Note
28
- If using `pnpm`, you must manually install `mxdraw`:
31
+ :::tip tip Note
32
+ If using `pnpm` for installation, you also need to manually install mxdraw
29
33
  ```sh
30
- pnpm install mxdraw
34
+ `pnpm install mxdraw`
31
35
  ```
32
36
  :::
33
37
 
34
- 2. Create an `index.html` file in the project root and set up a canvas:
38
+ 2. Create a new index.html file in the project root directory and draw a canvas.
35
39
 
36
40
  ```html
37
41
  <!DOCTYPE html>
@@ -40,46 +44,51 @@ pnpm install mxdraw
40
44
  <meta charset="UTF-8">
41
45
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
42
46
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
43
- <title>Vite with mxcad</title>
47
+ <title>vite use mxcad</title>
44
48
  </head>
45
49
  <body>
46
- <div style="height: 600px; overflow: hidden;">
47
- <canvas id="myCanvas"></canvas>
48
- </div>
50
+ <div style="height: 600px; overflow: hidden;"> <canvas id="myCanvas"></canvas></div>
49
51
  </body>
50
52
  </html>
51
53
  ```
52
54
 
53
- 3. Create a `src` directory in the root, and inside it, create an `assets` folder to store your `.mxweb` file. (You can [download a sample mxweb file here](https://gitee.com/mxcadx/mxcad_docs/blob/master/examples/public/test2.mxweb).)
55
+ 3. Create a new `src` directory in the root directory, and create an `assets` folder within this directory to store the target `mxweb` file. ([Click to download an mxweb file](https://gitee.com/mxcadx/mxcad_docs/blob/master/examples/public/test2.mxweb))
54
56
 
55
- 4. Inside the `src` directory, create an `index.ts` file (Vite supports TypeScript by default).
57
+ 4. Create a new `index.ts` file in the `src` directory (Vite supports ts by default).。
56
58
 
57
- Use the `create()` method from mxcad to load the target drawing. The `fileUrl` and other file paths in `create()` must be absolute **network URLs** relative to the script's location. In Vite, you can obtain the correct URL using `import.meta.url`.
59
+ By calling the `create()` method in mxcad, load the target drawing. The file paths loaded in this method are all absolute HTTP URL paths relative to the position of the JavaScript call, i.e., the **web address** of the file. In Vite, you can obtain the correct **web address** of the file using the loading method shown in the example code below.
58
60
 
59
61
  ```ts
60
62
  import { McObject } from "mxcad"
61
63
 
62
- // Create an mxcad instance
64
+ // Place both 2d and 2d-st into static resources to ensure normal operation regardless of whether SharedArrayBuffer is enabled
65
+ const mode = "SharedArrayBuffer" in window ? "2d" : "2d-st"
66
+ // Create an mxcad instance object
63
67
  const mxcad = new McObject()
64
68
  mxcad.create({
65
- canvas: "#myCanvas", // canvas element ID
66
- locateFile: (fileName) => new URL(`/node_modules/mxcad/dist/wasm/2d/${fileName}`, import.meta.url).href,
69
+ // ID of the canvas element
70
+ canvas: "#myCanvas",
71
+ // Get the path location of the wasm-related files (wasm/js/worker.js)
72
+ locateFile: (fileName)=> new URL(`/node_modules/mxcad/dist/wasm/${mode}/${fileName}`, import.meta.url).href,
73
+ // URL path of the file to be initialized and opened
67
74
  fileUrl: new URL("../src/assets/test.mxweb", import.meta.url).href,
68
- fontspath: new URL("node_modules/mxcad/dist/fonts", import.meta.url).href,
75
+ // Provide the directory path for loading fonts
76
+ fontspath: new URL("node_modules/mxcad/dist/fonts", import.meta.url).href,
69
77
  })
78
+
70
79
  ```
71
80
 
72
- Include this script in your `index.html`:
81
+ Import this ts file into the above html file.
82
+
83
+ The `create()` method in mxcad needs to be called after the canvas element has finished loading on the page, so the script tag needs to be placed inside the body tag, allowing the browser to parse the HTML page first before downloading and executing the code in the script tag.
73
84
 
74
85
  ```html
75
86
  <script type="module" src="./src/index.ts"></script>
76
87
  ```
77
88
 
78
- > ⚠️ The `create()` method must be called **after** the canvas element is loaded in the DOM. Therefore, place the `<script>` tag inside the `<body>` to ensure the HTML is parsed first.
79
-
80
89
  5. Create a `vite.config.ts` file in the root directory.
81
90
 
82
- mxcad uses `SharedArrayBuffer`, which requires specific HTTP headers for cross-origin isolation. Configure your server accordingly:
91
+ mxcad uses SharedArrayBuffer by default, which is a special type in JavaScript that allows multiple Web Worker threads to share the same memory space. Therefore, using mxcad requires setting the corresponding response headers on the server side.
83
92
 
84
93
  ```ts
85
94
  import { defineConfig } from "vite"
@@ -94,34 +103,32 @@ export default defineConfig({
94
103
  })
95
104
  ```
96
105
 
97
- 6. After completing the steps above, start the project:
106
+ 6. After completing the above steps, run the following command to start the project
98
107
 
99
108
  ```sh
100
109
  npx vite
101
110
  ```
102
111
 
103
- **Example Source Code:** <https://gitee.com/mxcadx/mxcad_docs/tree/master/examples/vite>
104
-
105
- ---
112
+ Reference example source code: <https://gitee.com/mxcadx/mxcad_docs/tree/master/examples/vite>
106
113
 
107
114
  ## Using mxcad via CDN
108
115
 
109
- You can use mxcad directly via a CDN using `<script>` tags.
116
+ You can use mxcad directly through a script tag with a CDN:
110
117
 
111
- We use [unpkg](https://unpkg.com/) here, but any npm CDN works. You can also self-host the files.
118
+ Here we use [unpkg](https://unpkg.com/), but you can use any CDN that provides npm package services, or you can download this file and serve it yourself
112
119
 
113
120
  ```html
114
- <script src="https://unpkg.com/mxdraw/dist/mxdraw.umd.js" crossorigin="anonymous"></script>
115
- <script src="https://unpkg.com/mxcad/dist/mxcad.umd.js" crossorigin="anonymous"></script>
121
+ <script scr="https://unpkg.com/mxdraw/dist/mxdraw.umd.js" crossorigin="anonymous"></script>
122
+ <script scr="https://unpkg.com/mxcad/dist/mxcad.umd.js" crossorigin="anonymous"></script>
116
123
  ```
124
+ ### Using the Global Build Version
117
125
 
118
- ### Using the Global Build
119
-
120
- Example with global build:
126
+ Example of the global build version:
121
127
 
122
128
  ```html
123
129
  <!DOCTYPE html>
124
130
  <html lang="en">
131
+
125
132
  <head>
126
133
  <meta charset="UTF-8">
127
134
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
@@ -130,41 +137,41 @@ Example with global build:
130
137
  <script src="https://unpkg.com/mxdraw" crossorigin="anonymous"></script>
131
138
  <script src="https://unpkg.com/mxcad" crossorigin="anonymous"></script>
132
139
  </head>
140
+
133
141
  <body>
134
- <div style="height: 600px; overflow: hidden;">
135
- <canvas id="myCanvas" style="height: 300px"></canvas>
136
- </div>
142
+ <div style="height: 600px; overflow: hidden;"> <canvas id="myCanvas" style="height: 300px"></canvas></div>
137
143
  <script>
138
144
  const { McObject } = MxCAD
139
145
  const mxobj = new McObject()
140
146
  mxobj.create({
141
- canvas: "#myCanvas",
147
+ canvas: "#myCanvas",//canvas's id
142
148
  locateFile: (fileName) => "https://unpkg.com/mxcad/dist/wasm/2d-st/" + fileName,
143
149
  fontspath: "https://unpkg.com/mxcad/dist/fonts/",
144
- fileUrl: "./test2.mxweb"
150
+ fileUrl: "./test2.mxweb"//path to the target drawing
145
151
  })
146
152
  </script>
147
153
  </body>
154
+
148
155
  </html>
149
156
  ```
150
157
 
151
- **Example Source Code:** <https://gitee.com/mxcadx/mxcad_docs/tree/master/examples/h5>
158
+ 参考示例源码:<https://gitee.com/mxcadx/mxcad_docs/tree/master/examples/h5>
152
159
 
153
- ### Using ES Module Build
160
+ ### Build the version using the ES module
154
161
 
155
- Modern browsers support ES modules natively. Use import maps to resolve `mxdraw` and `mxcad` modules:
162
+ Most modern browsers already natively support the ES module, so we can use mxcad like this through the CDN and the native ES module. Because they depend on mxdraw mxcad library, so [Import mapping table (Import Maps)](https://caniuse.com/import-maps) to tell the browser how to locate the mxdraw module and mxcad module to Import.
163
+
164
+ You can also add other dependencies to the mapping table - but make sure you are using the ES module version of the library.
156
165
 
157
166
  ```html
158
- <div style="height: 600px; overflow: hidden;">
159
- <canvas id="myCanvas" style="height: 300px"></canvas>
160
- </div>
167
+ <div style="height: 600px; overflow: hidden;"> <canvas id="myCanvas" style="height: 300px"></canvas></div>
161
168
  <script type="importmap">
162
- {
163
- "imports": {
169
+ {
170
+ "imports": {
164
171
  "mxdraw": "https://unpkg.com/mxdraw/dist/mxdraw.esm.js",
165
172
  "mxcad": "https://unpkg.com/mxcad/dist/mxcad.es.js"
173
+ }
166
174
  }
167
- }
168
175
  </script>
169
176
  <script type="module">
170
177
  import { McObject } from "mxcad"
@@ -179,65 +186,61 @@ Modern browsers support ES modules natively. Use import maps to resolve `mxdraw`
179
186
  </script>
180
187
  ```
181
188
 
182
- ---
183
-
184
- ## Using mxcad with Webpack
185
-
186
- mxcad can also be used with other bundlers like Webpack.
189
+ ## Use mxcad with webpack
187
190
 
188
- 1. Initialize the project and install dependencies:
191
+ mxcad is also supported in other packaging tools, and building mxcad projects based on webpack is described below.
189
192
 
193
+ 1. Project initialization and installation of webpack and mxcad.
190
194
  ```sh
191
195
  npm init -y
192
196
  npm install webpack webpack-cli copy-webpack-plugin@5 html-webpack-plugin -D
193
197
  npm install mxcad
194
198
  ```
195
199
 
196
- 2. Create `index.html` in the root:
197
-
200
+ 2. Create a new `index.html` file in the root directory and draw the canvas.
198
201
  ```html
199
202
  <!DOCTYPE html>
200
203
  <html>
201
204
  <head>
202
205
  <meta charset="utf-8" />
203
- <title>Getting Started</title>
206
+ <title>start</title>
207
+ <script src="https://unpkg.com/lodash@4.17.20"></script>
204
208
  </head>
205
209
  <body>
206
- <div style="height: 600px; overflow: hidden;">
207
- <canvas id="myCanvas"></canvas>
208
- </div>
210
+ <div style="height: 600px; overflow: hidden;"> <canvas id="myCanvas"></canvas></div>
209
211
  </body>
210
212
  </html>
211
213
  ```
212
214
 
213
- 3. Create a `src` directory and `src/index.js` to load the file:
215
+ 3. Create a `src` directory in the root directory and a `index.js` file in the ` src` directory to load the target file
214
216
 
215
217
  ```js
216
- import { McObject } from "mxcad"
218
+ import { McObject } from "mxcad"
217
219
 
218
220
  const mxcad = new McObject()
219
221
  mxcad.create({
220
222
  canvas: "#myCanvas",
221
- fileUrl: "test.mxweb" // Ensure this file is accessible at http://your-domain/test.mxweb
223
+ // Access http:xxx.com/test.mxweb to obtain the corresponding file
224
+ // Please provide the document yourself
225
+ fileUrl: "test.mxweb"
222
226
  })
223
227
  ```
224
-
225
- Include the script in `index.html`:
226
-
228
+ Introduce the js file under the `index.html` file. Put the script tag inside the body tag and let the browser finish parsing the HTML page before downloading and executing the code in the script tag.
227
229
  ```html
228
230
  <script src="./src/index.js"></script>
229
231
  ```
230
232
 
231
- 4. Create `webpack.config.js`:
233
+ 4. Create the `webpack.config.js` file in the root directory.
232
234
 
233
- Copy required mxcad assets to the output directory:
235
+ Copy the mxcad required files to a static resource.
234
236
 
235
237
  ```js
236
238
  const path = require('path');
239
+ // Please feel free to use copy-webpack-plugin@5 compatible webpack4 and 5 compatible versions
237
240
  const CopyWebpackPlugin = require("copy-webpack-plugin");
238
241
 
239
242
  module.exports = {
240
- mode: process.env.NODE_ENV === "development" ? "development" : "production",
243
+ mode: process.env.development === "development" ? "development" : "production",
241
244
  entry: './src/index.js',
242
245
  devServer: {
243
246
  static: './dist',
@@ -252,11 +255,13 @@ module.exports = {
252
255
  },
253
256
  plugins: [
254
257
  new CopyWebpackPlugin([
258
+ // Copy mxcad WASM-related core code The default mxcad request path is /* All files need to be placed under dist2d
255
259
  {
256
260
  from: "node_modules/mxcad/dist/wasm/2d/*",
257
261
  to: path.resolve(__dirname, "dist"),
258
262
  flatten: true
259
263
  },
264
+ // The font file must be required to display the text in the drawing. The mxcad library default request URL path is /fonts/* All need to be placed under dist/fonts
260
265
  {
261
266
  from: "node_modules/mxcad/dist/fonts",
262
267
  to: path.resolve(__dirname, "dist/fonts"),
@@ -265,66 +270,157 @@ module.exports = {
265
270
  },
266
271
  ])
267
272
  ],
273
+ // mxcad and mxdraw libraries have js code packages that exceed the size of webpack's default limit and need to set hints: false to close the warning
268
274
  performance: {
269
275
  hints: false,
270
276
  }
271
277
  };
272
278
  ```
273
279
 
274
- 5. After configuring `package.json`, run:
280
+ 5. After configuring the `packge.json` file as required, run the 'npx webpack serve' command to see the effect
275
281
 
276
- ```sh
277
- npx webpack serve
278
- ```
282
+ Reference sample source code:
283
+
284
+ <https://gitee.com/mxcadx/mxcad_docs/tree/master/examples/webpack-v4>
285
+
286
+ <https://gitee.com/mxcadx/mxcad_docs/tree/master/examples/webpack-v5>
287
+
288
+ ## Other knowledge points
289
+
290
+ ### Parameter description of the mxcad.create() function
291
+
292
+ 1. canvas:canvas id of the canvas instance
293
+
294
+ 2. locateFile:The core of mxcad relies on the wasm file in the corresponding category (` 2d `|` 2d-st `) under the directory `/mxcad/dist/wasm` in mxcad library (the file is compiled and generated by c++), wherein the 2d directory is multi-threaded programs, and the 2D-ST directory is single-threaded programs. This parameter specifies the network path of the wasm program.
295
+
296
+ 3. fontspath:Specifies the font file load path in a cad drawing. The default path is `dist/fonts`, where you can add all the font files you need to open your drawings.
297
+
298
+ 4. fileUrl:Specifies the network path to open the mxweb drawing.
299
+
300
+ :::tip Tips
301
+ The parameters fontspath, fileUrl and locateFile in the `create()` function that creates mxcad objects in mxcad are network paths.
302
+ :::
303
+ 5. onOpenFileComplete: Listen for the callback event when opening a file is successful. Operations to be performed after the drawing is opened can be executed within this method.
304
+
305
+ 6. viewBackgroundColor: Set the background color of the view area, with the value in RGB format.
306
+
307
+ 7. browse: Whether to set as browse mode. When the value is true or 1, browse mode is enabled and CAD objects cannot be selected; when the value is 2, browse mode is enabled and CAD objects can be selected but cannot be edited by grips; when the value is false, edit mode is enabled.
279
308
 
280
- ---
309
+ 8. middlePan: Set the operation mode for moving the view. Set to 0 to move the view by clicking the left mouse button; set to 1 to move the view by clicking the middle mouse button; set to 2 to move the view by clicking either the middle or left mouse button.
281
310
 
282
- ## Additional Notes
311
+ 9. enableUndo: Whether to enable the undo function. If set to true, the Mx_Undo command can be called to undo operations; if set to false, the undo command is disabled. The default setting is false.
283
312
 
284
- ### `create()` Configuration Parameters
313
+ 10. enableIntelliSelect: Whether to enable the object selection function. Set to true to enable; set to false to disable.
285
314
 
286
- 1. **canvas**: ID of the canvas element.
287
- 2. **locateFile**: URL path to the WASM files in `mxcad/dist/wasm/2d` (multithreaded) or `2d-st` (single-threaded).
288
- 3. **fontspath**: Path to font files used in CAD drawings. Default: `/fonts`.
289
- 4. **fileUrl**: Network path to the `.mxweb` file.
290
- :::tip Tip
291
- All paths (`fontspath`, `fileUrl`, `locateFile`) must be **absolute network URLs**.
292
- :::
293
- 5. **onOpenFileComplete**: Callback when file opens successfully.
294
- 6. **viewBackgroundColor**: Background color of the view (RGB).
295
- 7. **browse**: Browsing mode. `true` or `1`: browsing, no selection; `2`: browsing with selection (no editing); `false`: editing mode.
296
- 8. **middlePan**: View panning behavior. `0`: left-click; `1`: middle-click; `2`: both.
297
- 9. **enableUndo**: Enable undo functionality (`true`/`false`).
298
- 10. **enableIntelliSelect**: Enable intelligent object selection.
299
- 11. **multipleSelect**: Enable multiple selection.
315
+ 11. multipleSelect: Whether to enable multiple selection. Set to true to enable; set to false to disable.
300
316
 
301
- For more details, see [MxCadConfig Interface](../../api/interfaces/2d.MxCadConfig.md).
317
+ For more initialization parameter settings of createMxCad, please refer to the [MxCadConfig Configuration Description](../../api/interfaces/2d.MxCadConfig.md)
302
318
 
303
- ### Multithreaded vs. Single-threaded Mode
319
+ ### Description of multi-thread and single-thread mode
304
320
 
305
- mxcad defaults to multithreaded mode for performance. Multithreading requires `SharedArrayBuffer`, which needs proper HTTP headers:
321
+ mxcad supports multithreading by default for performance reasons. Among them, support for multithreading mode needs to open SharedArrayBuffer permissions, open can use `/wasm/2d` under the multithreaded program, otherwise use `/wasm/ 2d-ST/` under the single-threaded program.
322
+
323
+ The SharedArrayBuffer permission needs to be configured in the server responder, for example, node.js server program to enable SharedArrayBuffer permission set as follows:
306
324
 
307
325
  ```js
308
326
  const http = require('http');
309
- http.createServer((req, res) => {
327
+ http.createServer((req, res)=> {
310
328
  res.setHeader("Cross-Origin-Opener-Policy", "same-origin");
311
329
  res.setHeader("Cross-Origin-Embedder-Policy", "require-corp");
312
330
  })
313
331
  ```
314
332
 
315
- To detect `SharedArrayBuffer` support and choose the correct mode:
333
+ How to determine whether SharedArrayBuffer permissions are enabled in front-end js, and then automatically use the correct program loading, the code is as follows:
316
334
 
317
335
  ```js
318
336
  import { McObject } from "mxcad"
337
+ // Putting both 2d and 2D-ST into a static resource ensures that it works regardless of whether SharedArrayBuffer is turned on or not
319
338
  const mode = "SharedArrayBuffer" in window ? "2d" : "2d-st"
320
339
  const mxobj = new McObject()
321
340
  mxobj.create({
322
- locateFile: (fileName) => {
341
+ // ...
342
+ locateFile: (fileName)=> {
323
343
  new URL(`/node_modules/mxcad/dist/wasm/${mode}/${fileName}`, import.meta.url).href
324
- },
344
+ },
325
345
  })
326
346
  ```
347
+ :::tip Tips
348
+ To use SharedArrayBuffer permissions, Google's browser requires access using HTTPS or the local path (http://localhost).
349
+ :::
350
+
351
+ # Drawing Conversion Steps
352
+
353
+ Due to the large size, multiple versions, and complex format of AutoCAD files (DWG, DXF), directly loading them into web pages is inefficient, occupies large memory space, and is prone to loading failures. Therefore, we have designed and provided a unique web CAD file format: `.mxweb`, which effectively solves the aforementioned numerous issues. mxweb files and CAD drawing files can be converted back and forth using the CloudDraw development package we provide.
354
+
355
+ ## Download the CloudDraw Development Package
356
+
357
+ We need to download the [MxDraw CloudDraw development package](https://www.webcadsdk.com/)
358
+
359
+ ![下载云图开发包图片](https://mxcad.github.io/mxcad/assets/%E4%B8%8B%E8%BD%BD%E4%BA%91%E5%9B%BE%E5%BC%80%E5%8F%91%E5%8C%85%E5%9B%BE%E7%89%87.CHXUL2g0.jpg)
360
+
361
+ After downloading the `MxDrawCloudServer1.0TryVersion.7z` compressed package, decompress it,
362
+ Go to the directory `MxDrawCloudServer\Bin\MxCAD\Release` under the decompressed MxDrawCloudServer directory, which is the program directory responsible for converting `.mxweb` format.
363
+
364
+ ![转换图纸程序的位置](data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAuUAAAApCAIAAAAd7cBPAAAPaUlEQVR4Ae2dS6hUR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g8fJgf1s0+hmQTjR0Y2bHOiWQk4iss1gQNnM4SmaWxy7s6JP63QoX3zxRZLOVE5EBuf31SPVTE40dQajFBxoS6AOioQDDboQN0fJ2EIQoGRJhfpIYkP8OyktXR0KnBSGIW7KVENEUsEfauryYHc+/mjCRJwwRAiE/B22/zNlSg6PdoG5X+gDXbwLcqxTqiv00nAvu68W9MlSi2Yx1+JXzBnpYjGBOflEKzqRBlr7J9pW0agaHyMk7dGCcOhIJnYYr5K9oaaeIEKiq5wcm6NF/q6PBv7/X9+KqK38COj5DoQx+JNm7iM9H5vNUrNOKyMp3YsggLOFNVyRIS+FB7ePqpNIjDDYRV0FH0tFroJzik0ICIFGRqDUru+BJl7oqSEEhEBXIsCFF38cwSEtd8BduW61tfgBL+9hnABzEh7NwLE2KnA1bD87i3oLPvI/ter/Zy6IldiEQPdAoNSuV73SPYwuLZoPAX7ow5+bcb5SS45vPrWzJS4VubKnUY8QEAJNg0CpXa96pWnsKkGFQPdGoFTk6t5QSDsh0CIIlNr1Vf6/wxbBUWoKASEgBISAEBACDYKA6pUGMYTEEAJCQAgIASEgBDIRaM/sUYcQEAJCoGsR4HC4axfUakJACDQNAvr9StOYSoIKASEgBISAEGhZBHQf1LKml+JCQAgIASEgBJoGAdUrTWMqCSoEhIAQEAJCoGURUL3SsqaX4kJACAgBISAEmgaBdv4ru6YRVoIKASEgBISAEBACLYmAfm/bkmaX0kJACAgBISAEmgoB3Qc1lbkkrBAQAkJACAiBlkRA9UpLml1KCwEhIASEgBBoKgT+C+N4WyhNqrLxAAAAAElFTkSuQmCC)
365
+
366
+
367
+ ## Convert CAD Drawings to mxweb Format
368
+
369
+ ### Method One
370
+
371
+ Open the command window in the directory where the decompressed `MxDraw CloudDraw development package` is located, find the path of the target drawing, then run the command line: mxcadassembly target drawing path.
372
+
373
+ Example code as follows:
374
+ ```bash
375
+ cd C:\Users\MxDev\Downloads\MxDrawCloudServer1.0TryVersion\MxDrawCloudServer\Bin\MxCAD\Release
376
+
377
+ mxcadassembly D:\test2.dwg
378
+ ```
327
379
 
328
- :::tip Note
329
- `SharedArrayBuffer` requires HTTPS or `http://localhost` in modern browsers (e.g., Chrome).
330
- :::
380
+ Wait for the command line to output `{"code":0 }` indicating the drawing conversion is successful. The successfully converted `.mxweb` format file will be automatically saved in the same directory as the target drawing.
381
+
382
+ ![转换后的图纸文件](data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMMAAAAtCAIAAACcU0gPAAAJf0lEQVR4Ae1cb2gbRxYfHW2OlhQCSdM/gdYkUgiOaUKdGE7q5UNSE8vGPWNzLikpLRyR4a5nqYXgfjDFtLkSNx+6dny5Sv6Qc84XOB8OurqRmrr1h1DrwCW0LrLTkxSTFlrofTiupK2d2rH63szs7Kx2V/KfiEjRjJfVzNv3Z+btT++9Ha/tymazRDXlgXV74Bfr1qAUKA+gB+5hbvjme+UO5YF1eUDFpHW5TwkLD/CYJMbQaXz5r2L4rxOtv+m+IIavHn3qQK37w0/Sf49/tnXzxh3bNv/78y/PvvZbwaA6FesBGyTl8UX6q//C1af3e8anMk/seDh6eTYPs7pUUR5YHZLANQxMEI0e2rzxlSO//vZ/NyrKX2qxTh5YNZIYmHY9thXSnJNSRa9AD+SruKFIAo+wM3PN6OUUO04Of1xcZ831PfOAaxs7DvVdz29svGPbAx0T+XnU1SJ7wCYmydCBchuGMqXgfK6f8flG2yc/ClYVZJUYzFKZwWOzoRvZg8iQGTzk8XXu/LrfL7Grbsl5wAZJ4mFNYEhQ5OnH3n5RHt7WvvvYR2FdofvYq4Ge1uhEv58CSyerzxLzQL7sxgBkCyOnVUx0unxdCTIV8kFi6oxTtniXnqe6xnU5zEc0eVEeOymdk5Dr6SSpq95uEFhPUjvGr4Ee3SiBILdNT4vYz52Mb/CMyom5Pl3POB+S1qD3YH92stdL6rTJG1majyA3NV7tTX8Nw2ntaqtvcI4QqIFakz3TWSQ2p4BikZItx//Slahta6qSaZjydLU30u6ZCLt4sDlAZlLXcZAZHyW1ZGQczIHBL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LTwHQVnKTH5Qh0MlpEAS2v+ME3SbGYrteviTqCGAu3kBbpEdERW5MpCkyjN6wwk1pik9fdD4Mlz9Lz+Rhl9Y6xTxTBgF/isnIqyEg84/95tOXt6YACKIWjL7N0SGOCPIOilU2l+RWxmFe/wpY7zIiV+KpTwakN2BbWNpCIV9AB/jzvyeWW86QYbi/oTJMQju8q3oMcUg70HKgxJ9k5Q1NvgAceK+zboVioqyQNGnQQJTjXlgTV74GcxVLS790MN4gAAAABJRU5ErkJggg==)
383
+
384
+ ### Method Two
385
+
386
+ Open the command window in the directory where the decompressed `MxDraw CloudDraw development package` is located, find the path of the target drawing, then run the command line: mxcadassembly JSON string.
387
+
388
+ Example code as follows:
389
+ ```bash
390
+ mxcadassembly.exe {"srcpath":"D:\test2.dwg","outpath":"D:\","outname":"test", "compression":0}
391
+ ```
392
+
393
+ | Parameter | Description |
394
+ | --- | --- |
395
+ | srcpath | Path of the file to be converted |
396
+ | outpath | outpath|Output file path |
397
+ | outname | outname|Output file name (suffix needs to be added when converting mxweb to CAD drawings) |
398
+ | compression | 0 means no compression, if this attribute is not written, it means compression |
399
+
400
+ ## Convert mxweb Format to CAD Drawings
401
+
402
+ We can also use this program to convert `.mxweb` format files back to `.dwg` format files by executing the following command:
403
+ ```bash
404
+ mxcadassembly.exe {"srcpath":"D:\test.mxweb","outpath":"D:\","outname":"test.dwg"}
405
+ ```
406
+ :::tip Note
407
+ The parameter outname must include the suffix of the CAD drawing, generally .dwg
408
+ :::
409
+
410
+ ## Linux Version
411
+
412
+ For the Linux version of the CloudDraw development package, authorization operation is required before operation:
413
+ Enter the `Bin/Linux/MxCAD` directory, we should first give these files permission and copy some directories to the specified location:
414
+ ```bash
415
+ sudo chmod -R 777 mxcadassembly
416
+
417
+ sudo chmod -R 777 ./mx/so/*
418
+
419
+ sudo cp -r -f ./mx/locale /usr/local/share/locale
420
+ ```
421
+
422
+ Then we can refer to the Windows version file format conversion method for drawing conversion. For example, call the following command to convert CAD drawings to mxweb format:
423
+ ```bash
424
+ ./mxcadassembly "{'srcpath':'/home/mx/test.dwg','outpath':'/home/mx/Test','outname':'xxx'}"
425
+ ```
426
+ where srcpath: the path where the target CAD file is located, outpath: the specified path where the converted drawing file is located, outname: specifies the filename of the output mxweb file.