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

Irregular bins #10

Open
samsonsite1 opened this issue Dec 6, 2019 · 5 comments
Open

Irregular bins #10

samsonsite1 opened this issue Dec 6, 2019 · 5 comments

Comments

@samsonsite1
Copy link

Do you have any plans to support fitting shapes to irregular bins?

You briefly mentioned it here:
#7

But, you didn't say if you plan to improve it or expand upon it.
I would also be interested in seeing something like this.
Thanks.

@tamasmeszaros
Copy link
Owner

tamasmeszaros commented Dec 7, 2019

What I can do and surely will in the next few weeks, is make the most out of the current "brain" to handle irregular bins. What you can expect is that you can use a simple polygon as a bin and items will be inside of it -- the boundaries will be respected. But the result can be stupid, I probably won't fix that for a while. You can improve that however with a custom optimization kernel which you can pass as a function object to the nest() function.

@samsonsite1
Copy link
Author

samsonsite1 commented Dec 7, 2019

Thanks for the reply.

It would be very interesting if we could pack shapes to a circle or n-sided poly bin. I didn't have anything complex in mind like a bin with exclusion zones, so simple polygon bins are fine by me.

@tamasmeszaros
Copy link
Owner

I think that this should be possible even with the current code. Go on and try to define a Circle as the bin shape and pass it to the nest function. The App PrusaSlicer for which this library was initially developed, supports circular print beds and it works. Not as polished as for the box shaped bed though.

@samsonsite1
Copy link
Author

Thanks, I tried switching the bin to a Circle, but the compiler can't find a matching overload function for it:

//size_t bins = nest(input, Box( s,s, {0,0} ) );
size_t bins = nest(input, Circle( {0,0}, s ) );

cannot convert from 'libnest2d::_Circlelibnest2d::PointImpl' to 'const libnest2d::Box'
no instance of overloaded function "nest" matches the argument list

@ItsMeTheBee
Copy link

ItsMeTheBee commented Apr 7, 2022

Hey all!
What's the status on irregular nesting?
If using a polygon as bin shape is supported, I'd appreciate it very much if you could post a code snippet.

EDIT: I managed to "activate" circular placement by modifying libnest2d.hpp.
I added a using directive for an NfpPlacer that accepts Circle instead of Box and a defined new nest() function template using the new Placer.
Probably not the best way to do it, but it works :D

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

3 participants