I’m continuing to develop integrated design + gcode generation in Grasshopper, and my latest bit of difficulty is ending up with a bunch of infill lines that work as a matter of geometry, but which are wildly unoptimized as a matter of actual machine movement.
Extrusion being extrusion, I can both reorder the lines and flip their start/end to optimize. But… is there any better solution than just brute force “try every permutation of order and direction”? I’m typically working with 5 - 15 lines per layer, so the brute force approach has to evaluate quite a lot of options.
Here’s a small test file to illustrate how the infill lines arrive and how I’m looking at measuring travel distance (for each layer, the sum of movement from the end of one line to the start of the next).
minimize-travel.gh (22.2 KB)