This commit is contained in:
2023-03-07 12:54:53 +00:00
parent e192f6f9e3
commit cbecf668df
2 changed files with 110 additions and 16 deletions
+11 -1
View File
@@ -442,4 +442,14 @@ def save_stl(file, mesh, faces):
for j in range(3):
obj.vectors[i][j] = mesh[f[j],:]
obj.save(file)
obj.save(file)
def write_obj(file, vertices, faces, colors):
with open(file, 'w') as file:
for v, c in zip(vertices, colors):
line = 'v ' + ' '.join([str(_) for _ in v]) + ' ' + ' '.join([str(_) for _ in c]) + '\n'
file.write(line)
for f in faces:
line = 'f ' + ' '.join([str(_) for _ in f]) + '\n'
file.write(line)