Three.js中加载STL文件的首选方法是什么 [英] What is the preferred method for loading STL files in Three.js

查看:29
本文介绍了Three.js中加载STL文件的首选方法是什么的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在编写一个应用程序,该应用程序旨在用作机械设计和模拟工作流程的一部分,我们希望能够使用 Three.js 加载和可视化在 Solidworks 中设计的零件,这可以导出为 STL(文本或二进制).

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).

** 我完全认识到可以使用 Meshlab 之类的东西来转换为 OBJ 或其他格式,但这似乎是一个不必要的额外步骤,阻碍了工作流程.**

** 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. **

似乎 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这似乎没有完全集成.

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.js which I'd like to avoid because of the license, and https://github.com/tbuser/three.js/blob/master/utils/stl_geometry.js which seems not fully integrated.

我错过了什么吗?

推荐答案

有一个 STLLoaderexample如何使用.这些被添加到 Three.js 提交 涉及 STLLoader.

There is an STLLoader and an example of 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 commits involving the STLLoader.

这篇关于Three.js中加载STL文件的首选方法是什么的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆