anyone good with python? I'm struggling with a post processing
-
I found a nice that reduces the probe area based on what youre printing script originally written by CCS86 and modified by @Luke-sLaboratory, then later modified by @zapta Unfortunately zaptas github link no longer works
Nevertheless, using luke's version, I cant get it to work.
I've sliced a simple cube in superslicer and have been running it from the command line;
python3 "C:\Program Files\SuperSlicer\meshgrid.py" "C:\Users\mumby\OneDrive\Desktop\Shape-Box.gcode"
Starting Mesh Calculations Bounds are: {'X': {'min': 137, 'max': 181}, 'Y': {'min': 117, 'max': 161}} Traceback (most recent call last): File "C:\Program Files\SuperSlicer\meshgrid.py", line 206, in <module> main(fname = sys.argv[1]) File "C:\Program Files\SuperSlicer\meshgrid.py", line 67, in main linesNew = calcBed(lines) File "C:\Program Files\SuperSlicer\meshgrid.py", line 86, in calcBed bed = findBed() File "C:\Program Files\SuperSlicer\meshgrid.py", line 119, in findBed maxXY = bedCorners.split(',')[2].split('x') AttributeError: 'NoneType' object has no attribute 'split'
the gcode im trying to run it against;
https://github.com/nick9one1/superslicer_automesh/blob/main/Shape-Box.gcodethe script;
https://github.com/nick9one1/superslicer_automesh/blob/main/meshgrid.py -
@nick9one1, I moved it to a smaller repository so I don't need to keep everything on my computer.
It is now here https://github.com/zapta/util/tree/main/duet3d_automesh
BTW, that post processing script also translate the slicers progress marks to gcode that caused it to be displayed on the PanelDue's standby temp fields.
You may want to adapt it to your needs. I am using it with Prusa Slicer.
-
@nick9one1, looking at the error message, it seems to complain that bedCoreners does it a value when the program reaches line 119. That variable is set in line 118 from an operating system environment variable but if that environment variable doesn't exist, bedCorners is set to None.
bedCorners = os.environ.get("SLIC3R_BED_SHAPE") maxXY = bedCorners.split(',')[2].split('x')
Did you define the operating system environment variable SLIC3R_BED_SHAPE? If not, you will need to have it set before the program starts or simply set that value in line 118 of your copy of the python script. (That what I did with my script, just put my configuration values in the python script directly).
-
@zapta
Perfect thanksI've got it working from the command line with your code.
Now I just need to work out why it wont run in superslicer..
If create a .gcode file and run this from cmd, it works..
C:\Users\mumby\AppData\Local\Programs\Python\Python39\python.exe "C:\Users\mumby\OneDrive\Desktop\duet3d_automesh.py" "C:\Users\mumby\OneDrive\Desktop\box.gcode"
but this doesnt work from the prusaslicer..
C:\Users\mumby\AppData\Local\Programs\Python\Python39\python.exe "C:\Users\mumby\OneDrive\Desktop\duet3d_automesh.py" "[output_filepath]"
-
@nick9one1 my bad.. just needed to drop "[output_filepath]".
All working, thanks @zapta
-
@nick9one1, I am glad that it works for you. I also struggled with the activation of the script from the slicer, especially under windows (Mac was a little bit easier).
Being able to use "[output_filepath]" as you mentioned would be the clean approach but for some reason it's not supported. Without that, I was struggling to support all valid file names and had only a partial success (e.g. file name which one space work, file names with two consecutive spaces don't)