GetPolySrfObject

Can I suggest a new RhinoScript command GetPolySrfObject - where the selection returned an index of the face clicked.

Or is there an existing method ?

Thanks,
Keith

This is possible with Python/RhinoCommon:

import Rhino

def TestGetFaceIndex():    
    msg="Pick a surface within a polysurface"
    srf_filter=Rhino.DocObjects.ObjectType.Surface 
    rc,objref=Rhino.Input.RhinoGet.GetOneObject(msg,False,srf_filter)
    if rc!=Rhino.Commands.Result.Success: return
    fi=objref.Face().FaceIndex
    print "Face index is {}".format(fi)
TestGetFaceIndex()

–Mitch

Thanks Mitch, really useful !

I hope to port all my scripts to python - so this will come in very handy.

Cheers, :tropical_drink:
Keith

Mitch,

From your code - can I also get the objectID the face belongs to ?

Keith

Yep…

import Rhino

def TestGetFaceIndex():    
    msg="Pick a surface within a polysurface"
    srf_filter=Rhino.DocObjects.ObjectType.Surface 
    rc,objref=Rhino.Input.RhinoGet.GetOneObject(msg,False,srf_filter)
    if rc!=Rhino.Commands.Result.Success: return
    fi=objref.Face().FaceIndex
    id=objref.ObjectId
    print "Object ID is {}".format(id)
    print "Face index is {}".format(fi)
TestGetFaceIndex()

Thanks Mitch,

Is this the page I should be looking at ? - http://developer.rhino3d.com/api/RhinoCommon/html/T_Rhino_DocObjects_ObjRef.htm

Keith