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.
How to define a range dependent variable?
adi_noyboer004
Member Posts: 2 PRO
Hello to you all,
I'm trying to define a variable (z) by a range of values for variable (k)
'k' range 'z' value
6<z=<8 1
8<z=<10 2
10<z 3
I was trying to define a variable by nesting expression { ((#k>6&&#k=<8)?1:(#k>8&&#k=<10)?2:3) }, but to no avail.
Please advise.
Sincerly
0
Answers
<=, not=<I tried it as well, same resaults
It gets a bit confused about the second part of the ternary, this should work if you add these brackets:
(#k>6&&#k<=8)?1:((#k>8&&#k<=10)?2:3)
@EvanReese has a series of 6 videos on expressions and logic in Onshape. I highly recommend watching these since there are a number of useful tricks or things you might not have picked up from other sources.
https://www.youtube.com/watch?v=J7McsBIEeqc
Simon Gatrall | Product Development, Engineering, Design, Onshape | Ex- IDEO, PCH, Unagi, Carbon | LinkedIn