Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allowed areas in sheets instead of holes? #5

Open
imatrisciano opened this issue Oct 27, 2024 · 1 comment
Open

Allowed areas in sheets instead of holes? #5

imatrisciano opened this issue Oct 27, 2024 · 1 comment

Comments

@imatrisciano
Copy link

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

@DanielLiamAnderson
Copy link
Owner

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants