Need help with RhinoScript method or algorithm

So I’m writing a script to automate placing “pilot holes” in a simple square grid onto surfaces.

The rule is that the holes along “vertical” edges are offset X units off and the holes running along “horizontal” edges are offset Y units.

My initial pick would be a point on a surface, so the closest to it would be a “horizontal” edge and the next closest “vertical”.
That’s done to have a reference to what’s vertical and what’s horizontal.

Now, how to determine the rest of the horizontals and vertical edges in case if the surface is L or U or even + shaped using reference edges? By checking angles between reference and other edges? Or is there a better, more elegant way? Like checking for CO-LINEARITY of curves?

Also, the surfaces might or might not be parallel to the world top or planar. And the edges aren’t always 90 degrees to each other.

I might just get all the edges and compare their tangent vector with the X or Y axis vector… That will give you a collection of horizontal and vertical… Then maybe create the circles on both sides of each edge, and then check each circle for “insideness” of the main outline with PlanarClosedCurveContainment(), discard the ones that are outside… You could also exclude overly short edges from the selection perhaps…


I knew, I had to learn those vector shenanigans… Maybe this will force me to do it finally. :smile: Thanks, Mitch!

Vectors with lines are easy… with (vb) Rhinoscript, just use Rhino.VectorCreate(end_pt,start_pt); with Python it’s even easier, subtracting points gives you a direction vector, so it’s just end_pt - start_pt

And yes, vectors are very important in scripting, they will open up a whole new direction for you… :stuck_out_tongue:


Hi @Asterisk,

This is worth the read:

– Dale