Flipping Surfaces and Aligning Frames

I am contouring a brep and trying to find a plane on each surface to orient them to xy plane in logical order. But I am getting opposite Y directions for some planes of surfaces. Is there a way that can assure all the planes always have y axis in upwards direction?

pane orientation.gh (278.1 KB)

You search this?



pane orientationEW.gh (123.2 KB)

The easiest thing to do, in this case, would be to simply assign YZ planes to the origins of the planes, but the better thing to do would be to first correct the direction of the surfaces, and then align the planes to the -y direction:

Flipping Surfaces and Unifiying Frame Orientation VR 01.gh (97.9 KB)

(It’s, of course, even better, if you align to Unit Z)

Thank you for this solution. I did think of this approach and did exact same script as you did except last part of align plane. Does align plane orient all planes into one direction ?

I wasn’t able to run your script, it inputs surfaces into planes and that makes component turn red.

Align Plane will rotate all planes around their Z axis in an attempt to bring the X axis in the same direction to a given guide direction. This is different from the plane orientation, which is defined by the plane’s Z axis and can be modified by use of Adjust Plane.

ai, your version does not like that surface is directly connected to Plane Origin.

Add a Plane in between. I hope that removes the error.


pane orientationEW2.gh (123.9 KB)

Another cheap cheat for a case like yours is to get one plane (e.g., the first surface) right/aligned and just ‘send it’ to the other ones via PlaneOrigin—if plane alignment is the priority vs flipping surfaces.

mind blown

i use plane origin for other tasks, but never thought to use it like this

Sure
 but none of these solutions actually fix the frame of the surface, just create corrected planes in the stead of the surface frame. To fix the surface frame, you’d have to start with the curves the surfaces are made from. Like so:

Now the UV directions of the surfaces will also be unified.

That makes sense and it corrects problem from the root. Before when we flipped surfaces only, when I oriented these planes to xy plane for laser profiles, all the surfaces did not align them on plane in unified directions.