Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

regexp update to extract filament len & vol from pS gcode. And fix python version handling #306

Merged
merged 3 commits into from
Oct 16, 2023

Conversation

HTXF-g
Copy link
Contributor

@HTXF-g HTXF-g commented May 25, 2023

No description provided.

It now determines the python version right.
I'm using python 3.11 which newer than python 3.3.
But comparing the two numbers as float would deliver a wrong result.
Now  major and minor version numbers are compared separately as int.

this fixes the following error messages:
————
2023-04-23 14:08:56,953 Running: "/home/ender/OctoPrint/venv/bin/python3" "/home/ender/OctoPrint/venv/lib/python3.11/site-packages/octoprint_PrintTimeGenius/analyzers/analyze_gcode_comments.py" "/home/ender/.octoprint/uploads/20230423-140640_1h54m_11,5g3,9m_0.4Nzl0.16PLA_235C55C0.968EF-0.08Z20%IrFR_20%IOL0.85BF_Form-Kubus_LA0.3_Speed10-70.gcode" --parsers slic3r_pe_print_time slic3r_pe_print_time_remaining
2023-04-23 14:09:02,535 Failed to run '"/home/ender/OctoPrint/venv/bin/python3" "/home/ender/OctoPrint/venv/lib/python3.11/site-packages/octoprint_PrintTimeGenius/analyzers/analyze_gcode_comments.py" "/home/ender/.octoprint/uploads/20230423-140640_1h54m_11,5g3,9m_0.4Nzl0.16PLA_235C55C0.968EF-0.08Z20%IrFR_20%IOL0.85BF_Form-Kubus_LA0.3_Speed10-70.gcode" --parsers slic3r_pe_print_time slic3r_pe_print_time_remaining'
Traceback (most recent call last):
  File "/home/ender/OctoPrint/venv/lib/python3.11/site-packages/octoprint_PrintTimeGenius/__init__.py", line 348, in _do_analysis
    raise Exception(results_err)
Exception: Traceback (most recent call last):
  File "/home/ender/OctoPrint/venv/lib/python3.11/site-packages/octoprint_PrintTimeGenius/analyzers/analyze_gcode_comments.py", line 10, in <module>
    from collections import Mapping as collections_Mapping
ImportError: cannot import name 'Mapping' from 'collections' (/usr/lib/python3.11/collections/__init__.py)
————
I'm using prusa slicer 2.5.2 for slicing.
it writes the filament usage in .gcode files like this:
————
; filament used [mm] = 3851.15
; filament used [cm3] = 9.26
; filament used [g] = 11.49
; filament cost = 0.23
; total filament used [g] = 11.49
; total filament cost = 0.23
————

I extended the regexp in the "process_slic3r_filament" parser to match filament usage & volume.
They are extracted to match group 3 & 4.
HTXF-g added a commit to HTXF-g/example-files-etc... that referenced this pull request May 26, 2023
HTXF-g added a commit to HTXF-g/example-files-etc... that referenced this pull request May 26, 2023
@eyal0 eyal0 merged commit 67a5c8c into eyal0:master Oct 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants