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.
boolean annotation default base on an enum

Hi,
i'm working on a featurescript with a selection driven array parameter that contains an Enum parameter and a Boolean parameter.
annotation { "Name" : "Flip wall", "UIHint" : UIHint.OPPOSITE_DIRECTION, "Default" : true } wallShape.flipWall is boolean;
I'd like to set make the "Default" dependent on the chosen Enum. How can i do this?
the precondition doesn't allow to set/change variables. it also did not allow me to declare the same annotation twice (in an if/else)
Can it be done through editing logic? how can i get it to execute for each array parameter when the enum is changed?
Best Answer
-
NeilCooke Moderator, Onshape Employees Posts: 5,802
Editing logic fires every time the user makes a change so that would work, however if the user has manually flipped it, you would have to have another (hidden) parameter to store that interaction otherwise it could become quite annoying if the flip status changed each time.
-OR-
You could have two parameters with different names, then check the value of the enum in the main body of the code to decide which flip to use.
Senior Director, Technical Services, EMEA0
Answers
Editing logic fires every time the user makes a change so that would work, however if the user has manually flipped it, you would have to have another (hidden) parameter to store that interaction otherwise it could become quite annoying if the flip status changed each time.
-OR-
You could have two parameters with different names, then check the value of the enum in the main body of the code to decide which flip to use.
the latter will be easiest I guess, should have thought of that myself.