Format in slider expression

Why doesn’t this work?

format_slider.gh (6.8 KB)

Doesn’t Format take a string as input? I’m pretty sure the number slider doesn’t produce any type of strings inside the component.

1 Like

If you’re trying to round to a certain decimal place, Pufferfish has a component you can use, or you can setup a script to do it. (2) Grasshopper | Round to Specific Decimal - YouTube

I know how to round numbers I’m just wondering why the formatting does not work inside a slider.

@martinsiegrist
It works, if the output is a number and not a string.
Converting to int works, but negates the purpose.

I don’t know how to convert to float in the Expression editor…

I tried CDbl(x) and then CStr(x) but unfortunately no success.

Typkonvertierungsfunktionen (VBA) | Microsoft Learn

It doesn’t work because the output of Format is a String, while the number slider requires a numeric output from an expression.

01 is string representation and cannot be displayed that way using a numeric data type.

1 Like