Get points nearest to boundary curve

Hi all,

is there a option to get the nearest points to the boundary curve by radius toleranz ?

Hi,

Does this quick writeup help:

t = rs.CurveClosestPoint(curve_id,test_point)
curve_point = rs.EvaluateCurve(curve_id,t)
distance = rs.Distance(test_point,curve_point)

you first get the closest point to the curve and than get the distance and do something based on that distance

-Willem

thanks for the help,

try at the moment

Rhino.Geometry.Curve.ClosestPoint()

and will check after that your option.

Hi,

If you are are working with Rhino Common already you should not user rhinoscriptcontext(rs)
rs.CurveClosestPoint() uses Rhino.Geometry.Curve.ClosestPoint().

As for Rhino.Geometry.Curve.ClosestPoint() can be passed a maximumDistance, functioning as your desired distance to boundary filter:

ClosestPoint(self: Curve, testPoint: Point3d, maximumDistance: float) -> (bool, float)

-Willem

Thanks for reply,

tried this

import Rhino as rh
a = [rh.Geometry.Curve.ClosestPoint(x,i,20.0) for i in y]

and got this list , need to check if the bool pattern is the right points.Unbenannt

maybe there is a way to work with collection.pointlist instead of iterating throught list

Hi

How about:

import Rhino as rh
close_pts = []
for pt in y:
    bln,t = rh.Geometry.Curve.ClosestPoint(x,pt,20.0)
    if bln:
        close_pts.append(pt)

a = close_pts

-Willem

Big thanks again,

your code looks really clean and easy to follow.
I tried

Unbenannt

It workes but clean is something else.
Good to know that rhinoscriptsyntax use RhinoCommon, didn’t know that.
Also thanks for this example i always forget that multiple variables are possible.

bln,t
1 Like