Trying to Apply Surface mapping in Rhinocommon

Hello all,
I am trying to apply surface mapping to a surface that it being rebuilt programmatically. The V component is based on a factor of the surfaces width (we have a huge volume of individual models that need parameterized surface mapping).

    For Each NewGuid In NewGuidList
        Dim New_Obj As Rhino.DocObjects.BrepObject = RhinoDoc.ActiveDoc.Objects.Find(NewGuid)
        Dim Obj_Ref = New DocObjects.ObjRef(NewGuid)
        Dim Temp_Brep As Brep = Obj_Ref.Brep()
        Dim Temp_Crv As Curve() = Nothing
        Dim Temp_Pts As Point3d() = Nothing
        Intersect.Intersection.BrepSurface(Temp_Brep, IntPlane, doc.ModelAbsoluteTolerance, Temp_Crv, Temp_Pts)
        Dim Temp_Length As Double = Temp_Crv(0).GetLength
    Next

At this point I have a rebuilt surface, and the length I need.
In the command menu, what I would put at this point is
_-ApplySurfaceMapping 1 (Temp_Length / 5) 1 _enter

I’m hoping that there might be an analogous function in rhinocommon. Also, because of certain restrictions, I am having to work with Rhino5 on this project.

Thanks for any help!

Hi @josh_blanchard and welcome to Discourse!

I can’t give you exact steps to set the mapping in Rhino 5. But here’s what I would start with:

  1. Get TextureMapping from your new object using RhinoObject.GetTextureMapping
  2. Modify UVW transform with TextureMapping.UvwTransform
  3. Apply your modifications with ObjectTable.ModifyTextureMapping

Hi Jussi,
Thank you so much for the response! I will give that a shot asap. I’m using the script runner function, but that is very slow, hopefully this does it!