javascript Three.js中加载STL文件的首选方法是什么
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/11060261/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
What is the preferred method for loading STL files in Three.js
提问by user1460044
I'm writing an application that is designed to be used as part of a mechanical design and simulation workflow, and we'd like to be able to use Three.js to load and visualize parts designed in Solidworks, which can be exported as STL (text or binary).
我正在编写一个应用程序,该应用程序旨在用作机械设计和模拟工作流程的一部分,我们希望能够使用 Three.js 加载和可视化在 Solidworks 中设计的零件,该零件可以导出为 STL (文本或二进制)。
** I fully recognize that one can use something like Meshlab to convert to OBJ or some other format, but this seems like an unnecessary additional step that encumbers the workflow. **
** 我完全认识到可以使用 Meshlab 之类的东西来转换为 OBJ 或其他格式,但这似乎是阻碍工作流程的不必要的额外步骤。**
It seems Three.js has good loading solutions for Collada, OBJ, UTF-8, VTK, and JSON, but there is no clean STL support example. I saw some things floating around that have been used in the past, such as https://github.com/tbuser/thingiview.js/blob/master/javascripts/thingiloader.jswhich I'd like to avoid because of the license, and https://github.com/tbuser/three.js/blob/master/utils/stl_geometry.jswhich seems not fully integrated.
Three.js 似乎对 Collada、OBJ、UTF-8、VTK 和 JSON 有很好的加载解决方案,但没有干净的 STL 支持示例。我看到了一些过去使用过的东西,例如 https://github.com/tbuser/thingiview.js/blob/master/javascripts/thingiloader.js由于许可证我想避免,和 https://github.com/tbuser/three.js/blob/master/utils/stl_geometry.js似乎没有完全集成。
Am I missing something?
我错过了什么吗?
回答by Luis E. Fraguada
There is an STLLoaderand an exampleof how to use it. These were added to Three.js in August of 2012, a mere month or so after this question was originally posted. Since then, there have been several commitsinvolving the STLLoader.
有一个STLLoader和例子中如何使用它。这些在2012年8 月被添加到 Three.js 中,在这个问题最初发布后仅仅一个月左右。从那以后,有几次涉及 STLLoader 的提交。