save
This commit is contained in:
+12
-1
@@ -2,6 +2,7 @@ import os
|
||||
import sys
|
||||
import numpy as np
|
||||
from torch.utils.data import DataLoader
|
||||
from stl import mesh as mesh_stl
|
||||
|
||||
|
||||
|
||||
@@ -48,4 +49,14 @@ def text_to_html(lines):
|
||||
html = ''
|
||||
for line in lines:
|
||||
html += "<pre>" + line + "</pre>"
|
||||
return html
|
||||
return html
|
||||
|
||||
|
||||
|
||||
def save_stl(file, mesh, faces):
|
||||
obj = mesh_stl.Mesh(np.zeros(faces.shape[0], dtype=mesh_stl.Mesh.dtype))
|
||||
for i, f in enumerate(faces):
|
||||
for j in range(3):
|
||||
obj.vectors[i][j] = mesh[f[j],:]
|
||||
|
||||
obj.save(file)
|
||||
Reference in New Issue
Block a user