Open robin-swift opened 3 years ago
The few people with Gcode embroidery machines tend to hook their Z axis to stitching. They do this by setting up an old sewing machine and hooking a motor to the hand-crank and an x-y plotter to the sewing field. This gives them an embroidery machine out of an old sewing machine and the important commands for the embroidery machine tend to be +Z for stitch and X and Y for switch locations. Though there are many other designs and more gcode formats that might be needed than could be expressed in a hard-coded definition.
I did develop a solution to this for pen plotters, https://github.com/plottertools/vpype-gcode/
The main trick is that you save some profiles of settings for how to write a particular format. Then we cycle through them in the standard block formats:
<document_start>
<layer_start>
<line_start>
<segment_first>
<segment>
<segment>
<segment>
<segment>
<segment_last>
<line_end>
<line_join>
<line_start>
<segment_first>
<segment>
<segment>
<segment>
<segment>
<segment_last>
<line_end>
<line_join>
<line_start>
<segment_first>
<segment>
<segment>
<segment>
<segment>
<segment_last>
<line_end>
<layer_end>
<layer_join>
<layer_start>
<line_start>
<segment_first>
<segment>
<segment>
<segment>
<segment>
<segment_last>
<line_end>
<line_join>
<line_start>
<segment_first>
<segment>
<segment>
<segment>
<segment>
<segment_last>
<line_end>
<line_join>
<line_start>
<segment_first>
<segment>
<segment>
<segment>
<segment>
<segment_last>
<line_end>
<layer_end>
<document_end>
Then the user defines particular bits and how that bit should be formatted. Like the * STITCH {dx:%f}, {dy:%f}\n
and it could potentially provide a bunch of other bits of information but doesn't need to. This sort of writing scheme is actually good enough to write gcode, but actually broad enough that it can write any ascii text based formats. I've had it write everything from CSV to JSON to SVG.
This is actually as broad as things need to be to write gcode because hobbyists could hook things up in a lot of different ways.
Copied from old to do list.