【问题标题】:STL exporter for BufferGeometry in THREE.jsTHREE.js 中 BufferGeometry 的 STL 导出器
【发布时间】:2017-03-24 00:23:34
【问题描述】:

我有许多 BufferGeometries,它们组成一个场景,它们的网格已经转移到不同的位置。我想知道是否有办法将此场景从包含 BufferGeometries 的网格导出到 STL 文件。非常感谢。

【问题讨论】:

  • 此答案处理将变换矩阵直接应用于几何以修改它们,因此,如果您按照@leota 的建议进行操作并从 BufferGeometry 获取几何,您应该能够应用变换并导出修改后的几何学。 stackoverflow.com/questions/27022160/…

标签: javascript three.js buffer-geometry stl-format stl-fileformat


【解决方案1】:

您可以像这样将 BufferGeometry 转换为 Geometry:

var geometry = new THREE.Geometry().fromBufferGeometry( bufferGeometry );

然后您可以导出为 STL 格式。

【讨论】:

  • 谢谢@leota。由于它们仍然是几何图形,它们没有转换,我对它们的网格进行了转换。我需要将包含 BufferGeometries 的网格导出到 STL 文件。
【解决方案2】:

试试吧:

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' );

【讨论】:

  • 这似乎没有保留存储在 BufferGeometry 中的转换。
猜你喜欢
  • 2017-12-21
  • 2015-04-01
  • 1970-01-01
  • 2020-12-05
  • 1970-01-01
  • 2016-08-08
  • 2018-10-09
  • 2017-09-22
  • 2014-06-29
相关资源
最近更新 更多