Swap the U and V direction of a surface?

I’d like to be able to swap the U and V directions of a surface.
The " Swap Surface Directions" component from Pufferfish seemed to be perfect, but it swaps the trimming data which is absolutely not what I want…

Swap UW issue.gh (3.2 KB)

var bf = s.Faces[0];
bf.Transpose(true);
A = bf;

Swap UV.gh (48.4 KB)

1 Like

Awesome !

RhinoCommons only mentions .Tranpose as a method for surfaces, which would remove the trim altogether. Transpose is not available as a method for Brep faces, although the C# component obviously still works. Any idea why?

1 Like

The BrepFace class inherits from the Surface class, which implies that any method designed to operate on surfaces is also applicable to BrepFaces.

Thanks for the quick reply. Forgive my ignorance, but I seem to be losing trim information when using the surface Transpose method on the Brep face - it returns an untrimmed surface. I can retrim, but the trim would somehow have to be transposed as well. Am I missing something here or is the C# function inherently doing something the Python equivalent isn’t capable of?

Same here. Works in C# but in Python the output becomes an untrimmed surface.

Seems to work (with no/brep type hint):


SwapUV_GHPython.gh (45.9 KB)

2 Likes

Thank you Anders, that worked!

Curiously enough, after re-introducing the brep type hint it still works.
I wonder what really changed under the hood, where and when.
(This is Rhino 8 with the new Script -component, for reference).

1 Like

You can try checking the type(S) within the script to see what the surface/brep is processed as.

1 Like

Hi @osuire, @AndersDeleuran,

In V8 there is Transpose Surface component that swaps U and V axis.

A related component new in V8 is Reverse Surface that allows to reverse U, V and W direction.

The component can be used as well visualize the direction of UVW if nothing is connected on these inputs. In the context menu has an option to hide the Arrows.

We updated both components in V8.16 to deal with Trimmed Surfaces.

2 Likes

Thanks Kike !