How can I create a lot of spheres? I have a csv file with x,y,z,r (radius) coordinates. I saw some topics but nothing worked to me.
I tried ask a question, but this was classified as "Your post has been associated with a similar question. If this question doesn’t resolve your question, ask a new one." I read some topics but nothing worked to me, so that I opened a new topic.
I have this code:
import bpy
text_file = open("C:\Users\nabuc\Desktop\1700txt - copia.txt", "r")
lines = []
#Read in contents to a list
for line in text_file:
lines.append(line.strip())
#create spheres
for e in lines:
temp=e.split(',')
bpy.ops.mesh.primitive_uv_sphere_add(segments = 64, ring_count = 32, location=(float(temp[0]),float(temp[1]),float(temp[2])),size = float(temp[3]))
bpy.ops.object.shade_smooth()
text_file.close()
but:
Python: File "C:\Users\nabuc\Documents\untitled.blend\Text", line 12 temp=e.split(',') ^ IndentationError: expected an indented block
location: :-1
thanks for your help
EDIT 2 (I can't edit code on answer) To avoid this indentation error, I edit as:
import bpy
text_file = open("C:\Users\nabuc\Desktop\1700txt - copia.txt", "r")
lines = []
#Read in contents to a list
for line in text_file:
lines.append(line.strip())
#create spheres
for e in lines:
temp=e.split(',')
bpy.ops.mesh.primitive_uv_sphere_add(segments = 64, ring_count = 32, location=(float(temp[0]),float(temp[1]),float(temp[2])),size = float(temp[3]))
bpy.ops.object.shade_smooth()
text_file.close()
but this return:
Python script failed, check the message in the system console
"IndentationError: expected an indented block"To view a specific error https://blender.stackexchange.com/questions/6173/where-does-console-output-go – batFINGER May 20 '21 at 15:34