Rhino.Input.Custom.GetObject - Surfaces vs Faces Indexing (Python)

Using Rhino.Input.Custom.GetObject. Filtering by surface and polysurface. When the user selects a single surface within a polysurface, the GeometryComponentIndex.Index is returned as a number > -1. Does this index correspond to BOTH objO.Faces AND objO.Surfaces every single time, meaning face 0 always corresponds to surface 0 and face 99 always corresponds to surface 99. Could face 0 ever correspond to a difference surface number other than 0?

What I am wanting to do is manipulate the face colors based on calculations done on the corresponding surface normal. So if the faces and surface indexes don’t always correspond to the same object with the same index, then I need to know how to be able to gain access to a surface based on the face the user selected (component index).

    i = Rhino.Input.Custom.GetObject()
    i.SetCommandPrompt('Select at least one surface.')
    i.GeometryFilter  = ot.Surface | ot.PolysrfFilter
    i.GroupSelect = True
    i.GetMultiple(1, 0)
    if i.ObjectCount == 0:
        print 'No surfaces selected.'

    for o in i.Objects():
        objO = rs.coercebrep(o.ObjectId)
        print 'Component Index: ' + str(o.GeometryComponentIndex.Index)

Hi Mike - I do not know if they are indexed the same but somehow I’d be very surprised if not. If in doubt you can get to the surface from the face



Oh excellent. I’ll just get the surface just in case the indexes can be different. Thanks so much as usual! Have a great weekend!