A javascript 3D model viewer and STl/OBJ parser. Uses the Three.js 3D Engine.
Examples
-
Client Side Ajax
All parsing of the STL/OBJ files are done on the client side in javascript and files are loaded dynamically via ajax. This has the benefit of
not requiring anything on the server side other than to serve up the files. The downside is that it can be pretty slow and it would be hard to
embed it on other sites because of ajax limitations.
-
Client Side Inline
This shows how you can embed (ascii-only) data inside the html page as a javascript variable. This gets around the ajax same origin policy problems
however it's still sometimes slow because the parsing is still done client side and you can't dynamically load new objects.
-
Server Side Ajax
This uses a php script to pre-parse the object (ascii or binary) into a format that thingiview can load very fast and then dynamically load it using
ajax. Downside of course is it puts a load on the server and still has the ajax same origin limitations. Note: It's very likely that unless you
have a really powerful server, you might need to increase the php timeout otherwise it could fail on really large models.
-
Server Side Inline
This one shows how you can use the server side php script to pre-parse and then generate the javascript inline. This makes it suitable to be
used as a widget on other sites.
-
Pre-Parsed JSON Inline
The fastest of all options and the least amount of load on the server. This requires that you convert your models into the JSON format Thingiview.js
uses internally and then save that JSON to a file. Then you can just load in that file whenever you want to view that model. Basically caching it.
-
Download from Thingiverse
This example shows the usage of the download.php script that downloads the specified STL file from Thingiverse, parses it into JSON, then
loads it into Thingiview.js. This file can then be included in other sites for instance in an iframe.
Todo
- figure out a way to make it into a widget that people can embed on another site
Known Bugs
- Three.js fails in IE (suggest you force chrome frame plugin to be installed)