Skip to content

Commit

Permalink
Add objects metadata to FDM Attrs
Browse files Browse the repository at this point in the history
  • Loading branch information
TojikCZ committed Oct 1, 2024
1 parent c72c210 commit 4c2d411
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 0 deletions.
1 change: 1 addition & 0 deletions gcode_metadata/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -563,6 +563,7 @@ def set_attr(self, name, value):
"normal_change_in_present": bool,
"layer_info_present": bool,
"max_layer_z": float,
"objects_info": json.loads,
}

# Add attributes that have multiple values in MMU print gcodes
Expand Down
1 change: 1 addition & 0 deletions tests/gcodes/fdn_full_0.15mm_PETG_MK3S_2h6m.gcode
Original file line number Diff line number Diff line change
Expand Up @@ -209977,6 +209977,7 @@ M73 Q100 S0
; notes =
; nozzle_diameter = 0.4
; nozzle_high_flow = 0
; objects_info = {"objects":[{"name":"Shape-Box id:0 copy 0","polygon":[[111.000,111.000],[93.000,111.000],[93.000,93.000],[111.000,93.000]]},{"name":"Shape-Box id:0 copy 1","polygon":[[87.000,111.000],[69.000,111.000],[69.000,93.000],[87.000,93.000]]},{"name":"Shape-Box id:0 copy 2","polygon":[[111.000,87.000],[93.000,87.000],[93.000,69.000],[111.000,69.000]]},{"name":"Shape-Box id:0 copy 3","polygon":[[87.000,87.000],[69.000,87.000],[69.000,69.000],[87.000,69.000]]}]}
; 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
42 changes: 42 additions & 0 deletions tests/test_metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,48 @@ def test_full(self):
'normal_percent_present': True,
'quiet_left_present': True,
'quiet_percent_present': True,
# objects don't match up with the actually printed objects
# this is expected - I have copied object info from another file
'objects_info': {
"objects": [
{
"name": "Shape-Box id:0 copy 0",
"polygon": [
[111.000, 111.000],
[93.000, 111.000],
[93.000, 93.000],
[111.000, 93.000]
]
},
{
"name": "Shape-Box id:0 copy 1",
"polygon": [
[87.000, 111.000],
[69.000, 111.000],
[69.000, 93.000],
[87.000, 93.000]
]
},
{
"name": "Shape-Box id:0 copy 2",
"polygon": [
[111.000, 87.000],
[93.000, 87.000],
[93.000, 69.000],
[111.000, 69.000]
]
},
{
"name": "Shape-Box id:0 copy 3",
"polygon": [
[87.000, 87.000],
[69.000, 87.000],
[69.000, 69.000],
[87.000, 69.000]
]
}
]
}
}
assert len(meta.thumbnails['640x480_PNG']) == 158644

Expand Down

0 comments on commit 4c2d411

Please sign in to comment.