当前位置:首页 > Web开发 > 正文

一个使用three.js的网页DXF文件检察器dxf viewer

2024-03-31 Web开发

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 samples dependencies > cd sample > npm install # go back to the root and run http-server to run the sample > cd .. > npm install -g [email protected]0.9.0 > http-server . # use `http-server -c-1 .` to prevent caching

技术图片

此时,,打开chrome浏览器::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);

一个使用three.js的网页DXF文件检察器dxf viewer

温馨提示: 本文由Jm博客推荐,转载请保留链接: https://www.jmwww.net/file/web/30156.html