My open source nesting program

If you were at the last SHHH you may have seen me demo this thing: http://svgnest.com

I’m still working on it actually, but its usable for the most part. Check it out and let me know what you think.

It’s designed to peg your cpu, so be warned if you’re on mobile.

13 Likes

That’s awesome! So it’s a 2D bin packing algorithm for SVG files? :slight_smile: Definitely useful for people cutting a lot of laser cut parts! I’d considered doing something similar as an Inkscape plugin, but I like this solution because it requires no installation.

What sort of algorithm are you using to solve it?

If you ever run out of ideas on features, configurations, and constraints to have, here are a few that come to mind:

  1. Preserve orientation of certain parts, or allow 90deg rotation only.
  2. Allow certain parts to be mirrored (or not).
  3. Specify bounding box size and number of each item to include. Output should be multiple bounding boxes, with the right total count of every part.
  4. Optimization for sharing edges (good if cut time is costly).
  5. Minimum required spacing between parts (important for CNC router).
  6. Pack inside arbitrarily shaped bounding SVG (think Glowforge camera + your parts files, auto-arranged on whatever scrap piece of material you have inside).

Agreed re: all of these!

More nice-to-haves:

  • upload multiple “source” SVG files
  • specify a target area rather than choosing an object, and have the program parcel the parts out into the minimum feasible number of bins.

:smile:

Bug? Bottom left shows what appears to be two large polygons overlapping each other. This appeared after 8 iterations using the demo.

There are a few edge cases in the no fit polygon generation. Still working it out :sweat:

The spacing feature is in the config menu. The other features are definitely on my to-do list. The major one that I’m thinking about is placing parts in holes of other parts, which it doesn’t do right now.

This is awesome! I ran into a similar issue trying to bin pack all the cut outs for the VHS layout stuff… I ended up writting a fusion 360 plugin (GitHub - laftho/CSVRectanglePack: Autodesk Fusion 360 2015 script to parse CSV rectangles and pack into a 2D sketch) which mostly works… the downside is it that exporting it to a file usable on a laser I lose my text… Was going to do a similar thing for inkscape or something but might just be able to use this for the bin pack!

This is rad. I also wrote some code to start doing this, but you got further than I ever did. Also made it a super pretty interface.

fixed some issues and put up a write up on how the algo works: GitHub - Jack000/SVGnest: An open source vector nesting tool

2 Likes

Great project and very nice writeup. I will try to use this once the laser is running again!

BTW I submitted this to hacker news, and you’re on the front page right now!

Everyone go upvote it and support our fellow VHSer!

Wooo, thanks : ]