Originally shared by Andrew Hodel http://xyzbots.com/gcode-optimizer/ This uses a Genetic Algorithm for optimizing the traveling salesman

Originally shared by Andrew Hodel

http://xyzbots.com/gcode-optimizer/

This uses a Genetic Algorithm for optimizing the traveling salesman problem for G0 (linear moves) commands in GCODE.

Simply upload a GCODE file and click Start/Restart, the program will loop and further optimize the hops between G0 points. When you are happy with the results, click Stop/Continue and then you can click Save Optimized GCODE to save the optimized file.

The program expects G0 commands to only happen above the material (when there is no cut happening).

It probably does not make sense to use this tool if you are cutting completely through the material unless you are using tabs on the outer cut of an object. Millcrum is a CAM tool which will add tabs to the path.

It was created by Andrew Hodel in 2015 based on the code cited in the paper (pdf) explaining the algorithm. There are some other projects that may interest you at http://xyzbots.com

Should I knew about it it would have saved me some work https://www.youtube.com/watch?v=zq9XQR3lrOc
:slight_smile:

I just got asked to make it yesterday.

That was fast.

how does the run-time and quality of the solution compare to metric_tsp_approx from the boost library? I did some simple tests with this boost library in 2011: http://www.anderswallin.net/2011/05/tsp/

@Anders_Wallin that’s going to depend on how many generations you let it run, it took less than a minute to get this - http://imgur.com/GUcy5V5

Here’s the GCODE for 2151 if you want to run some tests yourself… This file works on the gcode-optimizer…

http://pastebin.ca/3230686

I’m attempting to use this online tool, but after selecting a file to upload, it doesn’t actually upload it and when I then try to run the tool, it simply keeps showing the example.

Can you explain what causes this? Am I doing something wrong?

Hi @Sebastiaan! This is content that was imported to MakerForums from Google+ when Google shut down Google+ (thus the #gplus label), and the user you are trying to converse with, @Andrew_Hodel, has not yet logged into Maker Forums, so he won’t get notification of your question, sadly. :frowning:

That code looks pretty neat. I’ve always wanted to optimize my 3d print path, although there are added complications apart from optimizing travel time. Maybe I will get round to that someday.