need help defining a formula value within a variable

john_lopez363
john_lopez363 Member Posts: 143 ✭✭✭
I have this variable defined.  As you can see I am using two other variable definitions to define the value of a third variable.  As written it works just fine.  Im taking the #slat_width multiplying by a factor of .87 and then dividing by the #slat_slot_count to define the #slat_slot_distance.

What I NEED to do instead is subtract a value (70) from #slat_width variable then divide it by the #slat_slot_count variable. 

However when I replace the multiple (*) with the subtract (-) operator it fails.  What am I doing wrong/how do I fix this?





Best Answer

  • MichaelPascoe
    MichaelPascoe Member Posts: 2,965 PRO
    edited January 2024 Answer ✓

    For multiplication and division, you can multiply a (value with units) by a (unitless value): 45in * 4
    However, for addition and subtraction, both values need to have similar units: 45in - 5m 

    So you could not do:
    45in - 5
    45in - 5in^2


    RENDERCAD - Photorealistic product rendering.
    CADSharp - Professional CAD + software consulting.

    ▚▞▚▞▚▞▚▞▚

Answers

  • MichaelPascoe
    MichaelPascoe Member Posts: 2,965 PRO
    edited January 2024 Answer ✓

    For multiplication and division, you can multiply a (value with units) by a (unitless value): 45in * 4
    However, for addition and subtraction, both values need to have similar units: 45in - 5m 

    So you could not do:
    45in - 5
    45in - 5in^2


    RENDERCAD - Photorealistic product rendering.
    CADSharp - Professional CAD + software consulting.

    ▚▞▚▞▚▞▚▞▚
  • NeilCooke
    NeilCooke Moderator, Onshape Employees Posts: 6,126 image
    You are subtracting a number from a length (70mm? 70in? 70km?) - you need to define the units of the number.
    Senior Director, Technical Services, EMEA
  • john_lopez363
    john_lopez363 Member Posts: 143 ✭✭✭
    Doh...such a simple thing!  Thanks @NeilCooke