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.
Questions about units
ron_moreland
Posts: 99 ✭✭✭
I've more or less finished my first real feature script. Thanks for all the help! I had excellent help from the forum. I have questions about values with units.
I think everything in the database has meters as the length unit. Other units are assigned as conversions from meters. When I print values via "debug()", the values are in meters. Can I convert them at print time to inches?
How do you change numbers to values with units and back?
I think everything in the database has meters as the length unit. Other units are assigned as conversions from meters. When I print values via "debug()", the values are in meters. Can I convert them at print time to inches?
How do you change numbers to values with units and back?
Tagged:
0
Best Answer
-
Just multiply it by the units. e.g. Foo * inch
if it is a complex debug message with lots of outputs then this probably won’t work.Senior Director, Technical Services, EMEA5
Answers
-
println(length/inch~" inches") if you are sure that length variable contains the value with units of length type
0 -
Just multiply it by the units. e.g. Foo * inch
if it is a complex debug message with lots of outputs then this probably won’t work.Senior Director, Technical Services, EMEA5 -
Sometimes "Foo * inch" will convert the value to an area. Why?0
-
Presumably in this case your foo already had units, so units squared = area?ron_moreland said:Sometimes "Foo * inch" will convert the value to an area. Why?
Owen S.
Business Systems and Configuration Controller
HWM-Water Ltd0



