Select surface edge

Hi there,

How can I select and coerce a subobject, surface edge? I would like to return the index number.

import Rhino
import scriptcontext
import rhinoscriptsyntax as rs

obj = rs.GetObject ( message=None, filter=0, preselect=False, select=False, custom_filter=None, subobjects=True)

gs = rs.coercerhinoobject(obj) # Rhino.Input.Custom.GetObject() # rs.coercerhinoobject(obj) #
gs.GeometryFilter = Rhino.DocObjects.ObjectType.Curve
gs.Get()
obj_ref = gs.Object(0)
comp_index = obj_ref.GeometryComponentIndex.Index
#edge1 = obj_ref.Brep().Edges[comp_index]
#curve3d1 = edge1 #.Duplicate()
print comp_index
import rhinoscriptsyntax as rs

objref = rs.GetObject(message=None, filter=rs.filter.curve, preselect=False, select=False, custom_filter=None, subobjects=True)
if objref:
    edge = objref.Edge()
    if edge:
        print edge.EdgeIndex