Welcome to the Onshape forum! Ask questions and join in the discussions about everything Onshape.
First time visiting? Here are some places to start:- Looking for a certain topic? Check out the categories filter or use Search (upper right).
- Need support? Ask a question to our Community Support category.
- Please submit support tickets for bugs but you can request improvements in the Product Feedback category.
- 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.
Rounding values
Luc_ROLLAND
Member Posts: 6 ✭
in General
Hello !
I try rounding calculations,
or
(as with some others variants).
I don't understand where I'm wrong, but I'm newbee with OnShape ...
Please help me.
Luc
I try rounding calculations,
PosMin=2.9cm
PosMax=5.5cm
PosMax=5.5cm
#PosMin+(((#PosMax-#PosMin)/5)*2)
return 3.94cm
but I need mathematical rounding, so I write :roundToPrecision(#PosMin+(((#PosMax-#PosMin)/5)*2),1)or
roundToPrecision((#PosMin+(((#PosMax-#PosMin)/5)*2)),1)or
roundToPrecision((#PosMin+(((#PosMax-#PosMin)/5)*2)),1))cm
(
I hope 3.9cm
but I obtain an error !(as with some others variants).
I don't understand where I'm wrong, but I'm newbee with OnShape ...
Please help me.
Luc
0
Best Answer
-
Matt_Shields Member, Onshape Employees Posts: 415Or if PostMin and PostMax have to have units, this would work.
roundToPrecision(#PosMin/(cm)+(#PosMax-#PosMin)/(5 cm)*2,1)cm
0
Answers
Many thanks.