Expression syntax. Addition does not work in expression, but multiplication does

nick_papageorge_dayjob
nick_papageorge_dayjob Member, csevp Posts: 1,273 PRO
I must be missing something super easy here, but I could not find the answer searching help or searching the forum. I made a length variable d=28.3mm in the tree. Inside sketcher, when I type 8*#d, it works. If I type 8+#d, I get an error, and the expression won't solve. I tried using parenthesis, putting the plus on the other side of the d, using extra spaces, etc. What am I missing? Thanks.






Best Answers

  • nick_papageorge_dayjob
    nick_papageorge_dayjob Member, csevp Posts: 1,273 PRO
    Answer ✓
    I found the issue. It was the units. If I typed a mm in the expression, it worked. Or, if I changed the #d to be a unit-less number instead of a length, it worked.


  • NeilCooke
    NeilCooke Moderator, Onshape Employees Posts: 6,126 image
    Answer ✓
    It is usually best to keep the units (in case somebody changes the workspace units). So the syntax should be 8mm + #d (where #d is in mm). 
    Senior Director, Technical Services, EMEA

Answers

  • nick_papageorge_dayjob
    nick_papageorge_dayjob Member, csevp Posts: 1,273 PRO
    Answer ✓
    I found the issue. It was the units. If I typed a mm in the expression, it worked. Or, if I changed the #d to be a unit-less number instead of a length, it worked.


  • NeilCooke
    NeilCooke Moderator, Onshape Employees Posts: 6,126 image
    Answer ✓
    It is usually best to keep the units (in case somebody changes the workspace units). So the syntax should be 8mm + #d (where #d is in mm). 
    Senior Director, Technical Services, EMEA