Originally shared by Nathaniel Stenzel I was playing with some python code for making

Originally shared by Nathaniel Stenzel

I was playing with some python code for making more efficient CNC toolpaths. Below are the results.

http://pastebin.com/raw.php?i=9xb5L3QR

Forgive my lack of comprehension. Your post doesn’t tell me much. What kinds of toolpaths are you trying to make more efficient?

@Kyle_Kerr Well, when I made a heart shaped mother’s day present (saying “Best Mom Ever”), it spent alot of time moving from one side of the wood to the other when it could have simply kept working in that area for a little while before moving on to the next section. About 90% of the time was spent moving the dremel around and not cutting. I hoped to fix that problem. The python code is really only useful for when the cutting bit can’t cut very well except on the end of the bit. My dremel bit does not let me put the bit next to the material and then cut into it from the side, for example.

Ah, the “traveling salesman” issue. You might consider a different program to make your Gcode for you. There are many options. What program did you use to generate your Gcode originally?

http://www.scorchworks.com/Dmap2gcode/dmap2gcode.html

Since I am a cheapskate and I do not want to use Windows, I decided to write my own rough tool path generator. That software can make the final cut toolpath.

I wrote some stuff to do this as well, although I didn’t get very far. PyCAM tends to make very discontinuous gcode, so I wrote something to analyze individual layers to try to at least connect them into single shapes rather than moves scattered all over everywhere. But path minimization is a known hard problem.

@John_Bump I made 3 tool path generators. The first one might have alot of side friction compared to the others, but it might be more efficient for some things, if there are not large non-cut areas in the middle.

I also considered writing code to just optimize pregenerated gcode.

It is nice to know that I am not the only person that feels the need to write his own gcode generating/optimizing code.

Take a look, if you haven’t already, at gcmc: http://www.vagrearg.org/content/gcmc

look for “minimizing tool airtime”. it is a cool problem.

@Kyle_Kerr He is considering another program. In this case a custom one. It’s not aways about the destination. There is a lot to be learned by hacking together something yourself. In the long run it may not be his primary GCode generator, but there is a lot he will understand due to the project.

@Jason_Fehr @Kyle_Kerr Indeed. I am learning alot with the project. I am learning better how the gcode is actually handled. It will only be good enough for the rough cuts and I accept that. I may find much better software for Free and usable on Linux/Android too.

At least for now, I get to better understand things and there are few times when I actually have the motivation and enjoyment in programming. You see, work tends to suck the life out of me lately. I rarely get home with the energy to do anything else than watch anime. I rarely get to enjoy programming anymore. I work as a programmer.

As you are reviving this post, did you see the traveling salesman Gcode helper pass by some time in the past week?

Yes, I saw someone post about that.