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.
Hole to Slot (new featurescript)

in General
Hi,
I often create slot holes based off the hole feature. I see questions about slot holes regularly so I figured it would be a good practice case for a new feature script.
So here goes. please let me know if you come across bugs, improvement possibilities and edge cases that aren't handled well.
Tagged:
4
Comments
That's a neat idea!
Also means if you have a design with a hole you can convert it to a slot later without sketching.
Very cool.
It looks like "direction" doesn't support implicit mate connectors. Any reason not to have that option?
yes! I've wanted to make this but your implementation looks fantastic.
I agree with Simon about mate connectors being handy for the direction.
It could also be nice to be able to pick multiple holes, at least for the straight option. It seems like just adding a forEachEntity() to the SLOT_TYPE.STRAIGHT would do it. You may wanna pre-process the selection so you don't get duplicate holes if there's more than one face picked in a hole. You could set up two hole face query params that look the same so the curved version can still be limited to 1 selection.
(or you may not want to do this at all haha)
Yes, great! I've been missing that one already. When I was working with Spaceclaim, they had a very similar one, and I used it a lot. You would just drag a hole along a curve and that simply created a slot.
Thank you very much. Good job!
thanks for the feedback and suggestions.
@S1mon, I was using the standard QueryFilterCompound.ALLOWS_DIRECTION, which doesn't include the mate connector, so I added that. It makes it a lot easier to create an angled slot, so it's a significant improvement.
BTW I found that the accompanying 'extractDirection' immediately processed the mateconnector as expected.
@ilya_baran: could the queryFilterCompound.ALLOWS_DIRECTION be updated to include bodytype.mateconnector?
I also found out the underlying operations don't support active sheet metal parts, so I disabled selections there.
so these are improvements included in V6
@EvanReese Multiple holes is indeed a neat idea. the pre-processing and the forEachEntity will be bit more work though.
@ilya_baran , @EvanReese . see post above. the @links stopped working halfway the post.
I like this functionality too! I'll give it a try and provide feedback / comments as I run into things.
Update:
V8 allows multiple hole faces for the straight slots. Just make sure you only select one face for each hole.
The disambiguation of multiple faces into one hole face to be processed is a challenge still ahead of me. Any suggestions how to approach that?
There may be a better way but a check could be
isQueryEmpty(context, qSubtraction(q1, q2))
You may need to first subtract the active query from the main query, then test this.
thanks @EvanReese. I figured it out. perhaps there's a smarter/quicker way, but this works:
in V9 drag selection multiple faces for one hole can be selected so drag selection is enabled
nice!