Hello,
I’m doing an experiment with the onClick property in SketchUp Dynamic Components. I have a complex monitor mount, which has several arms and rotation axes, each nested with the next one, similar to a matroshka doll. I’m trying to create multiple different clickable spots within this whole constellation, to make its parts rotate, without having to go inside and adjusting it manually. I’ve considered adding Snaps to the rotation points, but they don’t work because of the nested structure of the monitor arm. You have to manually go inside the groups to use the corresponding Snap.
Question: Is it possible to assign different onClick properties to different parents and children? In this example, the first group (Axis1) contains the Axis2, which contains Axis3 and so on. I want to assign 3 different onClick properties to each container.
Attaching a screenshot below. The guides are for visual purposes only, to show where each rotation axis is supposed to be:
At the intersection of the 3 vertical guides and their corresponding guidepoints are the Z rotation axes.
Also attaching a screen recording, to demonstrate the animation manually:
I know that it is possible to trigger a simultaneous onClick animation by one click. What I’m rather looking for is separate onClick animations within onClick animations, if it is possible.
If someone skilled could have an input I’d be very grateful. Thanks a bunch! 
P.S. For what it’s worth, there’s also 2 horizontal rotation axes which I removed from this post, to keep it as simple as possible. The second arm (with the origin at “Axis2, Rotationpoint2” also rotates on the Y axis up and down.
First of all, nice design. What you are asking may be a little beyond a single click option. What I might suggest, is component option dropdown list of preset angles (maybe 15 degree increments). I would imagine the screen would stay facing the user so that can be done with math (calculations based on other joints angles). This method you could add pivot angle options too.
Clicks allow for one movement, but you can string combinations of movements. So you could make 15 degree movement from 0 to 90 in one joint, then add 0-90 for second joint, while using math calculations to maintain the forward facing angle for the screen. I’ll see if I can mock something up to illustrate better.
1 Like
Hey there, thank you very much for appreciating the modelling! 
Regarding your advice - that is exactly the path I went with. I’ve stringed together 45° increment angles starting from 0° to 180° and then back to 0. But then I realized 45 is too limiting, so went with 15° increments.
But still, I can only manage only 1 onClick animation. The remaining 2 rotation axis I have to manually go inside and adjust.
app.sketchup.com/app?3dwid=625f31b9-2d3c-4660-b354-66a930d55db2
I made a file and shared in 3d warehouse.
I made a dropdown list for each pivot point.
The numbers of angle to rotate can be modified in the component attributes top level.
Component is built in 3 sections: Lower arm, top arm, and screen connector.
You will see to keep the screen facing front you can use negative or positive values depending on the base arm angle
1 Like
ScreenPivot.skp (44.9 KB)
Havent added click annimation but this works from the component option tool menu
1 Like
Hey Mark, thank you for taking the time and making this! This is certainly a good approach that I never considered. The scripting is complex for me to understand haha, I’ll have to go through it with a fresh cup of coffee later in the afternoon. Still appreciate it very much!
1 Like
Vahe,
It was a mental challenge and a good exercise. I still have a few tweaks in mind to get closer to what your goal is.
The parts that need attention are the axis location and orientation of each component, geometry groupings, and hard code sizes. Each rotation needs its geometry grouped for the movement you want. And here is a big one: the size of the shapes need to be hard coded, I struggled with the LenX LenY and LenZ changing by themselves when moving them. There is an issue with SketchUp recalculating size when geometry is moved. The work around is in the component LenX (Y and Z) values, click in the size field- keep the number Sketchup tells you- but add an Equal sign in front (=) that forces the geometry to stay that size during movements. Then for some reason the rotation works better based on a variable- so I created a custom variable for each child level of the component- and call the variable in the RotZ attribute. The Blue Axis is where the geometry will center its rotation around for RotZ. In the Future the Red axis will be the RotX rotation you will want for the screen tilt. (Ill try coding that next)
ScreenPivot.skp (40.3 KB)
added a bunch of pivot drop downs.
Basically every point has an x,y,z rotations
I only gave positive values for a few (a tilt down from the base didn’t make sense).
The hiccup I haven’t resolved is:
the x rotate (raising arm up and down) happens after the Z rotate,
and makes the arms twist? Its an Axis issue I haven’t figured out.
Not sure how to get the up and down to work without twisting.
So I added the Y rot to compensate.
Through a combination of all the values we can get the screen to just about every position I can think of.
Hope this helps.
ScreenMountOnClick.skp (147.8 KB)
I read a post from pcmoor. he said to limit rotations to 1 per component level (and be components not groups if more than 1 nested rotate). this seems to be working. I set an onClick event to reset values to zero. I can set animation to onclick, but it would need target numbers. We can set a number of destinations ( for example imagine a 9 button phone grid, each number 1 to 9 is the screen destination. then we can code each coordinate in the code of onClick. then 9 clicks would move the screen to each spot then back to start.
Edit: I remade the onClick event to cycle through 9 preset locations as described.
1 Like