Add a component to a container


I have a container of the type “VC_COMPONENTCONTAINER”, which I created in python. Now I want to add a component to it from the python script. Anyone knows how it can be done?


You can use grab-method:

1 Like

Thank you!

Do you know how to make the component stay in the container?

I would like to move the component into the container and make it stay there until I remove it. The grab-method work for putting the component into the container, but when I reset the simulation, the component is not in the container anymore.

All static components return back to their initial locations, and all dynamic components are deleted when you reset the simulation.

Do you know how do I change the initial location to a component to be inside a container?

Typically containers are only used during the simulation. If you want to create hierarchies while simulation is not running, you can attach nodes to each other.

Saving the initial state of components is done from UI with the Save state button, and from python API via the vcComponent.saveState() method.