I know this was already addressed in this post: How to read a csv file and use the values as x and y points in blender? but I don't have enough reputation yet to comment on it to keep the thread together. Sorry for the noise.
I'm running:`
# Populate a volume in Blender with spheres positioned from a CSV
import bpy, csv
path = "insertpathhere"
with open(path) as csvfile:
content = csv.reader(csvfile, delimiter=',', dialect='excel')
for i,row in enumerate(content):
if i == 0: continue # skip header
x,y,z = row [0], row[1], row[2]
bpy.ops.mesh.primitive_uv_sphere_add(location = (float(x), float(y) ,float(z)))
` I'm using a csv with a x,y,z column set up with header.
The problem is that upon execution I'm only getting the last row of data showing up as a single object (in the right spot at least) rather than all rows populating as a new object. The failure to make an object per each iteration suggested changing indentation of bpy.ops.mesh.primitive_uv_sphere_add(location = (float(x), float(y) ,float(z)))
but that didn't work. So here I am. Let me know where the heck this is failing at.
Thanks in advance!