Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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

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

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.

Am I missing something?

like image 410
user1460044 Avatar asked Jun 16 '12 02:06

user1460044


People also ask

What file types does three Js support?

The three. js library offers loaders for numerous file formats like FBX, Collada as well as OBJ but the recommended format for importing and exporting data is glTF. The great thing about glTF file format is that it is very compact and can be easily transmitted and also loads very fast.

What are STL files used for?

STL is a file format commonly used for 3D printing and computer-aided design (CAD). The name STL is an acronym that stands for stereolithography — a popular 3D printing technology. You might also hear it referred to as Standard Triangle Language or Standard Tessellation Language.


1 Answers

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.

like image 61
Luis E. Fraguada Avatar answered Oct 10 '22 05:10

Luis E. Fraguada