I have written a perl program to optimize sandify pattern files. All my tests so far have had good results.
The program cuts out all back and forth motion along the edges of the table, eliminates all circling around the edges of the table, and forces shortest path around the table through 2 and 3 corners (3 corner paths are replaced by a single corner path). The result is usually greatly reduced pattern file size, faster drawing on the table because movement along the edge uses longest segment length (think acceleration/deceleration), excess motion is gone, and it’s a lot less boring to watch because the unproductive edge motion is greatly reduced. It will save wear and tear on the table mechanism as well. All this leaves the pattern on the table unchanged except the edges sometimes looks a little ragged because there’s little motion along the edges to clean it up.
It’s extremely easy to use. Start it up by typing “perl sandify_trim_all.pl” and then enter the pattern file name. Output is in a file called “clean.gcode”.
I wrote it using Strawberry Perl in windoze, but I think it should work in any recent perl 5 install.