Finding Direction / Orientation for Curves & Surfaces

You printed the values of UdirectionVector and VdirectionVector variables from post #5 in this topic, and then once printed you manually created that blue text in Rhino based on those values?
Is this correct?

If this is so, then either the blue numerical values in your post #15 do not correspond to the visual U and V direction vectors, or you’ve been using some inconsistent labeling methodology which was the reason for the confusion:

Exactly so. That’s the only numbers I’ve seen on this. This code, just to make sure nothing strange sneaked in :

srfID = rs.GetObject("Select a surface", rs.filter.surface)
if rs.IsSurface(srfID):
    pointID = rs.GetPointOnSurface(srfID, "Pick a test point")
    if pointID:
        # Approach 1
        uv = rs.SurfaceClosestPoint(srfID, pointID)
        plane = rs.SurfaceFrame(srfID, uv)

        print "Srf U: ", plane.XAxis
        print "Srf V: ", plane.YAxis

        # Approach 2
        print "Pt U: ", str(uv[0])
        print "Pt V: ", str(uv[1])

Thanks for your patience.

// Rolf

This looks like some sort of bug.
For some reason the surface is not affected by the swap of U and V directions which occurred in Rhino.

Converting it to nurbs surface works:

import rhinoscriptsyntax as rs

srfID = rs.GetObject("Select a surface", rs.filter.surface)
if rs.IsSurface(srfID):
    pointID = rs.GetPointOnSurface(srfID, "Pick a test point")
    if pointID:
        uv = rs.SurfaceClosestPoint(srfID, pointID)
        srf = rs.coercesurface(srfID)
        nurbsSrf = srf.ToNurbsSurface()
        plane = rs.SurfaceFrame(nurbsSrf, uv)
        #plane = rs.SurfaceFrame(srfID, uv)  # if "srfID" got its U and V directions swapped in Rhino (_Dir _SwapUV) the swapping will not be registered
        print "srfU: ", plane.XAxis
        print "srfV: ", plane.YAxis

@dale, @piac, @stevebaer
Why is this happening?

1 Like

Just to make sure I didn’t mess something up I’ll post the model as well (I’ve been reorganizing my HD - up to GDrive - while we were talking, so I couldn’t upload the model before now)

UVDirections_Test_000.3dm (240.1 KB)

[edit: had to reload model, the arrows were messed up due to an accidential join))]

// Rolf

Yess! Now all numbers makes sense. Now they all look exactly as I first expected!

Loong sigh.

I started to wonder if the “strange numbers” were due to something strange going on inside my own head. Pfew, happy to learn that it wasn’t. :relieved:

Many thanks for clearing up the mess!

// Rolf