How can I place the longest side of a rectangle on the x-axis?

Hi! I am new to Grasshoper, and recently tried nesting with Open Nest. The thing is that in order for the nesting to work I need the parts to follow the direction of the woodgrain (all the rectangles in the same sirection, the longest side of each one matching the longest side of the sheet). Does anyone know how to rotate all the rectangles in order for them to match their longest side?

In the photo, for example, the three big pieces of the bottom left are in a wrong direction.

Thanks for any help!

it depends… are your rectangles already oriented in the right way before being nested? or are they oriented randomly?

please attach your GH file with internalized geometries

Hi,

Assuming everything is in XY plane, AlignPlane should cover it after isolating the longest edge (Sort List for the win !)

OrientRectangle.gh (9.7 KB)

Perfect!! That will work for me. Thank you for your time!

I have a question though, is it possible to do that while mantaining the curves inside each rectangle? It is the only step I’m missing

Here is my GH file for nesting starting with 3D objects. I’m still new to GH so I also attach the 3dm in case something is missing

OPEN NEST.3dm (3.0 MB)
NESTING rhino copy.gh (21.8 KB)

Unfortunately I do not have Open Nest installed.

If your question is to rotate the rectangles on themselves (do they don’t end up elsewhere in the XY plane), yes, add an Area component between the original curves and the reference plane.

If your question is to keep lists of rectangles inside containers, have a look at this topic Create a tree branch for curves within other curves

2 Likes

Thank you! My problem is actually that the circles inside my rectancles don’t rotate when I use the commands, and the rectangles do, but they don’t do it as a group (I tried grouping them but without results). I also tried using the link for creating a tree branch but because I have circles and not polygons it doesn’t work.

OrientRectangle.gh (9.7 KB)

I found a short solution using Region Union, hope it works on your curves.

OrientRectangleGroups.gh (11.4 KB)

Sorting all shapes by tree branch as indicated in the other thread can also be achieved with circles, as long as you replace Polygon Center by Area.