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.
Need help patterning holes
marcus_bernstein
Member, User Group Leader Posts: 35 EDU
Hi Onshape Community, (new to this forum)
I was hoping to get some help on a featurescript project of mine. I am part of a FRC team that works constantly with Hole patterned 1X1, 2X1, and that sort of thing for constructing our robots. I am looking to create a featurescript that creates these tubes for us, using inputs of length, width, height, wall thickness, hole diameter, and hole spacing, and have gotten it far enough so that it does the bar with hollowness, but I can't seem to figure out how to do the hole patterns. I have tried oppattern, optransform, and a ton of options like that, but the proper way of doing this seems to elude me. Could anyone provide some guidance on how I would pattern holes based on user input of spacing between holes and hole diameter?
Here's my onshape file for refrence:
Thanks so much,
-Marcus
I was hoping to get some help on a featurescript project of mine. I am part of a FRC team that works constantly with Hole patterned 1X1, 2X1, and that sort of thing for constructing our robots. I am looking to create a featurescript that creates these tubes for us, using inputs of length, width, height, wall thickness, hole diameter, and hole spacing, and have gotten it far enough so that it does the bar with hollowness, but I can't seem to figure out how to do the hole patterns. I have tried oppattern, optransform, and a ton of options like that, but the proper way of doing this seems to elude me. Could anyone provide some guidance on how I would pattern holes based on user input of spacing between holes and hole diameter?
Here's my onshape file for refrence:
Thanks so much,
-Marcus
Any chance Onshape is looking for interns?
Philadelphia User Group Leader
Philadelphia User Group Leader
0
Best Answer
-
mahir Member, Developers Posts: 1,307 ✭✭✭✭✭Extending the FS to have a 2D hole pattern isn't much different than the 1D pattern already there. Right now, I have the X location of the hole set to zero. You would need to change that to be whatever the corner hole location should be. Just like I calculated an edgeSpacing and holeCount for Y, you can do the same for X. For the linearPattern, you will need to specify a secondDirection along with a secondDistance and secondInstanceCount (not sure of the exact parameter names). You could also incorporate a second hole spacing in case the spacing in X and Y are not the same.
I could do this for you, but it's a good learning exercise for you to replicate what I've done in the second direction. If you have any specific questions, feel free to ask. I didn't comment the code (bad Mahir!), so here is the gist of how the FS should work.
1) Sketch and extrude profile per length/width/height. I didn't change much here other than the extrude direction.
2) Calculate the hole edge distance and pattern count along X/Y based on hole size, hole spacing, and length.
3) Sketch and extrude a seed circle. I've placed this sketch in the middle of the tube and used a symmetric extrude going through both top and bottom, but you could change this to be one-sided.
4) Pattern the seed cylinder body along X/Y using the count parameters calculated in step 2.
5) Perform a boolean to remove the patterned bodies as well as the seed body.
6) Delete the profile and circle sketch so the user doesn't see them in the final feature.5
Answers
https://cad.onshape.com/documents/54f892fbfa78fbd35c135167/w/ae41ed43ea4d161de12bd6cc/e/dd4e8d4536e2cc34f7f9468e
Really appreciate anyone who can help me with this!
-Marcus
Philadelphia User Group Leader
https://cad.onshape.com/documents/584885d74a04e910421534f4/w/b7a7a95b50219fd310c945e3/e/78598afe7c4196106c1efbc4
That's a great help! I will definitely be looking into the documentation to understand more of the changes you made. That's awesome for 1 by 1's. But I'm really looking for a solution for any width/height. I'm sure I can figure it out with enough messing around, but if you have a good understanding of this type of thing could you provide any more guidance? So like if the width was 2", there would be one set of holes .5" from each side (total 2 columns). Also, it would be great to have the pattern work on both axes. I'm not really sure how this logic would work, so again any help would be very much appreciated!
-Marcus
Philadelphia User Group Leader
I could do this for you, but it's a good learning exercise for you to replicate what I've done in the second direction. If you have any specific questions, feel free to ask. I didn't comment the code (bad Mahir!), so here is the gist of how the FS should work.
1) Sketch and extrude profile per length/width/height. I didn't change much here other than the extrude direction.
2) Calculate the hole edge distance and pattern count along X/Y based on hole size, hole spacing, and length.
3) Sketch and extrude a seed circle. I've placed this sketch in the middle of the tube and used a symmetric extrude going through both top and bottom, but you could change this to be one-sided.
4) Pattern the seed cylinder body along X/Y using the count parameters calculated in step 2.
5) Perform a boolean to remove the patterned bodies as well as the seed body.
6) Delete the profile and circle sketch so the user doesn't see them in the final feature.