Skip to content

Commit

Permalink
Feature: Add retraction parameters to G-code header (#68)
Browse files Browse the repository at this point in the history
  • Loading branch information
parachvte authored Apr 19, 2023
1 parent e93492b commit 8ce9ade
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
20 changes: 20 additions & 0 deletions gcode_writer/SnapmakerGCodeWriter.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,9 +184,14 @@ def _processGCodeListV1(self, stream, gcode_list: List[str]) -> None:
material = extruder.material
temperature = extruder.getProperty("material_print_temperature", "value")

retraction_amount = extruder.getProperty("retraction_amount", "value")
switch_retraction_amount = extruder.getProperty("switch_extruder_retraction_amount", "value")

headers.append(";Extruder {} Nozzle Size:{}".format(extruder.position, nozzle_size))
headers.append(";Extruder {} Material:{}".format(extruder.position, material.getName()))
headers.append(";Extruder {} Print Temperature:{}".format(extruder.position, temperature))
headers.append(";Extruder {} Retraction Distance:{}".format(extruder.position, retraction_amount))
headers.append(";Extruder {} Switch Retraction Distance:{}".format(extruder.position, switch_retraction_amount))

bed_temperature = global_stack.getProperty("material_bed_temperature_layer_0", "value")
headers.append(";Bed Temperature:{}".format(bed_temperature))
Expand Down Expand Up @@ -279,6 +284,21 @@ def _processGCodeListLegacy(self, stream, gcode_list: List[str]) -> None:
# ";Extruder Mode:{}".format(self._extruder_mode),
]

for extruder in global_stack.extruderList:
nozzle_size = extruder.getProperty("machine_nozzle_size", "value")

material = extruder.material
temperature = extruder.getProperty("material_print_temperature", "value")

retraction_amount = extruder.getProperty("retraction_amount", "value")
switch_retraction_amount = extruder.getProperty("switch_extruder_retraction_amount", "value")

headers.append(";Extruder {} Nozzle Size:{}".format(extruder.position, nozzle_size))
headers.append(";Extruder {} Material:{}".format(extruder.position, material.getName()))
headers.append(";Extruder {} Print Temperature:{}".format(extruder.position, temperature))
headers.append(";Extruder {} Retraction Distance:{}".format(extruder.position, retraction_amount))
headers.append(";Extruder {} Switch Retraction Distance:{}".format(extruder.position, switch_retraction_amount))

if gcode_info and gcode_info.bbox.isValid():
bbox = gcode_info.bbox
headers.extend([
Expand Down
2 changes: 1 addition & 1 deletion plugin.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "Snapmaker Plugin",
"author": "Snapmaker",
"version": "0.8.1",
"version": "0.9.0",
"description": "Provides support for Snapmaker J1 & Snapmaker Artisan.",
"api": 8,
"supported_sdk_versions": ["8.0.0", "8.1.0", "8.2.0", "8.3.0"],
Expand Down

0 comments on commit 8ce9ade

Please sign in to comment.