Multi-function dynamic component creation

Hello.
I’m working with 2017 PRO, and have a question about dynamic components.

I have a cupboard that has a door (component) that I have made to open and close upon click.
However, behind the door is a slide out shelf (a component that includes the door component) which I would like to be able to slide out with a second click (moving the door in and out with the shelf).
IE:
Click 1 = Open door
Click 2 = Slide out drawer and door
Click 3 = Slide drawer back into place and close door.

Is this possible?

It seems that I can do one or the other, with my level of dynamic component understanding, but not both functions.
Any help is greatly appreciated. Cheers…

Use the onClick SET attribute to cycle through your 3 states.

SET("DoorDrawer", 1,2,3) 

Then in your door component it would set the hinge rotation based on that state variable. Your drawer component would do something similar with its location.

I hope that makes sense. I might do a demo when I get back to my computer.

1 Like

see another example here:

You can have multiple commands in the onclick attribute, separated with “;”
the trick lies in the swapping of the order.

1 Like

You need to start by thinking about exactly what you want to happen. Your specification is a bit confusing. e.g. Click 2 opens the door that will still be open after Click 1.
“moving the door in and out with the shelf”.
Does that mean the door is pushed out by the shelf when you said the door opened on its own in Click 1. Write it down or type it out clearly first.

Do you want it animated like Mike’s example or just to instantly change state on a click? You haven’t shared a .skp model so we have to guess what you’ve already done with the door and drawer moving one at a time.

Here’s what I meant earlier:

2 Likes

Here’s an animated version. This works, but wasn’t very reliable to set up. As there are repeated values in the list like when you want the door to stay open and the drawer slide out. It was out of sync then when I made a copy it started working.


2 Likes

Hey Mike and McGordon,

Thank you both so much. Man, you guys in this community are on the ball.
I’m really just learning Sketchup, but already love it.

I really appreciate the help, and really quick responses too.
You guys are awesome.

Cheers. : )

1 Like

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.