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.

How to strip the units from a length?

jackson_kingjackson_king OS Professional Posts: 80 PRO
Hi All,
Is there a way to strip a length of it's units so the decimal number can be used in a "ceil(#/#)" equation?

I am trying to use configs to create an expanded metal/grating generation part studio and have it working well except for getting the desired sheet size to auto size.  I am using measure distance FS to get the lengths and widths for the distance of the pattern and am trying to use that measure distance number in the ceil function to drive the instance count. In this case, ceil(#Desired_Length/#Length) or ceil(#Desired_Width/#Width).

Here's the document:
https://cad.onshape.com/documents/07f282dcddf2935fa6750b71/w/2c0dd72f79a3f141eac8e0ae/e/de6fa0c8db0a64009288fb77

Thanks in advance!
Jackson

Best Answers

Answers

  • jackson_kingjackson_king OS Professional Posts: 80 PRO
    Thanks @Jake_Rosenfeld!  I was testing things before submitting the question and never had it as a #variable/#variable, just a number/#variable.  What you said makes perfect sense and it works!
  • jackson_kingjackson_king OS Professional Posts: 80 PRO
    @Jake_Rosenfeld, is there a way to remove the units if I needed too? 
    Jackson
  • konstantin_shiriazdanovkonstantin_shiriazdanov Member Posts: 901 ✭✭✭✭✭
    value with units has internal structure of map type, so #length.value should give a unitless number
  • jackson_kingjackson_king OS Professional Posts: 80 PRO
    Thanks guys! It all works well now. I think my next attempt should be turning this thing into featurescript. Which should be interesting as featurescript and I don’t see eye to eye on things sometimes. 
    Jackson
Sign In or Register to comment.