Points and Curve Intersection

Hi,

I want to filter all points which lie on this perimeter curve.
Does someone know a component for that?
And I only find components which intersect lines with line or meshes with lines…

Thanks,
Laurin

You could use Point In Curve component if your goal is to find the points that lie on the curve, and the grid is a byproduct, you can then filter by containment type

Otherwise to filter the points on a curve you could use a simple python script

import rhinoscriptsyntax as rs
import Rhino.Geometry as rg
import scriptcontext as sc

def main():
    # Get the input curve and points from the user
    curve_id = rs.GetObject("Select a curve", rs.filter.curve)
    if not curve_id:
        return
    curve = rs.coercecurve(curve_id)

    point_ids = rs.GetObjects("Select points", rs.filter.point)
    if not point_ids:
        return
    points = [rs.coerce3dpoint(point_id) for point_id in point_ids]

    # Define a tolerance value
    tolerance = 1

    # Find the points lying on the curve
    points_on_curve = []
    for point in points:
        point_on_curve = curve.ClosestPoint(point, tolerance)
        print (str(point_on_curve[0]))
        if point_on_curve[0]:
            points_on_curve.append(point)
    rs.UnselectAllObjects()
    # If any points are on the curve, select them
    if points_on_curve:
        point_ids_on_curve = [rs.PointClosestObject(pt, point_ids)[0] for pt in points_on_curve]
        rs.SelectObjects(point_ids_on_curve)
        print("Selected point(s) on the curve.")
    else:
        print("No points found on the curve.")

main()

You can adapt it to gh

1 Like

That worked well, but now I don’t have a closed curve anymore, but 3 lines instead.

How can I solve that?
image