Delete the points on a curve with only x/y/z coordinate

Hey everyone,
I have a small question, but I can’t get the solution.
I want to only delete the points on the blue curve with python code.

I have already got these points with x/y/z coordinate.
with rs.DeleteObjects() to delete the objects need the GUID of the point.
But how can I get the GUID of an existing Point?
Here is my code and the GH,Rhino document.
delete (2.7 KB)
delete points.3dm (31.1 KB)

import rhinoscriptsyntax as rs
import Rhino
from scriptcontext import doc
filter = Rhino.DocObjects.ObjectType.Curve
rc, objref = Rhino.Input.RhinoGet.GetOneObject(“Select curve to delete points”, False, filter)
c = objref.Curve()
allObjects = rs.AllObjects()
for i in allObjects:
p = rs.IsPoint(i)
if p == True:
param = rs.CurveClosestPoint(c, i)
point = rs.EvaluateCurve(c, param)

could someone give some advice?


import rhinoscriptsyntax as rs

crv = rs.GetCurveObject("Select curve to delete points")[0]
for obj in rs.AllObjects():
    if rs.IsPoint(obj):
        t = rs.CurveClosestPoint(crv, obj)
        cp = rs.EvaluateCurve(crv, t)
        if rs.Distance(obj, cp) < rs.UnitAbsoluteTolerance():
            rs.DeleteObject(obj) (327 Bytes)


import Rhino
from scriptcontext import doc

filter = Rhino.DocObjects.ObjectType.Curve
objref = Rhino.Input.RhinoGet.GetOneObject("Select curve to delete points", False, filter)[1]
crv = objref.Curve()
for obj in doc.Objects:
    if obj.ObjectType == Rhino.DocObjects.ObjectType.Point:
        pt = obj.PointGeometry.Location
        t = crv.ClosestPoint(pt)[1]
        cp = crv.PointAt(t)
        d = cp.DistanceTo(pt)
        if (d < doc.ModelAbsoluteTolerance):
            doc.Objects.Delete(obj) (513 Bytes)

Thanks for both two answers, Mahdiyar!

but the first with rhinoscriptsyntax didn’t work, it will clear all the points including the points in the black lines.

Sorry, I’d forgotten rs.UnitAbsoluteTolerance parenthesis.

I have already try to put a 0.001 as the absolute tolerance number in der rs.UnitAbsoluteTolerance(), but it didn’t work. Could you give me a little explanation?

Thanks you so much! I have found a solution!