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.
Onshape + Operators (Free Tutorial!)

.
Did you know you can use operators directly within a part studio?
Here's a re-post of some useful info I put together a while back. Looks like the tables aren't supported in the forum update. Original post is
(here)
in case your eyes hurt from these tables.
Also, if you would rather watch a video tutorial on operators see: Lesson 2 starting at time 11:54
Ternary conditional operators are extremely helpful for creating variable patterns and models. They are a short hand version of the "if then statement" that you can use directly in the Onshape input boxes within features or variables. Here is a quick guide on how to use them:
In this tutorial gif, you can see how to change the quantity of a pattern based on the diameter variable. If the diameter is less than 2in, use qty of 6. If the diameter is not less than 2in, use qty of 4.
.
Logical Operators
Description | Operator |
equal | == |
greater than | > |
less than | < |
.
Modifiers
not | ! |
and | && |
or | || |
.
Operator Combinations
less than or equal | <= |
greater than or equal | >= |
not equal | != |
not less than | !< |
not greater than | !> |
.
Ternary Conditional Operator Examples
Return one value or different value depending on if the statement is true or false. | |
logical statement ? value returned if statement is true : value returned if statement is false | |
1 == 1 ? 999 : 555 | this returns the value 999 because 1 does equal 1 |
1 == 2 ? 999 : 555 | this returns the value 555 because 1 does not equal 2 |
1 != 1 ? 999 : 555 | this returns the value 555 because 1 does equal 1 |
1 != 2 ? 999 : 555 | this returns the value 999 because 1 does not equal 2 |
1 < 1 ? 999 : 555 | this returns the value 555 because 1 is not less than 1 |
1 < 2 ? 999 : 555 | this returns the value 999 because 1 is less than 2 |
1 <= 1 ? 999 : 555 | this returns the value 999 because 1 is less than or equal to 1 |
1 <= 2 ? 999 : 555 | this returns the value 999 because 1 is less than or equal to 2 |
1 <= 0 ? 999 : 555 | this returns the value 555 because 1 is not less than or equal to 0 |
.
Combined Logical Statement Examples
Use modifiers to combine multiple statements | |
(1 == 1) && (2 == 2) | This statement returns true only if both statements are true |
(1 == 1) || (2 == 2) | This statement returns true if either of the statements is true |
.
Nested Ternary Conditional Operator Examples
Place statements within parenthesis to nest them | |
1 == 1 ? 999 : (1 == 2 ? 444: 333) | Returns 999 |
1 == 5 ? 999 : (1 == 2 ? 444: 333) | Returns 333 |
1 == 5 ? 999 : (1 == 1 ? 444: 333) | Returns 444 |
.
Learn more about the Gospel of Christ ( Here )
CADSharp - We make custom features and integrated Onshape apps! Learn How to FeatureScript Here 🔴