09-28-2009 10:07 AM
09-28-2009 10:21 AM
hope this helps:
09-28-2009 10:23 AM - edited 09-28-2009 10:26 AM
Hi Dan,
you have two problems:
1) An enum is always an U16, whereas your ring is defined as I32. That's why you get multiples of 65536 as output.
2) Your ring item values don't match the values of the enum. You're trying to cast a number, NOT a numbered item!
Example: your DegC enum is represented by the value "0", which will be typecasted from U16 to I32. But your ring doesn't has an item for value "0", so you get an undefined "<0>" output.
Solution:
Make an array constant of correct output values for each item of the enum. Then use IndexArray with index=enumitem to get the corresponding output.
Next solution:
To be more error safe you can get the string for the enum item, look for that string in the strings of the ring, then using it's index to get the correspnding (ring) value... Needs some property nodes, but will work too
09-28-2009 10:24 AM - edited 09-28-2009 10:29 AM
Typecasting changes the way that binary data are interpreted. Since both an Enum and a Ring are U16 data, typecasting doesn't care very much.
Item strings will not be affected by a type casting.
Sorry I overlooked the case of I32 rings, although this lead to the same conclusion.
09-28-2009 10:56 AM
09-28-2009 11:00 AM
ASTDan wrote:
I was hoping for a more elagant way to do this than creating an array of all the posible choices.
Why would that be difficult? Pass the enum into a For loop (which will autoindex) then you can build the array no problem
09-28-2009 11:06 AM
09-28-2009 12:03 PM
Wire enum to "format inot string" to get teh string for that enum value.
Take the enum string (from above) and wire it a serach 1-d array with the array input coming for the a "strings" property coming from your ring.
Itf the value returned by the serach is gtr or eq to zero that is your ring value. If is not then there wa an error matching them up.
Ben