Aligning 3D objects to the axis

Hi, I managed (by observing other scripts on the forum) to create a function that flattens 3D objects, but they are not parallel to the x or y axis (it does not matter which axis). Can someone help me set them parallel to the axis?

FLAT 3.2 (767.6 KB)


Thank you for your answer. I’m sorry I wasn’t specific enough in my description. When I wrote flattened objects, I didn’t mean that they should be surfaces, but still 3D objects placed on the xy surface at the same level. So the script I sent rotates 3D objects and places them on the xy surface, and that’s how I would like it to be. The problem is that 3D objects are placed at different angles to the x and y axes and I would like them to be parallel to the x axis.

Sounds like you want OpenNest for these shelves?

This is R7 OpenNest: (787.1 KB)

Wow. It’s amazing. Yes, ultimately I wanted to connect it to OpenNest. As always, there are a few buts :frowning:

  1. I use Mac with R8 because R7 runs very slowly on M1 processors, and the same applies to Grasshopper. Would you be able to make such a script for R8 and OpenNest 2.0? If it is not possible to do it in ON 2.0, then I will use a Windows computer.
  2. I haven’t written this before, but not all holes in solids go through. Some of them are only recessed, e.g. 10 mm. Also, not all holes have to be round, they can be of different shapes and different depths.

Thank you again for your reply

I tried this on R8, had to download/install OpenNest when prompted, and it worked.

That gets into the weeds of OpenNest, which I don’t want to do today. You will have to understand the code. OpenNest works only with curves, not thick parts.

OK, I added the yellow group to avoid extruding faces. Not sure it’s optimal. (786.6 KB)

P.S. On closer inspection I can see that parts are below the “sheet” surfaces. I was hasty and thought some might be above and some below because of how I picked the reference plane…

P.P.S. This purple group flips parts over so they are on top of the “sheets”, but again, I don’t know why they are all the same since reference planes from EvalSrf are arbitrary? (789.0 KB)

I tried as you did in R8 with ON 1.5 and 1.51 but an error message appeared.

“1. Solution exception:Could not load file or assembly ‘OpenNestLib, Version=, Culture=neutral, PublicKeyToken=null’. Could not find or load a specific file. (0x80131621)”

When I tried to connect to ON 2.0, it didn’t work either.

However, I tried your script in R7 and ON 1.51 and it works great. It’s exactly what I was looking for. Thank you for adding additional features. Maybe when the new version ON 2.1 comes out, it will be easier to connect 3D objects because in version 1.51 there were no problem.

Now I can’t open any of the GH files I posted in R8. I see this (which appears to show OpenNest2 already installed):

When I click “Download and Install”, it shows this:

Wait, I just tried R8 again and it opened and worked fine:

But I can’t repeat it reliably - sometimes yes, sometimes no :interrobang: grrr… R8 is such a mess! So I tried using OpenNest2 components but haven’t paid attention to changes so it fails with two errors:

  1. Invalid cast: Curve » nest_geo
  2. Solution exception:Object reference not set to an instance of an object.

I HATE being helpless :bangbang: :bangbang: :-1: :angry:

@Petras_Vestartas :question:

I don’t know if these threads are useful, I haven’t read them yet: (What a PITA!)

I still haven’t read these pages in detail but messed around with OpenNest2 and got something. Looks like trash to me. :-1: :-1: :-1:

This is R7 version ‘c’ (posted previously):

And this is the same code in R8 adapted to OpenNest2: (783.7 KB)

:nauseated_face: Is this any way to do an upgrade? NO :bangbang:

I am working on this. Soon will be fixed. I will highly likely completely remove transformation matrix or keep both. But for sure wording like “Trash” should be avoided…

1 Like


Where never is heard a discouraging word
And the sky is not clouded all day.

What do you call it? Some people get offended by the old programming term GIGO, but that doesn’t apply here because the same input works fine in R7 OpenNest.

Could you just simply ping me to the post once you see it? I can answer myself, specially in the case like this when i need to transfer code from R7 to R8…

I just realized something that might be very important? Part of the problem I am seeing has nothing to do with OpenNest :bangbang: It’s strictly a difference between R7 and R8. To prove and demonstrate that, I removed OpenNest from R7 and R8 versions I posted this morning.

This is the R7 version - note the result of Orient: (yellow group) (779.8 KB)

This is the R8 version - note the result of Orient: (yellow group) (769.9 KB)

I don’t know if it explains everything but clearly, this is yet another anomaly (flaw?) with R8. :frowning:

@Petras_Vestartas ?

P.S. Actually, both these versions of GH are identical, now that OpenNest was removed…

Changed the code so that transforms works in the same order.

Since everyone is using those transforms anyway, I will add an option to geometry for “attributes”, so that this GH wiring wont be needed.

Seems evaluate component is giving different results between R7 and R8.
Can be that some updates where made on BRep on Rhino8.

To be honest, if this shelf would be a serious production, the developer would need to create his own frame per panel. Else it is a bit of a guess. For example a rhino object would have a user string that has a defined frame or any other class like representation of a panel element.

First of all, I wanted to thank you guys for the work you put in. I’ve been testing the script for the past week and it seems to be working well for my needs. I have two more questions.

  1. Is it possible to modify the script so that you can still nest on grouped (I know you can’t nest grouped objects now) objects and non-grouped objects at the same time?
  2. How to connect Transform Guid from the Opennest plugin so that objects after nesting retain all their properties? I tried to do this, but new objects are created and not nested objects retain their properties.

OpenNest2_2024_Jul10cR8 (1.6 MB)