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

Improve auto-arrange algorithm with SVGNest #3237

Open
triffid opened this issue Feb 11, 2016 · 17 comments

Comments

Projects
None yet
10 participants
@triffid
Copy link
Contributor

commented Feb 11, 2016

https://github.com/Jack000/SVGnest looks perfect for improving slic3r auto-arrange!

@alranel

This comment has been minimized.

Copy link
Member

commented Mar 13, 2016

Definitely! It would be nice to have a C or C++ port... I can't merge JavaScript :-(
Jack000/SVGnest#6

@lordofhyphens

This comment has been minimized.

Copy link
Member

commented Sep 7, 2017

Some considerations:

SVGnest doesn't have a termination clause; it keeps going until the user stops it. For our needs we would (probably) want to run some N iterations of the algorithm with each "Auto Arrange" click, removing the existing state if objects are added/removed/scaled/rotated by the user.

We'd also need to calculate the bounding boxes with holes to allow it to properly nest objects inside other objects.

Additionally, this will add a bunch of GUI configuration options to the plater.

@triffid

This comment has been minimized.

Copy link
Contributor Author

commented Sep 7, 2017

@lordofhyphens

This comment has been minimized.

Copy link
Member

commented Sep 8, 2017

@triffid we have to port/reimplement it anyway for Slic3r (as @alexrj noted, we're not merging javascript into Slic3r), so my comment was more of an note when implementing, not as an objection.

@lordofhyphens

This comment has been minimized.

Copy link
Member

commented Sep 11, 2017

One proposal I'd have is to set the minimum distance between parts to be 5mm more than the distance threshold to retract before move; this would be to avoid more artifacts on external walls. The extra 5mm is to ensure that even you set it to 0 prints wouldn't be right on top of each other.

@lordofhyphens

This comment has been minimized.

Copy link
Member

commented Sep 11, 2017

We'll also need to resolve the bounding box to closer in the shape if we want to be able to properly nest things in other things. Initially though I think it would be fine to leave them as opaque.

Other notes:

  • Extra UI would be likely desired to lock rotation on individual items on the bed in Z (that is, the profile only changes on the XY plane). I don't think we should rotate the piece along the X or Y axes at all; most parts have the layer alignment as a strength requirement.
  • We'd need to be able to decouple copies from the main (individual rotate); I think that copies currently share rotates.
@kallaballa

This comment has been minimized.

Copy link

commented Jan 18, 2018

I'm working on porting svgnest to C++: https://github.com/kallaballa/nestcpp/blob/master/src/util/geometry_util.cpp

At the moment i'm translating one function after the other. Anyone wants to join the effort?

@FatemaKhalid

This comment has been minimized.

Copy link

commented Mar 21, 2018

Hey, I wonder if this issue is still available for GSoC 2018
If so, it'd be great to have a hint where to start xD @alexrj

@bubnikv

This comment has been minimized.

Copy link
Contributor

commented Mar 21, 2018

@FatemaKhalid

This comment has been minimized.

Copy link

commented Mar 21, 2018

Thank you for fast response 😄

@Samir55

This comment has been minimized.

Copy link
Member

commented Jun 17, 2018

@bubnikv Has this task been implemented in Prusa3D, so we can port this to Slic3r ?

@bubnikv

This comment has been minimized.

Copy link
Contributor

commented Jun 17, 2018

@laird

This comment has been minimized.

Copy link

commented Nov 2, 2018

Looks like it might be in Slic3r Prusa Edition 1.4.1 , which has faster and better 'arrange' than previously.

@tamasmeszaros

This comment has been minimized.

Copy link

commented Nov 2, 2018

Hello,
an implementation of the nesting has been developed in the form of a C++ library. It is inspired by SVGNest but not based on it in any way. Slic3r Prusa Edition 1.41 has the first working version integrated.

At this stage it works only for convex polygons which was sufficient for the first release. A proper NFP implementation is still a work in progress. A have tried to integrate @kallaballa 's libnfporb library but it crashed with some examples. I will try it again with a newer version sometimes when my time will allow.

At its current stage the nesting library lives on github: https://github.com/tamasmeszaros/libnest2d and its also part of the Slic3r prusa edition codebase.
Any improvements would be welcome, especially a robust implementation of the no fit polygon for non-convex shapes with holes.

@jjqcat

This comment has been minimized.

Copy link

commented Nov 25, 2018

@tamasmeszaros,
I will try to use libnfporb in libnest2d , but can't pack anything, should you give me some example code?thanks.

@jjqcat

This comment has been minimized.

Copy link

commented Nov 25, 2018

I see what's wrong, the nfp polygon's ’orientation is reversed.

@tamasmeszaros

This comment has been minimized.

Copy link

commented Mar 4, 2019

@jjqcat: Sorry for the late reply. If you have any trouble with libnest2d, please let me know I will try my best to help you. Also, if you make any progress with the libnfporb integration, please feel free to share your results on the libnest2d github page. It would be a valuable info in any case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.