Python add IsSubD

Can you add IsSubD for Rhino python?

Hi @Alen_Russ

You can check if your object is a SubD with isinstance using RhinoCommon:
isinstance(subdobj, Rhino.Geometry.SubD)

Hi @DavidLeon

Thank you for your help. I dont know how to use in python editor. when I test to select the SubD object that show It is not a SubD.

import rhinoscriptsyntax as rs
import Rhino
subdobj = rs.GetObject("Select the SubD object", preselect=True, select=False)
if isinstance(subdobj,Rhino.Geometry.SubD):
    print "It is a SubD."
else:
    print "It is not a SubD."

rs.GetObject() returns a guid, you need to get the geometry that represents that guid in the document:

import rhinoscriptsyntax as rs
import Rhino

subdguid = rs.GetObject("Select the SubD object", preselect=True, select=False)

#get the geometry from guid
subdobj= Rhino.RhinoDoc.ActiveDoc.Objects.Find(subdguid).Geometry

if isinstance(subdobj,Rhino.Geometry.SubD):
    print "It is a SubD."
else:
    print "It is not a SubD."
1 Like

Thank you