blob: 8b802b6c8b3ca92146b48b5d8e54d9370b4ec228 (
plain)
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
28
29
30
|
import bpy
from numpy import genfromtxt
import os
import sys
directory = "other_stars/"
files = [sys.argv[4] + ".csv"]
for data in files:
path = str(directory) + str(data)
print(path)
verts = genfromtxt(path, delimiter=' ', skip_header=0, usecols = (0, 1, 2))
#print(verts)
# 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')
|