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.


Divide by units or use parentheses...

CAD_SSPCAD_SSP Member Posts: 45 ✭✭
edited December 2017 in Using Onshape
To convert a measurement to a number in a formula you divide by the units, i.e. 22mm/mm = 22

If you want to do something like 220mm/22mm you get an error so you have to do 220mm/22/mm = 10

Also possible (and much more readable in my opinion) is 220mm/(22mm) = 10.

I would like to know if there is any reason to use the former over the latter, either performance or gotcha's.


  • Options
    ilya_baranilya_baran Onshape Employees, Developers, HDM Posts: 1,188
    I agree that parentheses is more readable and is totally good to use.  But read below if you want to get technical.

    There are no performance gotchas here -- it's the same (negligible compared to other calculations Onshape is doing, unless you're in a tight loop in FeatureScript, in which case that's a separate discussion).  The only thing is that the floating point roundoff may be different between the two expressions; that roundoff error is thousands of times smaller than the size of an atom, but if you do a non-tolerant check, like (220mm/22/mm == 220mm/(22mm)), it may evaluate to false (and in this case it does).
    Ilya Baran \ VP, Architecture and FeatureScript \ Onshape Inc
Sign In or Register to comment.