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.
Help with conditional dimensions syntax
In searching the help files I have found the following
You can also use ternary operators (such as '?') which can yield conditional results. For example, say the length of a sketch entity should be 7 inches if the width is greater than 5 inches. It can be written this way:
#width>5?7:4
How can I incorporate this into an If... Else statement so that in one hit I can specify in addition eg #width>8?9.2:4 #width>10?12.4:4 I'm sure this is possible but for the moment the syntax escapes me.
Thank you
Comments
#width > 10 in ? 12.4 in : (#width > 8 in ? 9.2 in : 4 in)
You can nest additional ternaries anywhere you want in the expression. I like to do something certain in the 'if' and then do more logic in the 'else' so I would phrase this like:
#width>10?12.4:(#width>8?9.2:4)
but some other ways would be:
#width>8?(#width>10?12.4:9.2):4
#width<8?4:(#width<10?9.2:12.4)
All work out to the same logic in the end