Negative numbers in Dynamic Components


#1

I think I’m dealing with a bug in 2017 Pro. I’m attempting to create a dynamic component and I can transform objects using negative distances or degrees. For example onCLick ANIMATE(RotY,0,10) works perfectly fine, however onClick ANIMATE(RotY,0,-10) will rotate the object -10 but never return it to 0. I also see that when a negative number is used a custom attribute is added with the negative number as the value. I’m confused. I’m trying Sketchup and want to buy it but not if this doesn’t work.


#2

Yeah it’s a weird bug. Try with quotes:

ANIMATE("RotY",0,-10)

#3

Thanks Jim, that works for rotation but still can’t get position to work. Example ANIMATE(Y,6.317,.96) works fine but ANIMATE(Y,-6.317,.96) doesn’t. Tried quotes around the Y and get a parse error.


#4

That I’m not sure about - it works for me on a simple example. Can you share the model?


#5

OK I’ve discovered through another tutorial that you just have to keep trying and dismissing the dialogs and removing and re-adding the quotation marks and then yes it will eventually work…so dumb…


#6

If you try something dumb but it works, then it’s not so dumb is it? :grinning:

But yes, DC’s do have a few bugs.


#7

haha! Thanks for the help on this, jim_foltz!


#8

I think I found a pretty easy solution for this issue.
Example in DC attributes:
Y axis: =144"
onclick: animate(travel,0,-21)
travel: 0

on click the object would move the -21" (Y axis @ 123") but wouldn’t return to 0…not gonna do!!
The fix is to subtract the y axis travel distance from the y axis origin so the travel distance will always be positive.
It would be like this:

Y axis: =123"
onclick: animate(travel,0,21)
travel: 0

By keeping the travel distances positive in this instance the object will take a “onclick” to get it in the original position but then it will function properly.

The fix for rotating negative numbers seems to be to flip the component on its green or red axis then the rotation can be a positive number.
Example would be: double cabinet doors, set up your onclick rotation on the right door to open out, check for proper function. Then copy paste( or move+opt.) your new door then flip that new door along Y or X axis(whichever way you abject is facing). It seems to me they will actually both open at the same time on one click until you edit either of them.