Packaide icon indicating copy to clipboard operation
Packaide copied to clipboard

Allowed areas in sheets instead of holes?

Open imatrisciano opened this issue 1 year ago • 1 comments

Is there an easy way to consider the shapes in the sheets as allowed areas instead of holes? Basically allowing packing only inside the polygons described in the sheets

imatrisciano avatar Oct 27 '24 14:10 imatrisciano

I believe that its algorithmically easy, because it sounds like you could just treat all of the shapes as individual sheets (which do not themselves contain holes). However, it would require a lot of changes to the code since it is not currently designed to do that (it only currently supports rectangular sheets).

You might be able do it with fewer modifications to the current code by just making one big hole that covers the non-shape area. Essentially just make a single hole that is the size of the sheet with your shapes cut out of it. I think that mathematically still works and could be done with small changes to the code. Some things that I think you would need to do:

  • In bindings.cpp you would need to convert the holes into Polygon_with_holes_2 instead of into Polygon_2 (this allows the holes to have holes!)
  • Then, in packaide.py, you would want to change extract_polygons and extract_shapely_polygons to essentially invert the input so that you turn the list of holes into one big hole with those shapes as holes instead.

Something like this should work in theory. Will it actually work in practice? Not sure, but please give it a try if you have time. I don't have time to do it myself, but let me know if you try it.

DanielLiamAnderson avatar Oct 27 '24 16:10 DanielLiamAnderson