Calculating with variables only works with * and /

Calculating with variables only works with * and /. When I try to use + or -, the field turns red. What am I doing wrong?

Example: #high+3

Screenshot 2026-08-05 113645_edited.png

Answers

  • S1mon
    S1mon Member Posts: 4,636 PRO

    All dimensions are “values with units”. Try #high + 3 mm

    Simon Gatrall | Product Development, Engineering, Design, Onshape | Ex- IDEO, PCH, Unagi, Carbon | LinkedIn

  • EvanReese
    EvanReese Member, Mentor Posts: 3,099 PRO

    Simon is right. Here's a video I made a while back that will hopefully help build an intuition for it

    Evan Reese
    The Onsherpa | Reach peak Onshape productivity
    www.theonsherpa.com
  • _anton
    _anton Member, Onshape Employees Posts: 555 image
    edited August 10

    Kevin also wrote a good explanation for units way back when:

    If it helps: internally, everything is in base units (meter, radian, etc.), so, if you write 2 in, that evaluates to 2 * 2.54 * centimeter = 2 * 2.54 * 0.01 * meter = 2 * 2.54 * { "value" : 1, "unit" : { "meter" : 1 } }. Math operations check at runtime whether they're valid and error out when an unsupported operation occurs, like adding a unitless 5 to a length. Multiplication, of course, is valid, except when you end up with stuff like an area in a length field.