Delete points after using them?

I do want to adapt a script that I do found on this forum to my needs and I can’t find a way to delete the used points. If I do preselect all the geometries from the 3DM files attaches bellow, the script it is creating 3mm diameter circles to eve point that it is preselected. Unfortunately I can’t find a way to delete only the used points after they was used to generate the circles.

I am trying to use the rs.DeleteObjects(ptIDs) but unfortunately this method also delete some of the generated circles and also do throw an error.

How I can delete only the used points without deleting anything else?

I am using Rhino7SR37 on Windows.

# https://discourse.mcneel.com/t/scriptcircle-creation-script/166863
import rhinoscriptsyntax as rs
import scriptcontext as sc

rs.AddLayer("Drill_3")
rs.CurrentLayer("Drill_3")

def CirclesToPoints():
    tol=rs.UnitAbsoluteTolerance()
#    if "CIRCTP_Dia" in sc.sticky: user_dia = sc.sticky["CIRCTP_Dia"]
#    else: user_dia = 3.0
    user_dia = 3.0
    msg="Select points to apply circles - orientation plane will be active view"
    ptIDs=rs.GetObjects(msg,1,preselect=True)
    if not ptIDs: return
    plane=rs.ViewCPlane() # use the current CPlane
#    dia=rs.GetReal("Circle DIAMETER",user_dia,tol)
    dia=user_dia
    if not dia: return
    
    rs.EnableRedraw(False)
    pts=rs.coerce3dpointlist(ptIDs)
    copies=[]
    for pt in pts:
        plane.Origin=pt
        copies.append(rs.AddCircle(plane,dia/2))
#    rs.SelectObjects(copies)
        rs.UnselectAllObjects() # Deselect all objects
        rs.SelectObjects(ptIDs) # Select the used Points
#        sc.doc.Objects.Delete(ptIDs,True) Delete used points
        rs.DeleteObjects(ptIDs) # NOT WORKING PROPERLY
#    sc.sticky["CIRCTP_Dia"] = dia
CirclesToPoints()
rs.CurrentLayer("Default")


Delete points.3dm (165.3 KB)

This looks like it was originally one of my scripts…

What are you wanting to do - just delete the selected point objects after the circles are made?

1 Like

Yes, without deleting anything else.

Try this one…
CirclesToPointsSpecial.py (1015 Bytes)

1 Like