I'm trying to make script which will get object.location but it doesn't works: result of my script is:
Trawa.196 and its location is: Vector (0.0000, 0.0000, 0.0000)>
And every object in my scene has these values
ObjectName = "Grass."
ObjectNameNumber = 1
for i in range(1,200):
if(i<10):
ObjectName = "Trawa.00" + str(ObjectNameNumber)
objectTrawa = bpy.data.objects[str(ObjectName)]
objectTrawa.select = True
print(ObjectName, "and its location is: ", objectTrawa.location)
bpy.ops.object.select_all(action='DESELECT')
ObjectNameNumber+=1
if(i>=10 and i<100):
ObjectName = "Trawa.0" + str(ObjectNameNumber)
objectTrawa = bpy.data.objects[str(ObjectName)]
objectTrawa.select = True
print(ObjectName, "and its location is: ", objectTrawa.location)
bpy.ops.object.select_all(action='DESELECT')
ObjectNameNumber+=1
if(i>=100):
ObjectName = "Trawa." + str(ObjectNameNumber)
objectTrawa = bpy.data.objects[str(ObjectName)]
objectTrawa.select = True
print(ObjectName, "and its location is: ", objectTrawa.location)
bpy.ops.object.select_all(action='DESELECT')
ObjectNameNumber+=1
objectTrawa.matrix_world.translation
for the final world matrix location. $\endgroup$str(15).zfill(3)
, that should simplify your code a lot. $\endgroup$