OpenNest fails to Nest booled Breps

I am trying to nest Breps with holes in it, representing acrylic glass with holes for screws.

As soon a brep gets a hole with a boolean operation, I cannot nest it anymore. I am trying to use the “hull” node and the surface output for this.

The error I get is this:

> 1. System.NullReferenceException: Object reference not set to an instance of an object
>   at OpenNestLib.OpenNestUtil.BrepLoops (Rhino.Geometry.Brep B) [0x0006b] in <ac92d27bdf304e63a3cf73805d27cb1e>:0 
>   at OpenNest.OpenNestFullComponentCleanUp.GooToOutlines (System.Collections.Generic.List`1[T] geo_) [0x0011e] in <9c5ebc4b8d96445da2b7ecaa9c939d48>:0 
>   at OpenNest.OpenNestFullComponentCleanUp.SolveInstance (Grasshopper.Kernel.IGH_DataAccess DA) [0x001d4] in <9c5ebc4b8d96445da2b7ecaa9c939d48>:0

I am struggling to find a good way to nest the complete 3D Object. I know how to use Guids for 2D Objects or Text with OpenNest, but somehow cannot get this to work.

I attached to files, the “Simple File” is showing the basic Problem. Two random Breps with a booled hole failing to nest.
The “complex file” is the actual thing I want to nest.

Best,
Max

complex file.gh (72.1 KB)
simple file.gh (13.5 KB)

OpenNest doesn’t work with the holes in your surfaces because they are "Circular Curves".

If you extract the edges from your surfaces, join them, and take the longest edge this gives you the outside edge. You can use this as the Geo input to the OpenNest component and then use the Transform output to arrange your surfaces.

simple file_re-01.gh (16.5 KB)

An alternative would be to use polylines instead of circles to make the holes in your breps. Then you could just input the surfaces to the OpenNest component.

-Kevin

Hi Kevin, thanks for your answer, I didnt know that OpenNest does not work with Circular Curves. But makes sense. The algorithm seems to work with the points describing a line. A Circular Curve doesnt have one like a polycurve has.

The trick to just sort it by length is neat…

I use the solution with transforming the circular curves as you mentioned. Lasercutters tend to slow down, if you have a high res polyline.

Thanks for clearing my mind and providing an example :slight_smile:

One problem which still had to be solved with OpenNest:

If you get your surfaces out of the Hull-Node, you end up with duplicates (front and backside of your geometry). The Hull-Node looks for the biggest surface of a Brep and puts that out. If you have front- and backside, you and up with double the amount you want to nest.

To solve this, I just used the pack node.

With the pack-node, I get a sorted list with original, identical… and so on. (the backside actually). Like that I just need to delete every second element in the list.
No need for a more complicated setup which searches for identical items to delete (which was my first approach):

For anyone who is interested in nesting for lasercutting:
I was able to nest the items with 0 distance and delete all duplicates created by those parts overlapping. Maybe you want to have a look at the nodes after the open-nest node.