如何在 WebGL 中导出 SolidWorks/eDrawings 文件?

How to export SolidWorks/eDrawings file in WebGL?

随着 SolidWorks 2016 的推出,Dassault Systèmes 推出了一个新的门户网站,可以将 Edrawings 模型嵌入到网页中:3dcontentcentral.com。 他们的网络 3D 查看器使用 WebGL 在浏览器中显示模型 window(here 你可以找到一个活生生的例子)。此外,还可以使用查看器嵌入 iframe 以将其嵌入另一个网页,如下所示:

<iframe scrolling='no' frameborder='0' allowfullscreen='true'
src='http://www.3dcontentcentral.com/external-site-embed.aspx?format=3D&catalogid=364&modelid=1254&width=250&height=250&edraw=true'
name='PreviewFrame3D' id='PreviewFrame3D' width='400' height='355'>
</iframe>
<br/>
<a href='http://www.3dcontentcentral.com/download-model.aspx?catalogid=364&id=1217'>
Download</a>

final result 类似于以下内容:

Full screen example

那么,是否有机会以相同的方式导出 3D 模型(部分)并嵌入为 WebGL 而无需上传到 3D Content Central 网站?我还可以访问 Edrawings/SolidWorks SDK (2015),如果它有任何帮助的话。

使用 three.js 指南查看 WebGL 3D 模型查看器 http://www.radiatedpixel.com/wordpress/2013/03/27/webgl-3d-model-viewer-using-three-js/

从 SolidWorks 导出 obj 文件。

通过 JavaScript 添加您自己的控件应该很简单。

如何将 SolidWorks 文件转换为 WebGL JSON 文件

我遇到的最佳解决方案是简单地使用 SolidWorks Visualize(以前称为 Bunkspeed)并结合使用 OBJMTL 文件来导出几何体和材质。

然后,您就可以使用 Three.js/OBJLoader. A big problem that can arise is the dimension and the memory required to load the exported file. To solve this latency/memory problem you can then convert the exported OBJ files into Three.js JSON format using the three-obj and minifying them using the minify() method. After that you'll have to load the minified files using the Three.js/BinaryLoader.

将其导入到 WebGL 场景中

希望这可以帮助其他人。