Slic3r icon indicating copy to clipboard operation
Slic3r copied to clipboard

GSoC 2019 - SVGNest in Slicer

Open lordofhyphens opened this issue 5 years ago • 12 comments

Development log for GSoC 2019 project to implement #3237.

lordofhyphens avatar May 20 '19 13:05 lordofhyphens

Just FYI, there is a C version of SVGNest from the same author : Deepnest I don't know if it could be of any help

gege2b avatar May 20 '19 17:05 gege2b

Thanks @gege2b I'll try run it and test it. It would be really helpful to have a C implementation rather than JS :) It's mainly JS but the critical parts were rewritten in C.

3bhady avatar May 20 '19 18:05 3bhady

Today I'm investigating the auto-arrange code in slic3r.

3bhady avatar May 22 '19 10:05 3bhady

There may be two different entry point for auto-arrange:

  • the algo that move them around
  • the check that happens each time something is changed in the platter.

Be sure to use the same check algo for both, or to be sure that the check can't trigger after an arrange.

supermerill avatar May 22 '19 16:05 supermerill

EDIT: Okay that was fast :D I think I got it. Cross product of the two vectors formed by the first 3 points (we only need the first 2 vectors) if its result is positive then the polygon is anti-clockwise. Let me know if I'm missing something or if anyone likes to add anything :)

I'm having some trouble finding if the polygon is clockwise or anti-clockwise.

If anyone can help point me to something I can read on that I'd be grateful.

What I understand so far is that clockwise means that it's stored in a way that it's points are going in clockwise direction, but I'm not sure how to calculate that. I'm guessing it has something to do with cross product of every two consecutive vectors or something like that.

3bhady avatar Jun 16 '19 03:06 3bhady

You can check Polygon.hpp in xs/src/libslic3r as it has is_clockwise function https://github.com/slic3r/Slic3r/blob/master/xs/src/libslic3r/Polygon.hpp#L36

Samir55 avatar Jun 16 '19 05:06 Samir55

Thanks @Samir55 :)

3bhady avatar Jun 16 '19 05:06 3bhady

Did anything come of this? Asking for the FreeCAD folks who are interested in a similar function for the Path/CAM workbench.

luzpaz avatar Jan 30 '21 13:01 luzpaz

You may want to look into the arrangement in PrusaSlicer, inspired by svgnest. Cura recently adopted our PrusaSlicer code.

bubnikv avatar Jan 30 '21 14:01 bubnikv

@bubnikv cool, care to share a link ?

luzpaz avatar Jan 30 '21 15:01 luzpaz

Als interested in a nesting feature for freecad, so came across this issue. @luzpaz This might be of interest to you: https://github.com/grotius-cnc/Nest4J Still java, no c++ but more interfacing features.

bosd avatar Mar 21 '21 21:03 bosd

@luzpaz I think this is the link you were looking for to the nest2D library. https://github.com/tamasmeszaros/libnest2d

Theres also this porting attempt to c++ https://github.com/kallaballa/nestcpp

Basically you would want to have this but then for Freecad: https://github.com/NicoSchlueter/FuseNest

bosd avatar Mar 21 '21 21:03 bosd