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.

Variable formula

robert_scott_jr_robert_scott_jr_ Member Posts: 482 ✭✭✭

Hello All. Can't figure out how to make this work: (#array_length-(#squre_sides*#number_instances))/#number_instances-1.

#array_length = dimension assigned to total length of a linear pattern of squares.

#square_sides = length of a side of a square.

#number_instances = number of squares in the pattern

What I'm after in the equation result is the spacing between squares. The formula works in Excel. (Add up all the squares side lengths, subtract that from total distance the squares span, and divide that by the number of spaces between the squares)

Trying:

(#array_length-(#squre_sides*#number_instances))/#number_instances-1 = 'Cannot subtract length and unitless number'

(#array_length-(#squre_sides*#number_instances)in)/#number_instances-1 = 'Cannot subtract length and area'

(#array_length-(#squre_sides*#number_instances))in/#number_instances-1 = 'Cannot subtract area and unitless number'

Any suggestions appreciated. - Scotty

Comments

  • _anton_anton Member, Onshape Employees Posts: 410

    Order of operations:

    (#array_length-(#squre_sides*#number_instances))/#number_instances-1

    is different from

    (#array_length-(#squre_sides*#number_instances))/(#number_instances-1)

  • robert_scott_jr_robert_scott_jr_ Member Posts: 482 ✭✭✭

    Thank You. The formula now works. However, I don't think I'll be able to use the function as I wanted to. What I intended was to create an array, stipulating the length of the array and then be able to tweek the array instances within that length. If I increase the instances they populate outside of that length, not within it. I guess that's just the way it works

    Something else I don't understand is why dimensions in the sketch are red. If I delete one of the dimensions that are used in the formula, the sketch goes black as if one of those dimensions is in conflict with another. But the adding those dimensions does add up to the length of the array's dimension. Any ideas?

    • Scotty

Sign In or Register to comment.