Hi all, Is it possible to use Grasshopper to delete some objects in Rhino? I have filtered some curves in Grasshopper, and I want to delete the curves in the Rhino model.
Thanks
Delete Crvs outside a boundary.gh (19.4 KB)
I’ll leave the Python to someone else but can suggest a better way to filter the curves that are “outside a Boundary”:
Delete Crvs outside a boundary_2025Jun5a.gh (21.5 KB)
If you want to ignore curves that touch the boundary, that would be different?
P.S. Like this:
Delete Crvs outside a boundary_2025Jun5b.gh (24.7 KB)
Using area center points doesn’t work.
yes, thanks Joseph, what I want to do is to select the crvs outside boundary and not intersect with the boundary, then I what to select them and delete these crvs in Rhino
Right, but in order to delete Rhino curves, you need to have a Rhino file with that geometry.
I thought R8 might be able to do that without Python. But no GH file
![]()
I can’t learn from images alone. (especially of icons
)
I think I have somehow achieve it in Rhino7…but the rs.Deleteobjects() is a bit problematic…it will cause Grasshopper popup quite a few banners. Maybe the Cache/Purge component you use can avoid it?
These components were added in Rhino 8. I’m using Rhino 9 WIP
In the past I used this script:
import rhinoscriptsyntax as rs
import scriptcontext as sc
import Rhino
sc.doc = Rhino.RhinoDoc.ActiveDoc
if id and delete==1: rs.DeleteObject(id)
sc.doc = ghdoc
delete_by_id_python.gh (7.1 KB)
PS: the python script is updated for Rhino 8
Thanks for posting the R8 files. Even with them, I find R8 difficult to understand for several reasons that you have gotten used to by now, I adapted them to my code; had to hide the layers to see my colors.
Delete Crvs outside a boundary_2025Jun5c.3dm (55.6 KB)
Delete Crvs outside a boundary_2025Jun5cc.gh (26.0 KB) (UPDATED to “Purge”)
Hey, it doesn’t work
Crap, I don’t like R8. (LATER: fixed in version ‘cc’)
For R7, you probably want Python to delete the curves.
Of course not, how would I know since your GH file was set to “Push”, not “Purge”. ![]()
It works now, thanks again.
Struggling to adapt the Python you posted but don’t know how it was “updated for Rhino 8” ![]()
With great knowledge comes responsibility for sharing it effectively. ![]()
You know what. I might have misunderstood your comment but just to be sure… I deleted my posts above.
Oh NO
Something got lost in translation. I will repost my version ‘c’ above with credit to you for showing us the R8 way.
I got an extent query on this topic…
For the curves intersect with the boundary rectangle, how can I just keep the parts inside the boundary? I wonder if we can achieve it in grasshopper, or we can only do it within Rhino?
To do it manually in Rhino, I have to split the curves that intersect with boundary rectangle, then pick the curves one by one that are outside the boundary, then delete.
make a planar surface with the rectangle and use ‘Surface|Curve’ physical intersection
Cool, that is a clever way!! Why I didn’t think about that…
Many thanks Kyuubimode~
You might try Trim with Region.
Without posting a GH file (with internalized curves), I won’t do it for you.
Yes trim with region will be faster if you know its always going to be a region without holes (which is what you have shown).
I have been using regions with holes in some current projects I defaulted to the Surface|Curve intersection because of that.










