Skip to content

Commit

Permalink
add abrasive filament and high flow nozzle info (#48)
Browse files Browse the repository at this point in the history
  • Loading branch information
fiksupojka authored Sep 3, 2024
1 parent 1385873 commit 4cf0f53
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 2 deletions.
12 changes: 10 additions & 2 deletions gcode_metadata/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -502,8 +502,16 @@ def set_attr(self, name, value):
"extruder_colour":
MMUAttribute(separator=";",
value_type=str,
conversion=same_or_nothing)
}
conversion=same_or_nothing),
"nozzle_high_flow":
MMUAttribute(separator=",",
value_type=int,
conversion=same_or_nothing),
"filament_abrasive":
MMUAttribute(separator=",",
value_type=int,
conversion=same_or_nothing),
}

# These keys are primary defined by PrusaSlicer
# Keys ending in "per tool" mean there is a list inside
Expand Down
2 changes: 2 additions & 0 deletions tests/gcodes/fdn_full_0.15mm_PETG_MK3S_2h6m.gcode
Original file line number Diff line number Diff line change
Expand Up @@ -209877,6 +209877,7 @@ M73 Q100 S0
; extrusion_width = 0.45
; fan_always_on = 1
; fan_below_layer_time = 20
; filament_abrasive = 1
; filament_colour = #FF8000
; filament_cooling_final_speed = 3.4
; filament_cooling_initial_speed = 2.2
Expand Down Expand Up @@ -209975,6 +209976,7 @@ M73 Q100 S0
; mmu_segmented_region_max_width = 0
; notes =
; nozzle_diameter = 0.4
; nozzle_high_flow = 0
; only_retract_when_crossing_perimeters = 0
; ooze_prevention = 0
; output_filename_format = {input_filename_base}_{layer_height}mm_{filament_type[0]}_{printer_model}_{print_time}.gcode
Expand Down
2 changes: 2 additions & 0 deletions tests/gcodes/mmu_attribute_test.gcode
Original file line number Diff line number Diff line change
Expand Up @@ -147977,6 +147977,7 @@ M73 Q100 S0
; extrusion_width = 0.45
; fan_always_on = 1,1,0,0,0
; fan_below_layer_time = 20,100,10,10,10
; filament_abrasive = 1,1,1,1,1
; filament_colour = #FF8000;#FF8000;#FF8000;#FF8000;#FF8000
; filament_cooling_final_speed = 2.5,3.5,2.5,2.5,2.5
; filament_cooling_initial_speed = 5,10,5,5,5
Expand Down Expand Up @@ -148103,6 +148104,7 @@ M73 Q100 S0
; multimaterial_purging = 80
; notes =
; nozzle_diameter = 0.4,0.4,0.4,porkchop,0.4
; nozzle_high_flow = 1,0,0,1,0
; only_one_perimeter_first_layer = 0
; only_retract_when_crossing_perimeters = 0
; ooze_prevention = 0
Expand Down
8 changes: 8 additions & 0 deletions tests/test_metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,8 @@ def test_mmu(self):
; bed_temperature = 90,60,105,105,105
; filament_type = PETG;PLA;ASA;PETG;PETG
; extruder_colour = #FF8000;#DB5182;#3EC0FF;#FF4F4F;#FBEB7D
; nozzle_high_flow = 1,0,0,1,0
; filament_abrasive = 1,1,1,1,1
"""
fname = os.path.join(gcodes_dir, "mmu_attribute_test.gcode")
meta = get_metadata(fname, False)
Expand All @@ -183,6 +185,10 @@ def test_mmu(self):
assert meta.data['extruder_colour per tool'] == [
'#FF8000', '#DB5182', '#3EC0FF', '#FF4F4F', '#FBEB7D'
]
print(meta.data)
assert meta.data['filament_abrasive per tool'] == [1, 1, 1, 1, 1]
assert meta.data['filament_abrasive'] == 1
assert meta.data['nozzle_high_flow per tool'] == [1, 0, 0, 1, 0]
# This might be wrong, we might want to not allow negative values,
# but it's fun, so whatever
assert meta.data['filament cost'] == 0
Expand All @@ -205,13 +211,15 @@ def test_full(self):
'bed_temperature': 90,
'brim_width': 0,
'estimated printing time (normal mode)': '2h 6m 5s',
'filament_abrasive': 1,
'filament cost': 0.41,
'filament used [cm3]': 10.65,
'filament used [g]': 13.52,
'filament used [mm]': 4427.38,
'filament_type': 'PETG',
'fill_density': '20%',
'nozzle_diameter': 0.4,
'nozzle_high_flow': 0,
'printer_model': 'MK3S',
'layer_height': 0.15,
'support_material': 0,
Expand Down

0 comments on commit 4cf0f53

Please sign in to comment.