Is there a way to change values of variables depending on an Enum selection?
david_dalton526
Member Posts: 3 ✭
I am relatively new to custom FeatureScripts and I am trying to create a list of variables. I would like the value of those variables to change depending on what choice I have made in the dropdown menu.

I want the choices inside the blue bracket to change the value of those inside of the grey bracket.

I want the choices inside the blue bracket to change the value of those inside of the grey bracket.
Tagged:
0
Best Answer
-
Actually, thinking more about it you could make each variable it's own map and just use the enum value as the key. It has to be made into a string to work, but I think I like this way a lot more. Here's an example.0
Answers
-
There's probably a more elegant way, but you could do it with if statements.
if (definition.myEnum == materialType.SHEET)
{
v.GA30 = 0.0120*inch;
// and so on...
}
else if (definition.myEnum == materialType.STAINLESS)
{
v.GA30 = 0.0100*inch;
// and so on...
}
0 -
Actually, thinking more about it you could make each variable it's own map and just use the enum value as the key. It has to be made into a string to work, but I think I like this way a lot more. Here's an example.0
-
Thank you so much. I previously thought of using a Boolean expression but I knew there had to be a better way. I haven't messed with strings too much but, I can see that it is a very helpful tool to have.Evan_Reese said:Actually, thinking more about it you could make each variable it's own map and just use the enum value as the key. It has to be made into a string to work, but I think I like this way a lot more. Here's an example.0
