Can you round in 30" increments?
-
I've got a component that I want snap in 30" increments when I scale it. Right now I've got
=NEAREST(CURRENT("LenX"),60,90,120,150,180,210,240,270,300,330,360,390,420,450,480,510,540,570,600,630,660,690)
...but that's pretty messy and limits the sizes. Is there some way I can use the ROUND function perhaps (or something else) to just tell SU to snap in 30" increments?
-Brodie
-
How about
lenx=((lenx/30.0+0.5).floor * 30.0) lenx=30.0 if lenx==0.0 -
I'm not quite sure how to use that. The ".floor" isn't valid, right? Is that a mistake or are you describing something?
-Brodie
-
It looks like the magic code is...
=round(current("LenX")/30)*30 -
@unknownuser said:
I'm not quite sure how to use that. The ".floor" isn't valid, right? Is that a mistake or are you describing something?
-Brodie
".floor" is most definitely valid. It is equivalent to ".to_i" in this case.
-
You're bringing me further down the rabbit hole, ".to_i"? What's that?
If, as a test, I input...
=100.floor...into the LenX box, it gives me an error (not really an error but it doesn't seem to know what to do as it reports back "#=100.floor". Likewise, when I input your code it also doesn't seem to work.
-Brodie
-
Are we both talking dynamic components or are you referring to ruby scripting?
-Brodie
-
I'm wondering if Sam is speaking in Ruby? I'm not a DC aficionado but it does look alot like ruby

-
Oooops double post....
-
DOH!!!!!!!!!
Yes, the .floor and .to_i are Ruby elements. Sorry I didn't realize we were discussing Dynamic Components.
Never mind.
-
@sdmitch said:
DOH!!!!!!!!!
Yes, the .floor and .to_i are Ruby elements. Sorry I didn't realize we were discussing Dynamic Components.
Never mind.
ah ha, no worries
I was hoping I'd missed out on some DC secrets.-Brodie
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better π
Register LoginAdvertisement