Find hole coordinates

Hi there.
I need your help with next idea.
I want to develop a plugin which is intended to detect coordinates and radius of holes on the board.

E.g.


For this board my plugin should find single hole with coordinates (100, 100) and radius 5

Any ideas how to approach such problem?

If the circles are proper circles they will have a center, normal, and radius.
Form that you can find the circle’s properties and transfer them to you own code…
Check it’s a circle - e.g. collect its vertices and if there’s a duplicate it’s a loop…
then
https://ruby.sketchup.com/Sketchup/ArcCurve.html#center-instance_method
https://ruby.sketchup.com/Sketchup/ArcCurve.html#normal-instance_method
https://ruby.sketchup.com/Sketchup/ArcCurve.html#radius-instance_method
You’ll also need to trap the top and bottom circles [consistently taking one of the other] so you don’t duplicate your efforts…

2 Likes