1

I have the model of a vehicle body with its wheels and empty coordinates systems at the wheels which are all parented sequentially to the vehicle body. I would like to ask how it is possible to duplicate all the objects and the subsequent relationships using the Python API. In the following image, you can see the relationships that I described; I would like to duplicate this.

enter image description here

Chris Patr
  • 73
  • 6
  • This copies all objects in a collection, and reparents to a copy if parent also copied. https://blender.stackexchange.com/a/157855/15543 – batFINGER Feb 13 '21 at 15:11
  • thank you @batFINGER for your comment. I am new to Blender, so it is still not so clear to me what the script that you provided is doing; I will play with it. If I am not mistaken though, it duplicates a collection. In my case, I would want to just duplicate an object along with its children as I would do from the GUI after selecting everything and copying and pasting them. – Chris Patr Feb 13 '21 at 16:41
  • In particular, I want to duplicate the ChassisAM (seen in the picture) along with its subsequent relationships. – Chris Patr Feb 13 '21 at 16:44

1 Answers1

0

I used to bpy.ops.object.duplicate to duplicate the selected objects coming from the select_set() method. In this way, the underlying parent/children relationships are maintained during the duplication.

Chris Patr
  • 73
  • 6