-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathblenderExportPoints.py
More file actions
27 lines (22 loc) · 840 Bytes
/
Copy pathblenderExportPoints.py
File metadata and controls
27 lines (22 loc) · 840 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import os
import math
import inspect
import bpy
def export(outputDir):
transform = [1,-1,1]
collection = bpy.data.collections['Collection']
for object in collection.objects:
filename = outputDir + "/" + object.name + ".csv"
filename.replace(" ", "_" )
file = open( filename, "w+" )
vertices = [ object.matrix_world.to_3x3() @ vert.co for vert in object.data.vertices ]
for vert in vertices:
file.write( str(vert[0] * transform[0]) + "," + str(vert[1] * transform[1]) + "," + str(vert[2] * transform[2]) + "\n" )
file.close()
if __name__ == "__main__":
# In blender, you can run this script by:
# import sys
# sys.path.append("directory_containing_this_script")
# import blenderExportPoints
# blenderExportPoints.export("outputDirectory")
export("./")