Thanks as always David. I can return any/all the Faces in a SubD with the SubD.Faces property with no issue.
I’m wondering how I get a SubD Vertex/Edge/Face (in)directly from a Get method. Maybe I need a different type of ObjRef?
At the moment for ComponentIndexType of a returned ComponentIndex, I’m getting InvalidType rather than, what I think I should expect:
#SubdVertex 71 Targets a SubD vertex pointer Id
#SubdEdge 72 Targets a SubD edge pointer Id
#SubdFace 73 Targets a SubD face pointer Id
import Rhino
import rhinoscriptsyntax as rs
import scriptcontext
subd_id = rs.GetObject("Select a SubD Object", subobjects= False )
subd_obj = rs.coercerhinoobject( subd_id )
subd_geom = subd_obj.Geometry
subobject_id = rs.GetObject("Subobject select (ctrl+shift) something", subobjects=True) #subobj return is diff
subobject_obj = rs.coercerhinoobject( subobject_id ) # Rhino.DocObjects.ObjRef
subobject_geom = subobject_obj.Geometry
print subd_geom.Faces, "\n", subd_geom.Faces.Count, "picked SubD Faces"
print subobject_geom.Faces, "\n", subobject_geom.Faces.Count, "picked Subobject Faces"
print subd_geom.ComponentIndex(), subd_geom.ComponentIndex().ComponentIndexType, "SubD ci Type"
print subobject_geom.ComponentIndex(), subobject_geom.ComponentIndex().ComponentIndexType, "Subobj ci Type"
It’s with the aim of Trying to get SubDFace.LimitSurfaceCenterPoint() on a picked Face. I’m just testing on a primitive sphere.
Solved, I think:
I got to it eventually by using the result of rs.GetObject (subobjects=True). I didn’t realise that rhinoscriptsyntax actually returns something of type Rhino.DocObjects.ObjRef - and not only the GUID. So there was more detail within that simple ‘Get’ I could drill down into. Although I’m not sure how I’d do it with RhinoCommon if I did need to be more explicit.
If True, subobjects can be selected. When this is the
case, an ObjRef is returned instead of a Guid to allow for tracking
subobject_id = rs.GetObject( "Pick again", False, subobjects=True )
print subobject_id.GeometryComponentIndex.ComponentIndexType
print subobject_id.GeometryComponentIndex.Index