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.
Variables and math
mark_wallström
Member Posts: 4 ✭
Hi,
First; Onshape is the best thing since sliced bread, period. What you have done is extraordinary, thank you.
I'm a "make variables for everything"-kinda guy. Is there a reason we can't do math with variables? For example, I have variable #pistondiameter and I want to make a dimension be #pistondiameter+2, which can't be done.
Can it be so that I am doing something wrong?
First; Onshape is the best thing since sliced bread, period. What you have done is extraordinary, thank you.
I'm a "make variables for everything"-kinda guy. Is there a reason we can't do math with variables? For example, I have variable #pistondiameter and I want to make a dimension be #pistondiameter+2, which can't be done.
Can it be so that I am doing something wrong?
0
Comments
Please refer below video for more detail,
https://www.swiftcalcs.com/#product
Twitter: @bradleysauln
Thanks for the kind words! Onshape supports all kinds of math in variables, other feature parameters, and dimensions (see https://cad.onshape.com/help/#numeric-fields.htm) and you can even write you own functions using FeatureScript.
Your diagnosis is correct -- Onshape is strict about not mixing units (you can add an inch to an inch or a meter, but not to an angle or a unitless number) so if #pistondiameter is a length, then you should add 2mm to it.
The parenthesis (bracket) is not necessary.
Thanks bunches
This should be added to the Variable page in the help library. I was ripping my hair out trying to add numbers to variables. I'm a beginner, but nowhere else that I've encountered have I had to specify units in dimensions. So it's easy to multiply variables, but it's not at all obvious that specifying units would be required for that one thing. To me anyway.
Thanks bunches