My goal is to add components (which also have children) to a main component as children, so that when the main component is moved in the layout, they all move with it. Unfortunately this doesn’t work with root components. Is there another way how one can do this? Attach is not sufficient in my case.
foreach (var child in app.World.Components)
{
if (child != main)
{
child.RootNode.AttachTo(main.RootNode);
}
}
2 Likes
Is there a solutions without using a Python skript?
from vcScript import *
app = getApplication()
#component you want to attach that have child components attached to it
comp = getComponent()
#parent component to which you want to attach
parent_comp = app.findComponent("Block Geo")
#to reatin the position of the child component after attaching
m = parent_comp.InverseWorldPositionMatrix * comp.WorldPositionMatrix
#use attach method in vcNode
parent_comp.attach(comp)
#retain the child component(s) postion
comp.PositionMatrix = m
comp.update()
app.render()
