import { Mesh } from "babylonjs/Meshes/mesh"; import { VertexBuffer } from "babylonjs/Meshes/buffer"; import { Vector3 } from "babylonjs/Maths/math"; /** * Class for generating STL data from a Babylon scene. */ export class STLExport { /** * Exports the geometry of a Mesh array in .STL file format (ASCII) * @param meshes list defines the mesh to serialize * @param download triggers the automatic download of the file. * @param fileName changes the downloads fileName. * @param binary changes the STL to a binary type. * @returns the STL as UTF8 string */ public static CreateSTL(meshes: Mesh[], download:boolean=true, fileName:string='STL_Mesh', binary:boolean=false): any { let data; let multiMesh = false; if(meshes.length>1){multiMesh=true;} if(!binary){ data = 'solid exportedMesh\r\n'; for(let i=0; i