Selection of a few Unit System names in Value List - How?

I’m trying to figure out how to format text so the Convert Units component accepts the input?

  1. Data conversion failed from Text to Unit System

How is that supposed to work? The goal is to have Model Units, Millimeters and Inches in a value list.

@martinsiegrist not exactly what you’re looking for, but… :man_shrugging: (8.6 KB)

1 Like

to make it more visually appealing, you can put all the relevant components into a cluster (9.7 KB)

1 Like

This error is happening because there isn’t a casting mechanism in the Model Unit System type to handle text conversions. I’ve created a YT for this issue and will try to get this fixed as soon as possible.


Thanks for this idea. A workaround, ok.

Glad @AndyPayne chimed in and I look forward to this being possible with a value list.

Use these values in your ValueList
e.g. mm=2, inches=8
and then externally cast it.

private void RunScript(int x, ref object A)
    A = (UnitSystem) x;

and probably doesn’t require this c# and the parameter UnitSystem reconize the integer, sorry but I dont have R8 to test it.

The casting I used simply tries to compare the string result (case insensitive) to the Enum value for the Unit System. So, what you would pass in as a string would be “millimeters”, or “inches”, or “Document Units” and it will return the correct Model Unit system. This should be available in the next 8.8 release.

1 Like

For now I internalised three unit systems in a list item component.