Duet3D Logo Duet3D
    • Tags
    • Documentation
    • Order
    • Register
    • Login

    anyone good with python? I'm struggling with a post processing

    Scheduled Pinned Locked Moved
    General Discussion
    2
    6
    463
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • nick9one1undefined
      nick9one1
      last edited by nick9one1

      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.gcode

      the script;
      https://github.com/nick9one1/superslicer_automesh/blob/main/meshgrid.py

      zaptaundefined 2 Replies Last reply Reply Quote 0
      • zaptaundefined
        zapta @nick9one1
        last edited by zapta

        @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.

        1 Reply Last reply Reply Quote 2
        • zaptaundefined
          zapta @nick9one1
          last edited by zapta

          @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).

          nick9one1undefined 1 Reply Last reply Reply Quote 1
          • nick9one1undefined
            nick9one1 @zapta
            last edited by nick9one1

            @zapta
            Perfect thanks 🙂 I'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]" 
            

            4628a07d-9269-46d0-ac18-59d5b5f7e5e7-image.png

            nick9one1undefined 1 Reply Last reply Reply Quote 0
            • nick9one1undefined
              nick9one1 @nick9one1
              last edited by

              @nick9one1 my bad.. just needed to drop "[output_filepath]".

              All working, thanks @zapta

              zaptaundefined 1 Reply Last reply Reply Quote 0
              • zaptaundefined
                zapta @nick9one1
                last edited by

                @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)

                1 Reply Last reply Reply Quote 1
                • First post
                  Last post
                Unless otherwise noted, all forum content is licensed under CC-BY-SA