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.
How to programmatically find faces which define the entry and exits for a hole?
I am working on a featurescript to add internal bosses to threaded holes (this is an evolution of a 3D-printed "tapless" threading posted on youtube).
Script: https://cad.onshape.com/documents/1e451ed1452487dd6118fbbe/w/76456d124ce9039290f2b923/e/d5a5f79d9a758c2c8ecf5ab6
Basic concept: https://cad.onshape.com/documents/1e451ed1452487dd6118fbbe/w/76456d124ce9039290f2b923/e/563cebf95d941c41ce150e75
I'm trying to figure out how to use FS to merge with the cylinder walls. This would be really easy to work out on a case-by-case basis where I could control the start and stop points, but I admit to being at a bit of a loss for how to programmatically do UP TO FACE extrusions. Specifically, how do I identify the top and bottom faces which border the in-question cylinder face, in order to use them as the start and end faces?
Comments
There are two queries that might help you:
qHoleFaces(seed); → this will filter a query of faces to those that belong to a hole
qAdjacent() → this will take a seed query and find the faces that are adjacent to all of the given entities.
If you take your hole faces and find the adjacent faces, those are the "boundary" faces.
Custom FeatureScript and Onshape Integrated Applications
@Caden_Armstrong oh, those look awesome, thanks for pointing them out. I'll give a look and see if I can figure out how to make them work.
@Caden_Armstrong That was definitely it, thanks!
In case anyone wants more info about how I did this, here's the code snippet: