Removing/ selecting similar data from a large scene

Hi all,
I’m working with oem data a lot, and I’ve recently found a lot of similar objects that need to be removed from a scene which is not easily found nor selectable.
Any suggestion on how this might be selected in a large data scene. The common factor in this data is that it’s mainly made up of:
open polysurface with 4 surfaces.
Edge Tally:
4 boundary edges
8 manifold edges
= 12 total edges

Idially i would like them selected or changed colour or added to a layer so i can review them to delete afterwards.

Many Thanks,

Try this:

#! python 3
import Rhino
import rhinoscriptsyntax as rs
import scriptcontext as sc

def custom_filter(obj):
	if not rs.IsPolysurface(obj): return False
	if rs.IsPolysurfaceClosed(obj): return False
	rh_obj = sc.doc.Objects.Find(obj)
	geo = rh_obj.BrepGeometry
	faces = [f for f in geo.Faces]
	if not len(faces) == 4: return False
	edges = [e for e in geo.Edges]
	naked = [e for e in edges if e.Valence == Rhino.Geometry.EdgeAdjacency.Naked]
	interior = [e for e in edges if e.Valence == Rhino.Geometry.EdgeAdjacency.Interior]
	if not len(edges) == 12: return False
	if not len(naked) == 4: return False
	if not len(interior) == 8: return False
	return True

rs.SelectObjects([obj for obj in rs.AllObjects() if custom_filter(obj)])
2 Likes

Hey,
That works really well and very quick too,
Thank you so much!

1 Like