2024 Technology Preview Program:
Master powerful new features and shape the latest BIM-enabled innovations
2024-07-19 08:44 AM
I've searched the GDL User Manual and through this forum (and the old deprecated one) but I'm unable to find any mention of a function to convert a string to a real number.
Is this possible?
I have an object parameter that I've define set values for to make them available in a drop-down.
The problem is GDL values only seem to show as a drop-down when the paramater type is set to string.
I want to use the selected value in a numeric expression, but am obviously unable to.
I could convert every single value in the list to a separate numeric variable using if..then but this seems tedious.
Surely there's a way to look at a string and extract a numeric value from it (or return 'zero' if there is none)?
2024-07-19 09:14 AM
@Gerald Lock wrote:
I have an object parameter that I've define set values for to make them available in a drop-down.
The problem is GDL values only seem to show as a drop-down when the parameter type is set to string.
I want to use the selected value in a numeric expression, but am obviously unable to.
If it is not too late, change your parameter type to length, angle, real number or integer (depends what you need it for).
You can still have a VALUES list of numbers, and then you do not need to convert them.
Otherwise you can use the SPLIT command to extract the number form the string.
In you case I would assume it would be something like ... n = SPLIT (string_variable, "%n", num)
'num' will be your number.
Barry.
2024-07-19 09:32 AM
This isn't working for me
Values (sw) set:
but drop-down not functional
2024-07-19 09:34 AM
oops, just realised I forgot to remove the "" in the values definition.
solved!