Brep.Flip without swamping UVs and vice versa

In principle, I understand that the Srf Normal is the result of the vector product between the tangents in U- and V-direction. But I am looking to flip the normal without swaping the UVs and swaping the UVs without affecting the Normal dir.

I want to achieve a similar approach like the Dir command were the user can independently modify Normal dir with out swaping UVs, U dir, V dir, and swap UV without affecting the normal .

In c# I am using as an input a Surface - Pass as Brep in order to access the Brep.flip name space, but every time the Brep is flipped the UVs Swap and also when convert the Brep to Surface to implement the transpose() normal is flipped following the principle mentioned above.

I found that BrepFaceList.Flip Method - If true, clears all BrepFace.OrientationIsReversed flags by calling BrepFace.Transpose() on each face with a true OrientationIsReversed setting. If false, all of the faces are flipped regardless of their orientation. Which I assume is the same thing is happening with Brep.Flip.

Can any one help or shine a light on this, how should I approach this? Thanks in advance

Here is the function I made after converting the Brep to a Surface.

  public Surface UnifyUVs(bool u, bool v, bool swap, Surface iSrf)
    Interval uDomain = iSrf.Domain(0);
    Interval vDomain = iSrf.Domain(1);


    if (u)
      Interval uDomainNeg = new Interval (-vDomain[1], -vDomain[0]);
      iSrf.SetDomain(0, uDomainNeg);
      iSrf.Reverse(0, true);

      Interval vDomainNeg = new Interval (-uDomain[0], -uDomain[1]);
      iSrf.SetDomain(1, vDomainNeg);

    if (v)
      Interval vDomainNeg = new Interval (-vDomain[1], -vDomain[0]);
      iSrf.SetDomain(1, vDomainNeg);
      iSrf.Reverse(1, true);

    Surface newSrf = iSrf;
    return newSrf;

I guess you’re looking for BrepFace.OrientationIsReversed:

private void RunScript(Brep srf, ref object A)
  srf.Faces[0].OrientationIsReversed = true;
  A = srf;
} (16.0 KB)

Hi Mahdiyar,

thanks for you replay, I am using the BrepFace.OrientationIsReversed to test BrepFace direction and correct it before converting into a surface.

If you use the Surface.Transpose() you will see what I mean.



BrepFaces have a reverse orientation flag, which allows you to flip the normal without affecting the underlying surface. This is an important optimisation because half the time a brep-face needs to be flipped when it is joined with other faces, so this flipping needs to be as minimal an intervention as possible.

Surfaces do not have this. The normal direction of a surface is determine by the right-hand-rule and the UV directions. When you convert a BrepFace into a Surface, you lose the OrientationIsReversed information.


Hi David,

Even if i use the BrepFace [0].OrientationIsReversed same thing happens. (14.1 KB)

Try to bake the output in Rhino and then run the dir command.

Hi MahDiyar,

hahaha in fact you are wright!, so this means that internally in GH (BrepFaces) UVs will be swap but the underlying surface will keep its UVs?

Therefore this means that in the first step I need to manipulate the Normal direction, then convert it to Surface in order to manipulate independently the underlying surface UVs and bake?

Or the other way around edit the Surfaces UVs then convert ToBrep and OrientationIsReversed?



Your question I have also encountered, Surface.Transpose’s code will make the surface different