Extracting STL API - leetaeju/VenusTouch GitHub Wiki

Extracting STL API

This module helps extracting Unity object as STL file.
You can find STLExporter script in 0_Scripts/Exporting
Set parent to all meshes you want combine, then call ExportMesh()

Or you can use MeshToFile directly.

public void OnClick(){
    // Export mesh to STL file
    Mesh mesh = GetComponent<MeshFilter>().mesh;
    GetComponent<STLExporter>().MeshToFile(mesh, "AmazingModel.stl");
}

And beware of coordinate system; most of 3D viewer application uses right-handed coordinate system,
while Unity uses left-handed. If you want avoid this reversing, you have to change coordinate system.

This can be achieved easy by reverse Z axis.

// Have to modify all of them
writer.Write(-v[a].z);
writer.Write(v[a].x);
writer.Write(v[a].y);

writer.Write(-v[b].z);
writer.Write(v[b].x);
writer.Write(v[b].y);
⚠️ **GitHub.com Fallback** ⚠️