# DC is behaving badly

**URL:** <https://forums.sketchup.com/t/dc-is-behaving-badly/185795>\
**Category:** Dynamic Components\
**Created:** [January 6, 2022, 10:31am UTC](https://forums.sketchup.com/t/dc-is-behaving-badly/185795 "2022-01-06T10:31:26Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![halodri](https://sea2.discourse-cdn.com/sketchup/user_avatar/forums.sketchup.com/halodri/32/51764_2.png) [@halodri](https://forums.sketchup.com/u/halodri)\
**Post date:** [January 6, 2022, 10:31am UTC](https://forums.sketchup.com/t/dc-is-behaving-badly/185795/1 "2022-01-06T10:31:26Z")

</div>

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?

 ![image](https://global.discourse-cdn.com/sketchup/original/3X/1/b/1b801f418eae59d2ad4ca874f8a1ab04d47f2f16.png)  
[lala.skp](https://forums.sketchup.com/uploads/short-url/m79Ok3iguA1CCGCEq2yhzIG5hpX.skp) (342.8 KB)

---

<div class="post-metadata">

**Author:** ![pcmoor](https://sea2.discourse-cdn.com/sketchup/user_avatar/forums.sketchup.com/pcmoor/32/3427_2.png) [@pcmoor](https://forums.sketchup.com/u/pcmoor)\
**Post date:** [January 6, 2022, 10:49am UTC](https://forums.sketchup.com/t/dc-is-behaving-badly/185795/2 "2022-01-06T10:49:40Z")

</div>

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](https://forums.sketchup.com/uploads/short-url/mYE1luRZ44vBgki3zbVt3peE8bK.skp) (353.1 KB)  
a better flow

---

<div class="post-metadata">

**Author:** ![halodri](https://sea2.discourse-cdn.com/sketchup/user_avatar/forums.sketchup.com/halodri/32/51764_2.png) [@halodri](https://forums.sketchup.com/u/halodri)\
**Post date:** [January 6, 2022, 11:54am UTC](https://forums.sketchup.com/t/dc-is-behaving-badly/185795/3 "2022-01-06T11:54:13Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![halodri](https://sea2.discourse-cdn.com/sketchup/user_avatar/forums.sketchup.com/halodri/32/51764_2.png) [@halodri](https://forums.sketchup.com/u/halodri)\
**Post date:** [January 7, 2022, 9:06pm UTC](https://forums.sketchup.com/t/dc-is-behaving-badly/185795/4 "2022-01-07T21:06:00Z")

</div>

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

What does the value 140 mean?

![image](https://global.discourse-cdn.com/sketchup/original/3X/c/0/c09d6473313785e6fd01ee587e00c854d40f34ab.png)

---

<div class="post-metadata">

**Author:** ![pcmoor](https://sea2.discourse-cdn.com/sketchup/user_avatar/forums.sketchup.com/pcmoor/32/3427_2.png) [@pcmoor](https://forums.sketchup.com/u/pcmoor)\
**Post date:** [January 7, 2022, 9:52pm UTC](https://forums.sketchup.com/t/dc-is-behaving-badly/185795/5 "2022-01-07T21:52:15Z")

</div>

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](https://forums.sketchup.com/uploads/short-url/2pqUhVLBMGUNx77SHUa906Ewj5V.skp) (365.8 KB)

---

<div class="post-metadata">

**Author:** ![halodri](https://sea2.discourse-cdn.com/sketchup/user_avatar/forums.sketchup.com/halodri/32/51764_2.png) [@halodri](https://forums.sketchup.com/u/halodri)\
**Post date:** [January 8, 2022, 8:02am UTC](https://forums.sketchup.com/t/dc-is-behaving-badly/185795/6 "2022-01-08T08:02:33Z")

</div>

Wow, thank you, the examples are very instructive!
