This script automates the most laborious part of STL to OpenSCAD script conversion.
OpenSCAD is able to import object from STL files, however this capability is not preserved in thingiverse.com Customizer. As a result of this many OpenSCAD scripts can't be used directly from thingiverse.com. However you are allowed to inline STL model, include it in your OpenSCAD script and then upload it to thingiverse.com.
The steps:
- get your STL file and open it in OpenSCAD
- select File > Export > Export to OFF...
- run this script on the OFF file
- e.g.
./off2polyhedron.sh model.off > model.scad
- e.g.
- the SCAD file is OpenSCAD script and can be used as is or copy-pasted to another SCAD file
I have looked at STL, OFF and AMF file formats. All of them are text based and could be used for this conversion but:
Relevant issues:
openscad/openscad#2229
openscad/openscad#2230