Components inside a Component

I have a question.
I created a dynamic component (cabinet with drawers)
And I want to anymate the drawers.
But de component of the drawers will not take the attributes of the maincomponent (cabinet)
Can I fix that?OK_2POTL.skp (4.2 MB)OK_2POTL_With_animation.skp (4.2 MB)

They can only be manually animated with a mouse click.

How do you wish to animate them ? All at once or separately ?

If you wish to animate each drawer separately, then the main component must not have an onClick attribute.

Each drawer subcomponent would then each have their own onClick attribute.

We cannot know unless you add the DC file to the first post. (Use the pencil icon to edit.)

1 Like

I prefer separatly

Thanks for the info,
I have able to do that, but the measurements will not scale when I adjust the measurements of the maincompontent… because the don’t link

I put the sketchupfile in the first post

1 Like

Is there a way to link the subcomponent to the main component

Yes, you are using the top level DC name in a grandchild (kleinkind) component formula.
Nested DC objects can only see =parent! (ouder) or sibling (broer of zus) objects.

To get attributes from grandparent (grootouder) you need to pass them down (geef ze door) to the parent (ouder) … like passing genes (zoals passerende genen) …

In grandparent "OK_2potl" …

voeg "=0.2cm"

In "Lade_Boven" parent

ouder_voeg "=parent!voeg"

In "Lade_Deur_Boven" grandchild (kleinkind) …

X "=parent!ouder_voeg"
1 Like

You also need to break down the sliding part and the fixed part of the runners(!)
You can create a separate component for all the parts of the top and lower drawer and add the ā€˜OnClick’ to that or combine several ā€˜OnClick’ formulas separated by ā€˜;’ to the lade fronts only.
(Eg. OnClick=ANIMATE(ā€œOnderdeel_boven_lade!Xā€,0,-40,0) ; ANIMATE(ā€œAnder_onderdeel!Xā€,0,-40,0)