一個使用three.js的網頁DXF文件查看器dxf viewer


github地址:https://github.com/gdsestimating/three-dxf
Three-Dxf是一個瀏覽器dxf文件查看器應用,其使用https://github.com/gdsestimating/dxf-parser解析dxf文件(解析出json格式),並使用three.js來渲染。
首先,安裝npm(安裝node.js時會默認安裝好npm,安裝后會將npm和node命令默認添加到環境變量中)
首先下載:

 解壓

 在當前目錄打開命令行

# first, compile three-dxf
> npm install
> npm run build

# then install the sample's dependencies
> cd sample
> npm install

# go back to the root and run http-server to run the sample
> cd ..
> npm install -g http-server@0.9.0
> http-server .
# use `http-server -c-1 .` to prevent caching

此時,打開chrome瀏覽器:http://127.0.0.1:8080/sample/index.html

 

 效果還不錯,值得參考!

1 // See index.js in the sample for more details
2 var parser = new window.DxfParser();
3 var dxf = parser.parseSync(fileReader.result);
4 cadCanvas = new ThreeDxf.Viewer(dxf, document.getElementById('cad-view'), 400, 400);

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM