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
-
Jake_Rosenfeld Moderator, Onshape Employees, Developers Posts: 1,646Hi Marcus,
I think you forgot to attach your Onshape file, but I'll do my best to help.
If your hole patterns are fairly regular, you may be able to get away with calling linearPattern. The documentation is a little sparse, but if you go to https://cad.onshape.com/documents/12312312345abcabcabcdeff/ (the Onshape standard library) you can go to the linearPattern tab and look at the precondition to check what inputs it takes. Most likely your calls will look something like this:<sketch a circle on the bar> <use an extrude-remove to cut the hole into the bar> <sketch a line in the direction you want to pattern> linearPattern(context, id { "patternType" : PatternType.FACE, "faces" : qCreatedBy(<the id you gave the extrude>, EntityType.FACE), "directionOne" : qBodyType(qCreatedBy(<the id of the sketch with the line>, EntityType.EDGE), BodyType.WIRE), "distance" : <total distance of the pattern>, "instanceCount" : <number of holes you want>, "oppositeDirection" : false (but you may need to expose it as a parameter), "hasSecondDir" : false });
You could also make a hole using the "Hole" feature and feature pattern that with a linear pattern, or even just do the whole thing with the "Hole" feature (make sketch points everywhere you want a hole and use those as inputs to hole() ).
If your pattern is more complicated than just holes along a line, you could try using applyPattern (https://cad.onshape.com/FsDoc/library.html#applyPattern-Context-Id-map-Transform) with a custom set of transforms; looking at linearPattern in the standard library is a good example of how that function should be called.
I hope one of these options works out!
JakeJake Rosenfeld - Modeling Team5
Answers
I think you forgot to attach your Onshape file, but I'll do my best to help.
If your hole patterns are fairly regular, you may be able to get away with calling linearPattern. The documentation is a little sparse, but if you go to https://cad.onshape.com/documents/12312312345abcabcabcdeff/ (the Onshape standard library) you can go to the linearPattern tab and look at the precondition to check what inputs it takes. Most likely your calls will look something like this: You could also make a hole using the "Hole" feature and feature pattern that with a linear pattern, or even just do the whole thing with the "Hole" feature (make sketch points everywhere you want a hole and use those as inputs to hole() ).
If your pattern is more complicated than just holes along a line, you could try using applyPattern (https://cad.onshape.com/FsDoc/library.html#applyPattern-Context-Id-map-Transform) with a custom set of transforms; looking at linearPattern in the standard library is a good example of how that function should be called.
I hope one of these options works out!
Jake