Generic Writer: Dynamic Values
What's Changed
Note the formatting of "needle_set", which provides a None key for the dictionary of with the key and default values. The key in question is transmuted the same way the other lines are. So this would work well for needle_set number, or specific line numbers, but not so well for general x,y positions.
gcode_writer_dict = {
"scale": (0.1, -0.1),
"thread_change_command": NEEDLE_SET,
"write_speeds": True,
"pattern_start": "G21 G90 F6000 (mm units, absolute positioning, speed)\n",
"thread_entry": "(Thread{thread_index}: {thread_color} {thread_description} {thread_brand} {thread_catalog_number})\n",
"color_start": "G00 X{x:.3f} Y{y:.3f} (Starting new location)\n",
"stitch": "G01 X{x:.3f} Y{y:.3f}\n",
"slow": "F1000\n",
"fast": "F6000\n",
"needle_set": {None: ("{cmd_needle}", "default value {cmd_needle}\n"), "1": "G0A51\n", "2": "G0B8\n"},
"end": "M30\n",
}
file = "file-generic.gcode"
EmbPattern.write_embroidery(
GenericWriter,
pattern,
file,
gcode_writer_dict,
)Full Changelog: 1.4.34...1.4.35