Negative numbers in Dynamic Components

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.

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

ANIMATE("RotY",0,-10)

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.

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

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…

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.

haha! Thanks for the help on this, jim_foltz!

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.

Hi guys,
I’m using the last version of Sketchup on Mac and I still have exactly the same problem with negative numbers and rotation. If it’s a negative number, the object doesn’t want to come back on the original position on the second click. I can’t believe that is a bug and probably I’m doing something wrong… anyone who could give me a solution?
Thanks :slight_smile:

Ok! I have my answer.
I’m working with MAC and in my parameter I had the option of “automatic quotes” (second one on the picture below) but not in the format requested by Sketchup.

Capture d’écran 2024-01-20 à 06.42.53

So every time I typed my quotes, Sketchup didn’t recognize the format and my formule didn’t worked.
To solve it I had to change my Keyboard parameter on my Mac (see how to do it [here]

Summary

(Remplacer du texte et des signes de ponctuation dans des documents sur Mac - Assistance Apple (FR))&text=Go%20to%20Text%20Input%20on%20the%20right%2C%20then%20click%20Edit,Use%20smart%20quotes%20and%20dashes.”)

Hope this will help new beginners like me!

I think it’s called “smart quotes” and i’ve seen questions here before regarding problems with quotes.
I believe it’s a MAC thing…

See this tread fo more info: Can't use ' or " modifiers to indicate feet and inches - #12 by McGordon