The complete code of rhinoscriptsyntax is available on GitHub.
For ExtendSurface, you find the code below. It needs as input a
surface_id, so that means that this function only works on surfaces that are in the Rhino document; and not on surfaces that are in the Grasshopper document. This means that you can’t use
rs.ExtendSurface in Grasshopper Python scripting. I would advise you to look at the code below and ‘roll your own’ ExtendSurface for use in Grasshopper Ptyhon scripting.
def ExtendSurface(surface_id, parameter, length, smooth=True):
"""Lengthens an untrimmed surface object
surface_id = identifier of a surface
parameter = tuple of two values definfing the U,V parameter to evaluate.
The surface edge closest to the U,V parameter will be the edge that is
length = amount to extend to surface
smooth[opt] = If True, the surface is extended smoothly curving from the
edge. If False, the surface is extended in a straight line from the edge
True or False indicating success or failure
import rhinoscriptsyntax as rs
pick = rs.GetObjectEx("Select surface to extend", rs.filter.surface)
parameter = rs.SurfaceClosestPoint(pick, pick)
rs.ExtendSurface(pick, parameter, 5.0)
surface = rhutil.coercesurface(surface_id, True)
edge = surface.ClosestSide(parameter, parameter)
newsrf = surface.Extend(edge, length, smooth)
surface_id = rhutil.coerceguid(surface_id)
if surface_id: scriptcontext.doc.Objects.Replace(surface_id, newsrf)
return newsrf is not None