Drawing Conversion
# 1. Download MxDraw Cloud Development Kit
First of all, we should download the latest version of MxDraw cloud development kit from the official website (opens new window).
The MxDraw Cloud Development Kit provides an exe program for drawing conversion (supports both Windows and Linux versions).
It includes various supporting services (such as node back-end development source code, drawing information extraction and front-end examples source code):
Double-click Mx3dServer.exe to run and you can view various examples.
Note
Note: Before starting, please close the 360 antivirus software, which may misreport and intercept our server program's network access.
Follow the on-screen instructions, from top to bottom, click three buttons to start the service, note: firewall must allow our service program to access the network.
Set up the firewall to allow us to access the following three programs to the network:
Bin\Release\MxServer.exe
Bin\Release\node.exe
SRC\TsWeb\nodejs\node.exe
For more detailed instructions on using the development kit, please refer to the MxDraw Cloud Documentation (opens new window).
This chapter only explains the drawing conversion function that is paired with the mxdraw front-end js library.
# 2. Call MxFileConvert.exe to start drawing conversion
Note
Drawing conversion is to call the Mx3dServer.exe program to convert the drawing.
The converted file is not one file, but multiple files (in the buf directory).
# Start the conversion tool for drawing conversion (double-click MxFileConvert.exe)
After running Mx3dServer.exe, we can see a button "启动DWG格式转换程序" ("Start DWG Format Conversion Program"). Click it and we can perform format conversion.
The converted drawing files are generated based on the buf directory under the directory where the drawing is located, for example:
D:/test/test.dwg
After conversion, the generated file: D:/test/buf/$test.dwg.xxx.wgh1,2..
# Implementing drawing conversion by calling the MxFileConvert.exe file through command
The MxFileConvert.exe in the Bin\Release directory of the development kit is the program for drawing conversion.
We can also perform drawing conversion by calling it through the command line.
Note
Only the command line output of {"ret": 0}
indicates that the drawing conversion is successful.
# Windows
First, start the command prompt and call the following code in the Bin\Release directory:
MxFileConvert.exe "C:/test.dwg"
Replace C:/test.dwg
with the path of the drawing to be converted.
The converted file is: C:/buf/$test.dwg.xxx.wgh1...
# Linux
The Bin/Linux/Bin
directory under the development kit contains the files for drawing conversion.
Run the command to copy the files in this directory to the Linux system and give the files execution permissions:
su root
chmod -R 777 *
cp -r ./mx /mx
chmod -R 777 /mx/*
./node mxconvert.js 1.dwg
The converted file is in the Bin\Linux\Bin\buf
directory.
How to use the converted file to render and display on a webpage using mxdraw?
Official Documentation
For more information, please refer to the MxDraw Cloud Documentation (opens new window).
Source code for calling MxFileConvert, such as nodejs and java, as well as other drawing conversion and information extraction services source code are all described in detail in the official documentation.
This document is a reference to the mxdrwa frontend library and only describes how to convert drawings.