Community
    • Login

    Mass editing G-code

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    17 Posts 4 Posters 1.8k Views
    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.
    • Levente VargaL
      Levente Varga
      last edited by

      Okay, so I managed to install PythonScript. In theory I created the script (made the file, copy pasted your script and saved as you said (18297-gcode-layer-numbering.py))
      I created a new file wich contains the directions for the folder I have my gcode files in, saved. But when I start the script, nothing happens. Literally. I click on the 18297-gcode-layer-numbering script and nothing.
      I would show some effort, but I really don’t know how this works. I follow your instructions, but for example I have no idea what the script contains.

      Thank you very much for this, i don’t know what’s wrong.

      1 Reply Last reply Reply Quote 0
      • EkopalypseE
        Ekopalypse
        last edited by

        First let’s check if the plugin has been correctly installed.
        Can you open the console?
        Plugins->PythonScript->ShowConsole
        If so, put the following into the run box in the console
        notepad.getVersion() and press enter or click Run
        What do you see?

        Levente VargaL 1 Reply Last reply Reply Quote 2
        • PeterJonesP
          PeterJones
          last edited by

          @Levente-Varga ,

          Thank you very much for this, i don’t know what’s wrong.

          Welcome back.

          Thanks for taking the effort to decode the script and install PythonScript; it shows you’re not just trying to get us to do your work for you.

          First, start with @ekopalypse’s instructions, and tell us what you see.

          After that, open your 18297-gcode-layer-numbering.py: if you go to Plugins > Python Script > Scripts, you can Ctrl+Click on 18297-gcode-layer-numbering.py to open it for editing.

          You’ll notice there are a few lines that start with #console. – remove the # comment marker. Save.

          Open your map file like I showed, making sure you are using the paths to your actual files, and whatever ID you want for each file. It needs to be in the active/top editor window.

          Then use Plugins > Python Script > Scripts, and normal-click on 18297-gcode-layer-numbering.py to run the script. If the PythonScript console wasn’t showing before, it should now.
          And you should see filename = '...', xid = '...' for each file as it’s processing.

          If you see any red text in the PythonScript console window, you’ll have copy the whole console window, and paste the contents (especially the error) into your reply in the forum. Once you paste, hightlight that section you pasted and click the </> to mark that section as code, so we get the actual characters you see.

          1 Reply Last reply Reply Quote 2
          • Levente VargaL
            Levente Varga @Ekopalypse
            last edited by

            @Ekopalypse 2019-10-01 (1).png

            1 Reply Last reply Reply Quote 0
            • PeterJonesP
              PeterJones
              last edited by

              Sorry, I forgot that since you were decoding it, the forum wouldn’t gobble the indents.

              In the script, Ctrl+A to select all, then Shift+TAB twice to un-indent twice. Save. Then go back to your map file and run the script again.

              1 Reply Last reply Reply Quote 2
              • EkopalypseE
                Ekopalypse
                last edited by

                This post is deleted!
                1 Reply Last reply Reply Quote 0
                • PeterJonesP
                  PeterJones
                  last edited by

                  @PeterJones said in Mass editing G-code:

                  then go back to your map file

                  You’ll also want to make sure your map file isn’t indented. Again, select all and Shift+TAB until it’s no longer indented.

                  Levente VargaL 1 Reply Last reply Reply Quote 1
                  • Levente VargaL
                    Levente Varga
                    last edited by

                    alt text

                    Thank thanks thanks guys. I’ll test it on my printer soon, it is printing atm.
                    I really appreciate it!

                    1 Reply Last reply Reply Quote 1
                    • Levente VargaL
                      Levente Varga @PeterJones
                      last edited by

                      @PeterJones well I have good and bad news. The good is, your script works flawless, but turns out the gcode needs that line. Can you help me edit the script to insert the

                      M117 LayerX/sumX
                      

                      line AFTER the

                      ;Layer:X
                      

                      line?

                      1 Reply Last reply Reply Quote 0
                      • PeterJonesP
                        PeterJones
                        last edited by PeterJones

                        Good news and bad news:

                        edit the script

                        Change the lambda m:... line to:

                        lambda m: str(m.group(0)) + "\r\nM117 Layer:" + str(m.group(1)) + '/' + xid
                        

                        The m.group(0) contains the whole original match. The \r\n add a windows CRLF newline between the original match and the new text. The rest is the same as before.

                        1 Reply Last reply Reply Quote 2
                        • Levente VargaL
                          Levente Varga
                          last edited by

                          Now it works like a charm. Thank you again!

                          1 Reply Last reply Reply Quote 2
                          • First post
                            Last post
                          The Community of users of the Notepad++ text editor.
                          Powered by NodeBB | Contributors