Quick Links
2NA Example
In the following example, the goal is to create a nest of three different parts, including six of the first part (red), sixteen of the second part (purple), and three of the third part (blue). In the following picture, these parts have already been through the polygon simplification and offset step
Bounding rectangles are created for each part, and a baseline nest is created using the rectangle nesting algorithm. This results in the following nest, which requires more than a sheet and a half of stock material
At this point, the individual rectangles are examined for waste. The rectangles containing the red parts are found to have the most waste, so the part clustering algorithm is used to place the red part within a two part cluster. After trying several possibilities (two red parts, a red part and a blue part, a red part and a purple, all of the above at different relative orientations), a cluster of two red parts is found to reduce the total waste by the most. The new list of parts to nest now contains three red clusters instead of six single red parts
Once again, the rectangle nesting algorithm is used to create a nest, and a new nest requiring less than a sheet and a quarter of material is found
As before, the rectangle containing the red cluster is found to be wasteful, so the clustering algorithm is used to create a new cluster containing the red cluster. In this case, the best savings comes from putting two red clusters together to form a green cluster, leaving one green and one red cluster to nest
These clusters are passed to the rectangle nesting code, which produces a nest requiring only a sheet and an eighth of material
Clustering continues, and the red and green clusters are put together
Rectangle nesting continues to get closer to a single sheet
The nest clustering step puts one of the blue parts at the top of the red cluster, leaving two blue parts by themselves
Now rectangle nesting gets everything on a single sheet
At this point, the red cluster satisfies a part density condition (this user adjustable condition is set to 80% density for this example), so no additional work is performed on this cluster. However, the purple cluster is not yet sufficiently dense, so a new cluster is formed. In this case, two purple parts are put together to form a new purple cluster, resulting in a part list containing eight purple clusters instead of the original sixteen individual parts
Nesting this collection of rectangles results in a nest marginally better than the last
Finally, all of the part clusters are 80% dense, so the final polygon restoration step is taking, and the final nest is produced
