Welcome to the Onshape forum! Ask questions and join in the discussions about everything Onshape.
First time visiting? Here are some places to start:- Looking for a certain topic? Check out the categories filter or use Search (upper right).
- Need support? Ask a question to our Community Support category.
- Please submit support tickets for bugs but you can request improvements in the Product Feedback category.
- Be respectful, on topic and if you see a problem, Flag it.
If you would like to contact our Community Manager personally, feel free to send a private message or an email.
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
-
EvanReese Member, Mentor Posts: 2,117 ✭✭✭✭✭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.Evan Reese0
Answers
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...
}