I am trying to move an object using coordinates from a CSV file. The file is written by one python script and then read by a script in blender. Below is the script written to read the file in blender and move the object.
import csv
import bpy
shufflecsv_path = '/Users/Josh/Documents/shuffle.csv'
with open(shufflecsv_path) as file:
shufflecsv = csv.reader(file, delimiter=",", quoting =
csv.QUOTE_NONNUMERIC)
for row in shufflecsv:
bpy.data.objects['Object'].select = True
bpy.data.objects['Plane'].select = False
# row is a list with strings elements so must be converted in float
x, y, z = -float(row[0]), -float(row[1]), -float(row[2])
bpy.ops.transform.translate(value=(x, y, z))
print(x, y, z)
Below is the output of blender when I run the script.
bpy.ops.transform.translate(value=(0.15565, 13.5708, -1.47311), constraint_axis=(False, False, False), constraint_orientation='GLOBAL', mirror=False, proportional='DISABLED', proportional_edit_falloff='SMOOTH', proportional_size=1)
bpy.ops.transform.translate(value=(0.18565, 14.1581, -1.47311), constraint_axis=(False, False, False), constraint_orientation='GLOBAL', mirror=False, proportional='DISABLED', proportional_edit_falloff='SMOOTH', proportional_size=1)
bpy.ops.transform.translate(value=(0.15565, 14.1581, -1.47311), constraint_axis=(False, False, False), constraint_orientation='GLOBAL', mirror=False, proportional='DISABLED', proportional_edit_falloff='SMOOTH', proportional_size=1)
bpy.ops.transform.translate(value=(0.15565, 13.5708, -1.47311), constraint_axis=(False, False, False), constraint_orientation='GLOBAL', mirror=False, proportional='DISABLED', proportional_edit_falloff='SMOOTH', proportional_size=1)
bpy.ops.transform.translate(value=(0.18565, 14.1581, -1.47311), constraint_axis=(False, False, False), constraint_orientation='GLOBAL', mirror=False, proportional='DISABLED', proportional_edit_falloff='SMOOTH', proportional_size=1)
You can see that the output window shows the location of the object should be each of the coordinates, but the object is not at the expected final point.
I have found that when I run the script, the object is moved to a final point that turns out to be the sum of the first three x, y, and z coordinates of the csv file. Any insight, help, or code snippets to fix this problem would be greatly appreciated.
bpy.data.objects['Object']
to be moved globally by (n, n, n) from its original global location. Is this not the case? $\endgroup$