diff options
author | hanemile <emile.hansmaennel@gmail.com> | 2017-12-09 14:19:59 +0100 |
---|---|---|
committer | hanemile <emile.hansmaennel@gmail.com> | 2017-12-09 14:19:59 +0100 |
commit | 5e17688870d04f4a0ef259431f73287ea21b793d (patch) | |
tree | 3402978035adcbc8a54dcfd854368dc4264d8511 /src/view.py | |
parent | 3945015abbfc48da21f2cc81dee006a9955fcc84 (diff) |
minor ajustments
Diffstat (limited to 'src/view.py')
-rw-r--r-- | src/view.py | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/src/view.py b/src/view.py new file mode 100644 index 0000000..5e3808d --- /dev/null +++ b/src/view.py @@ -0,0 +1,48 @@ +import bpy +from numpy import genfromtxt +import os +import sys + +directory = "stars/" +# # print(directory) +# +files = ["final_star15.csv"] + +# print("### \n\n") +# +# for data_file in os.listdir(directory): +# files.append(data_file) +# print(data_file) +# +# print("### \n\n") + +for data in files: + path = str(directory) + str(data) + print(path) + + verts = genfromtxt(path, delimiter=', ', skip_header=0) + + print(verts) + +# verts = [(-1.0, 1.0, 0.0), (-1.0, -1.0, 0.0), (1.0, -1.0, 0.0), (1.0, 1.0, 0.0)] + + # create mesh and object + mesh = bpy.data.meshes.new(data) + object = bpy.data.objects.new(data,mesh) + + # set mesh location + object.location = bpy.context.scene.cursor_location + bpy.context.scene.objects.link(object) + + # create mesh from python data + mesh.from_pydata(verts,[],[]) + mesh.update(calc_edges=True) + + bpy.ops.object.select_all(action='SELECT') + +for area in bpy.context.screen.areas: + if area.type == 'VIEW_3D': + for region in area.regions: + if region.type == 'WINDOW': + override = {'area': area, 'region': region, 'edit_object': bpy.context.edit_object} +bpy.ops.view3d.view_all(override) |