If I have:
s = rs.GetObjects("Select Panel",rs.filter.surface+rs.filter.polysurface)
#how can I check if "s" is a surface or a polysurface?
if s is Rhino.Geometry. - > # there's no Polysurface type here!
If I have:
s = rs.GetObjects("Select Panel",rs.filter.surface+rs.filter.polysurface)
#how can I check if "s" is a surface or a polysurface?
if s is Rhino.Geometry. - > # there's no Polysurface type here!
Hi Ivelyn,
Not near my computer right now so can’t be too specific, but I believe s is a list of objects, so you need to iterate over its members to test for type.
Regards
Jeremy
Nope.
I think you’re looking for Brep.IsSurface property.
import rhinoscriptsyntax as rs
s = rs.GetObject("Select Panel",rs.filter.surface+rs.filter.polysurface)
s = rs.coercegeometry(s).ToBrep()
if s.IsSurface:
print "it is a surface"
else:
print "it is not a surface"
P.S. you need to add .ToBrep() to make it work on extrusions.
Yes, kind of. I just saw there is rs.IsPolysurface
Yep actually
s = rs.GetObjects("Select Panel",rs.filter.surface+rs.filter.polysurface) if not s: return for i in range(0, len(s)): o = rs.coercebrep(s[i]) if o.IsSurface: print 'Obj ', s[i], ' / ', o, 'is surf' else: print 'Obj ', s[i], ' / ', o, 'is polysurf'
rs.IsPolysurface(s as guid)
this saves the conversion
Yes, abstracts the coercebrep for cleaner code. Well found.