CityEngine 2016 integer range sliders removed?

1125
6
Jump to solution
11-24-2016 07:11 AM
DavidKossowsky1
Esri Contributor

In 2015 we used to be able to create range sliders that moved in integer values.

e.g. when I wrote @Range(2,10), I would only get 2,3,4,5,6,7,8,9,10 as my options on the slider

Now when I write @Range(2,10), I get 2.0, 2.1, 2.2, 2.3........9.9,10.0.

Is there no way to force the range sliders to stick to integer values anymore?

0 Kudos
1 Solution

Accepted Solutions
CherylLau
Esri Regular Contributor

Yes, I see this is a problem.  Sorry, unfortunately, the step size is automatically determined and cannot be changed.  Thank you for the valuable input.

If you really need to use the integer values in the code, you can create another variable and use rint() to round the values you get from the slider.  You just won't see the rounded values in the slider.

@Range(2, 10)
attr a = 2

const b = rint(a)

View solution in original post

6 Replies
CherylLau
Esri Regular Contributor

Yes, I see this is a problem.  Sorry, unfortunately, the step size is automatically determined and cannot be changed.  Thank you for the valuable input.

If you really need to use the integer values in the code, you can create another variable and use rint() to round the values you get from the slider.  You just won't see the rounded values in the slider.

@Range(2, 10)
attr a = 2

const b = rint(a)
DavidKossowsky1
Esri Contributor

Hi Cheryl,

Thanks for letting me know. Do you have an idea if this will be adjusted in a later release? The main concern that I have heard is if a person is using a slider to adjust the number of floors in a building, they don't want to slide to a value of 2.8 floors, but rather want whole numbers that are realistic to true building values. Even if the rule is rounding, the inspector panel will still show a decimal value.

0 Kudos
LR
by
Occasional Contributor III

If you want whole numbers you could use text, but that won't display a slider.

@Range("1","2","3")
attr val = "0"

float(val)
DavidKossowsky1
Esri Contributor

True, thanks for the idea. I guess I'll have to use it as a workaround for now.

0 Kudos
ThomasFuchs
Esri Regular Contributor

Additional remark:
The CityEngine help on Annotations points out, that @Range(value1, value2, value3, ...) can be numeric or string.

0 Kudos
LR
by
Occasional Contributor III

If you don't mind the dangling values in the UI you could use floor(slidervalue).