DC is behaving badly

Hello SketchUp people,

I tried creating a dynamic component but it doesn’t work. This is not a surprise as I have no experience of DC or programming.

The component consists of a parent component in which two subcomponents are nested.

On the first click the red and green component should move up 100 along the Z axis - this works. On the second click the green component should rotate 90° along the X axis - this doesn’t.

My attempt to turn the green part by 90 ° is with the IF function :

if(Lala!Z=50,90,0)

In my understanding !Z refers to the Z variable in the Lala component and if the Z variable is 50 the if function should return the value 90 to rotate the green component 90° or 0° if !Z is not 50. …but it doesn’t do that.

Any suggestions what I am doing wrong?


lala.skp (342.8 KB)

correction:
only need to use
=if(Bed!Z=50,-90,0) not “lala”,
you can click the attributes into the formula like you would in a spread sheet

I prefer a step approach (like a time line) and employ switches for the desired movements, it creates
lala.skp (353.1 KB)
a better flow

1 Like

Thanks you very much!

Absolutely, your approach is much more elegant. I had this in mind from the beginning, but had even lesser clue how to implement that

Thanks for the file that gives me some brain food to chew on.

Can you refer to material that explains steps and switches for dynamic components?

What does the value 140 mean?

image

that is the total number of steps, 50 for Z, 90 for rotation, you could vary the steps to speed or slow down an action
here’s some more and alternatives
lala.skp (365.8 KB)

1 Like

Wow, thank you, the examples are very instructive!