Select Objects by type

I’ve got a list of Rhino.DocObjects

how can I extract only curves and points of this list?

I tried in Python with

if rs.IsPoint(obj) or rs.IsCurve(obj) or rs.IsPolyline(obj):
    objetretour.append(obj)

it return "Message: unable to convert 8106539c-7807-4598-9970-5a7ac165b7e9 into Curve geometry

" when obj is a Brep…

thank’s

Hi Onlyforpeace
Try this

import rhinoscriptsyntax as rs
import Rhino.RhinoDoc as rr
import Rhino.DocObjects as rd

docObjs = rr.ActiveDoc.Objects
selectObjs = []
for obj in docObjs:
    
    if((obj.ObjectType == rd.ObjectType.Point) or (obj.ObjectType == rd.ObjectType.Extrusion)):
        selectObjs.append(obj)
if(selectObjs!=None):
    rs.SelectObjects(selectObjs)
rr.ActiveDoc.Views.Redraw()
1 Like

Thank you!

but i don’t understand why my code doesnn’t run:

if rs.IsPoint(obj) or rs.IsCurve(obj) or rs.IsPolyline(obj):
    objetretour.append(obj)

HI
The parameter type required by rs.IsPoint() is Guid.When obj is Brep, the IsPoint function will report an error.