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.
Is there a way to choose a centermost hole from my pattern?
elijahpekaar
Member Posts: 26 PRO
I have a hole pattern running from the bottom to the top of a panel. The pattern is spaced depending on the panel configuration and wind loads. I need to select the centermost circle of the pattern to create a fixed hole (a hole smaller than the rest)
Is there a way to choose a centermost hole, if the hole is not on center of the panel? Currently, I have a config option where I choose the centermost hole for each panel in the list
Best Answers
-
Caden_Armstrong
Member Posts: 434 PRO
If you can calculate a sample point in the middle you could use qClosestTo to find the closest to the middle. The only corner case is that if two holes are equidistance to the center, then it will resolve to both of them.
www.smartbenchsoftware.com --- Renaissance --- fs.place
Experts in Onshape Automation - Custom Features and Integrated Applications0


Answers
If you can calculate a sample point in the middle you could use qClosestTo to find the closest to the middle. The only corner case is that if two holes are equidistance to the center, then it will resolve to both of them.
Experts in Onshape Automation - Custom Features and Integrated Applications
Caden, I appreciate your insight but it is too far above my head haha. In what way would I realistically be able to use what you have suggested? Currently my holes are patterned using linear pattern+ and then I am choosing a center hole manually with a mate connector
Is the centered option within the linear pattern helpful? You could first determine the pattern center, and then linear pattern outward from there.
Sadly I need to pattern from the bottom to top in this case
I used Claude to code a custom feature that allows one to choose the hole closest to the center. Thank you @Caden_Armstrong
You can do this with the help of Query variable+ FS:
https://cad.onshape.com/documents/252f7192fe65c2955e7ca2ef/w/88165a61f01c277276120bf4/e/6eff0043687405eba8666a50?renderMode=0&tangentEdgeStyle=1&uiState=69dd757aee2e04e26724af6a
I knew someone would find a use for closestTo
Derek Van Allen | Engineering Consultant | Meddler