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.
Expressions - Returning a number when using a length
leecasey
Member Posts: 34 PRO
Hi I'm having a bit of trouble generating an integer for a pattern number from an expression which is using an length (mm).
floor((#length/2)/60)
I'm assuming the issue is incompatible types but not sure how to solve it. Is there any way to cast #length as an int?
floor((#length/2)/60)
I'm assuming the issue is incompatible types but not sure how to solve it. Is there any way to cast #length as an int?
0
Comments
I didn't test this, but something like this should work:
floor((#length/2)/60)/(1 mm)
If you ever change the units of the document it's going to break, and I can't quickly think of a way to make this so that it will just get rid of the units in a universal way.
https://forum.onshape.com/discussion/18076/new-feature-linear-pattern-plus/p1
floor(#length/2/60/(1mm))