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

**URL:** <https://discourse.mcneel.com/t/delete-the-points-on-a-curve-with-only-x-y-z-coordinate/105165>\
**Category:** Grasshopper Developer\
**Tags:** python, rhino6\
**Created:** [July 4, 2020, 9:16am UTC](https://discourse.mcneel.com/t/delete-the-points-on-a-curve-with-only-x-y-z-coordinate/105165 "2020-07-04T09:16:18Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![zmaomao981](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/zmaomao981/32/219667_2.png) [@zmaomao981](https://discourse.mcneel.com/u/zmaomao981)\
**Post date:** [July 4, 2020, 9:16am UTC](https://discourse.mcneel.com/t/delete-the-points-on-a-curve-with-only-x-y-z-coordinate/105165/1 "2020-07-04T09:16:18Z")

</div>

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.

 ![1](https://global.discourse-cdn.com/mcneel/uploads/default/original/3X/f/4/f475492326b6fe6d6bd13c15b6680f0f8c9bfba6.png)  
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 points.gh](https://discourse.mcneel.com/uploads/short-url/n2X67lj5cZMikpANjycdFHVLDNq.gh) (2.7 KB)  
[delete points.3dm](https://discourse.mcneel.com/uploads/short-url/1q31I6qEB8r8UqIoadCh41VBtfq.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)  
> print(point)  
> #rs.DeleteObjects(point)

could someone give some advice?

---

<div class="post-metadata">

**Author:** ![Mahdiyar](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/mahdiyar/32/472862_2.png) [@Mahdiyar](https://discourse.mcneel.com/u/Mahdiyar)\
**Post date:** [July 4, 2020, 9:49am UTC](https://discourse.mcneel.com/t/delete-the-points-on-a-curve-with-only-x-y-z-coordinate/105165/2 "2020-07-04T09:49:19Z")

</div>

rhinoscriptsyntax:

```python
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)

```

[DeletePointsOnCurveRhinoscriptsyntax.py](https://discourse.mcneel.com/uploads/short-url/tvE6BP9nbAnltAjKigHz4QqTAcL.py) (327 Bytes)

RhinoCommon:

```python
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)

```

[DeletePointsOnCurveRhinoCommon.py](https://discourse.mcneel.com/uploads/short-url/3PFKfYXgo5MlJhg42m1Gw6KeTSI.py) (513 Bytes)

---

<div class="post-metadata">

**Author:** ![zmaomao981](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/zmaomao981/32/219667_2.png) [@zmaomao981](https://discourse.mcneel.com/u/zmaomao981)\
**Post date:** [July 4, 2020, 12:58pm UTC](https://discourse.mcneel.com/t/delete-the-points-on-a-curve-with-only-x-y-z-coordinate/105165/3 "2020-07-04T12:58:00Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Mahdiyar](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/mahdiyar/32/472862_2.png) [@Mahdiyar](https://discourse.mcneel.com/u/Mahdiyar)\
**Post date:** [July 4, 2020, 1:08pm UTC](https://discourse.mcneel.com/t/delete-the-points-on-a-curve-with-only-x-y-z-coordinate/105165/4 "2020-07-04T13:08:45Z")

</div>

Sorry, I’d forgotten `rs.UnitAbsoluteTolerance` parenthesis.

---

<div class="post-metadata">

**Author:** ![zmaomao981](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/zmaomao981/32/219667_2.png) [@zmaomao981](https://discourse.mcneel.com/u/zmaomao981)\
**Post date:** [July 4, 2020, 1:19pm UTC](https://discourse.mcneel.com/t/delete-the-points-on-a-curve-with-only-x-y-z-coordinate/105165/5 "2020-07-04T13:19:41Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![zmaomao981](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/zmaomao981/32/219667_2.png) [@zmaomao981](https://discourse.mcneel.com/u/zmaomao981)\
**Post date:** [July 4, 2020, 1:38pm UTC](https://discourse.mcneel.com/t/delete-the-points-on-a-curve-with-only-x-y-z-coordinate/105165/6 "2020-07-04T13:38:46Z")

</div>

Thanks you so much! I have found a solution!
