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 IN UI
papawo
Posts: 206 PRO
I have 2 boolean selection in UI.
How to inactivate other boolean if user selected other one?
How to inactivate other boolean if user selected other one?
Tagged:
0
Best Answer
-
As I said, you can't control visibility of parameters earlier in the dialog with later parameters.
We're unlikely to change that since it can lead to confusing UI where it's hard for a user to understand why a parameter disappeared (Also, when reading through the dialog, it's also hard for a Boolean-2-focused user to know that Boolean 1 is unimportant until they've already played with Boolean 2 — they look like separate choices).
The alternative to two checkboxes is one enum, where the choice can either be given as a dropdown menu:
https://cad.onshape.com/documents/583dee13852b6910510b947a/v/8b4daa1ccd9f3a6a4fdf2d38/e/39a6ce27a0b36965ea2fb565
or as a horizontal row:
https://cad.onshape.com/documents/583dee13852b6910510b947a/v/1356269d930368dc4f33bcce/e/39a6ce27a0b36965ea2fb565

Do either of those work for you?
6
Answers
-
You can make a parameter appear conditionally based on other parameters by defining them inside an if statement, like so:
annotation { "Name" : "Boolean 1" } definition.boolean1 is boolean; if (!definition.boolean1) { annotation { "Name" : "Boolean 2" } definition.boolean2 is boolean; }
0 -
how to make boolean1 disappear if boolean2 is chosen?0
-
Unfortunately there's no way to do that right now. Inputs can only control visibility of other inputs below them, not above them.
0 -
If you have three valid states (false+false, false+true, true+false) you can use an enumeration instead of a pair of booleans.0
-
I forgot what it's called exactly, but there is a new Horizontal_UI_Hint option that lets you list an enumeration as a row of mutually exclusive horizontal buttons. This seems well suited to your purpose.0
-
@john_f_carr - can you do an example?0
-
If your boolean options are, for instance, "With square hole" or "With round hole", you can instead have a dropdown menu (an enum) with choices for hole type "None", "Square", or "Round".
Here's a simple example feature doing this:
https://cad.onshape.com/documents/d23d3f02d297f1a626d988ff/w/f7169c9d20aac5513724f724/e/1a5ba32207c8142eba85d86e
0 -
@kevin_o_toole_1 - that is great but what I am aiming to do is similar below. I wanted the user to pick only one option and when he does other option will disappear or disabled . Main 2 booleans will only appear if nothing is selected or 1 boolean were unselect.

https://cad.onshape.com/documents/583de44c545b20104cad6da9/w/3c81f383481ff03c72213fc0/e/1743674a7d5a5a04c35b645d
0 -
As I said, you can't control visibility of parameters earlier in the dialog with later parameters.
We're unlikely to change that since it can lead to confusing UI where it's hard for a user to understand why a parameter disappeared (Also, when reading through the dialog, it's also hard for a Boolean-2-focused user to know that Boolean 1 is unimportant until they've already played with Boolean 2 — they look like separate choices).
The alternative to two checkboxes is one enum, where the choice can either be given as a dropdown menu:
https://cad.onshape.com/documents/583dee13852b6910510b947a/v/8b4daa1ccd9f3a6a4fdf2d38/e/39a6ce27a0b36965ea2fb565
or as a horizontal row:
https://cad.onshape.com/documents/583dee13852b6910510b947a/v/1356269d930368dc4f33bcce/e/39a6ce27a0b36965ea2fb565

Do either of those work for you?
6 -
the 2 boolean are separate choices with separate features for specific part.
if user pick boolean 1 it must be for part1 and it will cut a "square", and if boolean 2 , it must be for part 2 and it will cut a "triangle"
interchanging will be wrong .
i want user to pick 1 of the 2 boolean only . and then use the same featurescript again for the other part.
but if this is impossible. the nearest thing i can do is the horizontal row sample you did, unless you have more idea under your sleeve.
0 -
The nature of FeatureScripts is that you can go back and make changes just like a regular feature. What you're looking to do is contrary to that workflow. If a user wanted option 1 but clicked option 2 by accident, he'd have to exit the feature and start again. This doesn't sound very user friendly. I'd stick to an enum, either dropdown or horizontal.0



