I guess this is quite a noob question, but I still do not get it to work.
I want to duplicate an object and get acces to this duplicated object.
Something like this:
New_object = duplicate_Object(“Cube”)
I found a way to duplicate an object when it is selected. But afte duplicating it, I do not know how I can assign this duplicated object to a new variable…
You will have to subscribe to the concept of operators which is a bit different from what you seem to be expecting. You will have to call “bpy.ops.object.duplicate()” and then get the duplicated object via “bpy.context.active_object”. If you have several objects selected before calling the operator, you can get the duplicates via “bpy.context.selected_objects”
thanks for your feedback.
I am not very familar with coding in Blender.
But I would prefer not to use any commands which refer to “selected” objects.
Since selecting objects should more or less only be necessery when you are working in the 3d view. With Python I would like to adress/call the objects directly…
thanks for the code snippet.
Interesting that I have to explicit link it to the scene after I have copied it.
But this seems to be more straight forward then the work around with “selecting” the objects…