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.
Equation not working. Need help
Ben_
OS Professional, Mentor, Developers Posts: 303 PRO
I have this equation for a dimension using variables:
(245-((#ARC1+#ARC2)))/2
The first minus sign after 245 is the problem. When digging into this to see what is wrong, If I try a minus, plus, division operator it does not work. If I try a multiplication operator it does work.
(245-((#ARC1+#ARC2)))/2 gives error "enter a valid function"
(245+((#ARC1+#ARC2)))/2 gives error "enter a valid function"
(245/((#ARC1+#ARC2)))/2 gives error "enter a valid function"
(245*((#ARC1+#ARC2)))/2 works
What am I doing wrong or is this a bug?
0
Best Answers
-
Ben_ OS Professional, Mentor, Developers Posts: 303 PROabefeldman said:Do either of the variables have units? It might be worth removing the units from the variables and adding them in the dimension instead.
0 -
abefeldman Member Posts: 166 ✭✭✭Yes, the underlying problem is the unit mismatch. Regardless of whether it was a length or angle, the fact that the variables had units and the number they were being added to did not was causing the problem. Removing the units from the variables or adding it to the number are both valid ways of fixing the issue.Abe Feldman
UX/PD/Community Support6
Answers
UX/PD/Community Support
LearnOnshape facebook group
LearnOnshape facebook group
Does (#ARC1+#ARC2) / 2 work?
LearnOnshape facebook group
ARC1 = 45 deg
ARC2 = 45 deg
All of the equations but the last fail because 245 does not have consistent units with either of the variables.
Changing the variables to the "Any" unitless option succeeds:
ARC1 = 45
ARC2 = 45
Or you could enter ((245*deg)-(#ARC1+#ARC2))/2, but be sure there's no "deg" unit appended to the end.
UX/PD/Community Support
LearnOnshape facebook group
LearnOnshape facebook group
UX/PD/Community Support
LearnOnshape facebook group
UX/PD/Community Support
I'm having the same issue. Cannot remove the units from the variables, nor does it access units in the calculation.
For example, in the calculation:
((#depth/#joins))-0.2) mm
→ this works
(#depth/#joins)+#adj
(#depth/#joins)+#adj mm
→ neither of these are accepted and I get the error message: "cannot subtract unitless number and length"
(#depth/#joins) is unitless.
#adj has units.
you could do (#depth/#joins mm)+#adj
What you probably want to do is switch joins to be a number not a length. Then the equation would be #depth/#joins + #adj.