What is the preferred method for loading STL files in a Three.js file

I am writing an application that is intended to be used as part of mechanical design and modeling, and we would like to be able to use Three.js to load and visualize parts developed in Solidworks, which can be exported as STL (text or binary).

** I fully understand that you can use something like Meshlab to convert to OBJ or some other format, but this seems like an unnecessary extra step that bypasses the workflow. **

Three.js seems to have good boot solutions for Collada, OBJ, UTF-8, VTK, and JSON, but there is no pure example of STL support. I saw some things floating around that were used in the past, for example https://github.com/tbuser/thingiview.js/blob/master/javascripts/thingiloader.js which I would like to avoid because of the license, and also https://github.com/tbuser/three.js/blob/master/utils/stl_geometry.js which does not seem to be fully integrated.

Am I missing something?

+7
source share
2 answers
+10
source

There is an STLLoader and an example of how to use it . They were added to Three.js in August 2012 , about a month after this question was originally posted. Since then, there have been several commits involving STLLoader.

0
source

Source: https://habr.com/ru/post/918226/


All Articles