Welcome to the Onshape forum! Ask questions and join in the discussions about everything Onshape.

First time visiting? Here are some places to start:
  1. Looking for a certain topic? Check out the categories filter or use Search (upper right).
  2. Need support? Ask a question to our Community Support category.
  3. Please submit support tickets for bugs but you can request improvements in the Product Feedback category.
  4. 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.

Options

Why can I not use variables in math expressions?

Kevin_BeitelKevin_Beitel Member Posts: 1
edited May 2019 in Community Support
It seems that existing variables are not valid in math expressions. I get a valid expression when defining #Y as a value of #X/2, but #X^(1/2) or sqrt(#X) are invalid expressions. Is this not allowed or am I doing something wrong?

Best Answer

  • Options
    kevin_o_toole_1kevin_o_toole_1 Onshape Employees, Developers, HDM Posts: 565
    Answer ✓
    Right, an operation like sqrt(1 meter) isn't well-defined: Does it mean 1 meter? 10 centimeters? Or nothing at all? Onshape says the latter :smile:

    If #X has length units, you can use an expression like sqrt(#X / inch) * inch, which is well-defined.

Answers

  • Options
    konstantin_shiriazdanovkonstantin_shiriazdanov Member Posts: 1,221 ✭✭✭✭✭
    it may be because of the units of #x, linear operations keep units the same but power of the value with units doesnt
  • Options
    kevin_o_toole_1kevin_o_toole_1 Onshape Employees, Developers, HDM Posts: 565
    Answer ✓
    Right, an operation like sqrt(1 meter) isn't well-defined: Does it mean 1 meter? 10 centimeters? Or nothing at all? Onshape says the latter :smile:

    If #X has length units, you can use an expression like sqrt(#X / inch) * inch, which is well-defined.

  • Options
    brian_bradybrian_brady Member, Developers Posts: 505 EDU
    I get around this by using unitless variables.
  • Options
    john_mcclaryjohn_mcclary Member, Developers Posts: 3,898 PRO
    I also use unitless until the bitter end
Sign In or Register to comment.