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.
Configurations & if Statements
Nath_McC
Member Posts: 136 PRO
Hi,
I am coming from Solidworks and i would have normally put a simple if statement in the dimensions to get the desired result but that is not the case in onshape.
I have a model of a pin and a hole. Currently the pin has a variable of #PinD and basically I want to incorporate the following if statement for the hole
If ( #PinD * 1.2 > #PinD + 3 , #PinD * 1.2, #PinD + 3 )
Basically the hole to be which ever size is grated, #PinD * 1.2 or #PinD + 3
What is the best way to add this into the model?
I am coming from Solidworks and i would have normally put a simple if statement in the dimensions to get the desired result but that is not the case in onshape.
I have a model of a pin and a hole. Currently the pin has a variable of #PinD and basically I want to incorporate the following if statement for the hole
If ( #PinD * 1.2 > #PinD + 3 , #PinD * 1.2, #PinD + 3 )
Basically the hole to be which ever size is grated, #PinD * 1.2 or #PinD + 3
What is the best way to add this into the model?
0
Best Answers
-
Our numeric inputs are actually quite flexible. This is possible using a ternary operator, as seen in the example below:

This applies to any numeric input in our product (both part studios and assemblies).
Tim Rice | User Experience | Support
Onshape, Inc.6 -
Brilliant, it was the brackets and units that I missing out.1
-
Is it possible for the value to read: ((#check>2*in) ? 3 : #check) in ?TimRice said:Our numeric inputs are actually quite flexible. This is possible using a ternary operator, as seen in the example below:
This applies to any numeric input in our product (both part studios and assemblies).0
Answers
-
Our numeric inputs are actually quite flexible. This is possible using a ternary operator, as seen in the example below:

This applies to any numeric input in our product (both part studios and assemblies).
Tim Rice | User Experience | Support
Onshape, Inc.6 -
Brilliant, it was the brackets and units that I missing out.1
-
Is it possible for the value to read: ((#check>2*in) ? 3 : #check) in ?TimRice said:Our numeric inputs are actually quite flexible. This is possible using a ternary operator, as seen in the example below:
This applies to any numeric input in our product (both part studios and assemblies).0 -
@NeilCooke thanks! That cleared it up for me. I was trying to follow the example in the attached picture but I wasn’t being successful.

1 -
It would be great if these statements were outlined in a course in the learning center.2
-
It would also be handy if you could control suppression with logic. The easiest example is I have a beam and if it is longer than X it needs an extra support.3
-
I know this is old news by now, but there is Dynamic Supression.
0




