Hello everybody,
I am trying to write a script in which I copy an object many times and add a constraint to the duplicated object…
To duplicate the object, I select inside the script and use:
bpy.ops.object.duplicate()
My problem is now how can I assign this new object to my variable (e.g. dupli_object).
As far as I know to assign the object I can use this:
object_variable = bpy.data.objects['ObjectName']
To assign the constraint then I have to use:
dupli_object.constraints.new('FOLLOW_PATH')
Because the object is created inside a loop in the script I do not want to assign it with the name.
I hoped I can get acces to it when I use the Collection number from:
bpy.data.objects[nr]
Because I thought that the last created object will have the last number in the collection.
But I noticed now, that this is not true and so my code creates an error…
So the basic problem I have, how can I assign a variable the duplicated object, so that I can get acces to the constraints??
I hope I explained my problem good enough…
I would appreciate every help I can get.
Thanks in advance
Greetings dechgo