Translate / Transform not working on surface, but rs.MoveObject works

Using Python / rs.

rs.MoveObject works just fine, yet translate and transform does not. They always return false. What am I doing wrong?

Draw a surface and run this code:

import rhinoscriptsyntax as rs
import Rhino
import scriptcontext as sc
import Rhino.Geometry as rg
import System.Guid as Guid
import System as sys

def TestSrf():
    dist = 100

    srf = rs.GetSurfaceObject('Select the surface.')
    oSrf = rs.coercesurface(srf[0])

    # Create the vector.
    vec = rg.Vector3d(0, 0, dist)
    # Move the surface

    # This works
    #print str(rs.MoveObject(srf[0], vec))

    # None of these work.  Returns false.
    xForm = rs.XformTranslation(vec)
    print 'Result: ' + str(oSrf.Transform(xForm))
    #print str(rg.Surface.Transform(oSrf, xForm))
    #print str(rg.BrepFace.Transform(oSrf, xForm))
    #print 'Result: ' + str(oSrf.Translate(0, 0, 100))



if __name__ == '__main__':

Hi Mike - rs.coercesurface() confusingly, in my opinion, returns a brep face, not a Rhino.Geometry.Surface() or a top level brep. You can use rs.coercebrep() or oSrf.ToBrep() to get an object that can be transformed on its own.
(these queries should go on the scripting forum - Scripting - McNeel Forum)


@pascal - Ok thanks Pascal. I’ll put rs and IronPython scripting questions over in the scripting forum from now on.