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.

PATTERN INSTANCE VARIABLE

john_faracijohn_faraci Member Posts: 11 ✭✭
I have many rails of different lengths that all have holes equally spaced along the length. What I am trying to do is model one of the rails and then use a variable to control the number of holes in the pattern. For instance, all rails have a hole .625" from each end then they have holes spaced 1.25" between those holes. I want the variable to take the distance between the holes at each end then add the correct number of spaced holes determined by the length between the end holes? Does this make sense?

Thank you for your help.

Comments

  • NeilCookeNeilCooke Moderator, Onshape Employees Posts: 5,686
    Sounds like your rail length is governed by the holes rather than the other way around? If that is the case then it makes it easier than trying to calculate the length of the rail first before adding the holes.

    https://cad.onshape.com/documents/d748a4ebc28ac8c465b2eba6/w/4a867cab21e46273c6c1a05b/e/0b90dcb3487744b7bd94971b
    Senior Director, Technical Services, EMEAI
  • john_faracijohn_faraci Member Posts: 11 ✭✭
    Thank you Neil.

    I see how you did that. In our case the rail length is the known factor, therefore I was hoping to have it function by being able to change the rail length and then the number of holes would adjust.
  • mahirmahir Member, Developers Posts: 1,307 ✭✭✭✭✭
    edited July 2018
    @john_faraci, try this example. It takes as input the rail length and hole spacing. It then automatically calculates the number of holes. All this is done via variables and equations which drive feature dimensions. In this example the edge spacing is variable in order to keep the holes centered on the rail, but this could easily be modified to make the edge spacing static.

    https://cad.onshape.com/documents/57acdfaae4b005c413ed9b6f/w/3fd585a46d3af1b3ba413c53/e/691a7028f1006301aa47baa0

  • NeilCookeNeilCooke Moderator, Onshape Employees Posts: 5,686
    @john_faraci - I think it depends on what is important. Presumably the hole spacing is fixed, so therefore one of the end spacings must be variable? Or is it like @mahir said where the holes are centred?

    Senior Director, Technical Services, EMEAI
  • mahirmahir Member, Developers Posts: 1,307 ✭✭✭✭✭
    Realistically, it works more like @NeilCooke suggests. I made my rail as an example of how to use equations to back out an integer number of holes from a variable length. But (non-custom) off the shelf rails don't usually come in fluid lengths. You have specific lengths available in whole number increments of the hole spacing. So even if you're ordering rails by their length and not the number of holes, it's the number of holes that drives the lengths.
  • NeilCookeNeilCooke Moderator, Onshape Employees Posts: 5,686
    If the lengths are predefined, use configurations.
    Senior Director, Technical Services, EMEAI
  • john_faracijohn_faraci Member Posts: 11 ✭✭
    Gentlemen, thank you very much for the assistance. As you may have gathered, I am new at variables and was trying them out with something familiar. I appreciate all of your comments and suggestions. After thinking about it a little bit I realized that having the lengths and doing a little math I can come up with the number of holes easily enough. 

    Configurations will be my next challenge.
Sign In or Register to comment.