I have a number of BufferGeometries, which consist a scene, and their meshes have been transferred to different positions. I was wondering if there is a way to export this scene, from meshes, containing BufferGeometries to STL file. Thank you very much.
STL exporter for BufferGeometry in THREE.js
Asked Answered
This answer handles applying a transform matrix directly to geometries to modify them, so if you do what @leota suggested and get the geometry from the BufferGeometry you should be able to then apply the transform and export the modified geometry. #27022660 –
Indoctrinate
You can convert you BufferGeometries to Geometry like so:
var geometry = new THREE.Geometry().fromBufferGeometry( bufferGeometry );
then you can export to STL format.
Thank you @leota. Since they are still geometries, they do not have the transformation, I made to their meshes. I need to export the meshes, containing BufferGeometries to STL file. –
Carnival
just try:
scene.traverse(function(child){
child.updateMatrix();
child.applyMatrix(child.matrix);
});
var exporter = new THREE.STLExporter();
exporter.parse( scene );
function saveString( text, filename ) {
save( new Blob( [ text ], { type: 'text/plain' } ), filename );
}
saveString( exporter.parse( editor.scene ), 'model.stl' );
This doesn't seem to preserve the transformations stored in a
BufferGeometry
. –
Maltose © 2022 - 2024 — McMap. All rights reserved.