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

    Edit Gcode to remove all G1 Z....

    Scheduled Pinned Locked Moved
    General Discussion
    3
    3
    248
    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.
    • pabomanundefined
      paboman
      last edited by

      I need to edit a standard but very long Gcode from Simplify3D and get a new Gcode with all G1 Z set to 100 for testing purpose.

      I am trying with sublime text editor to find Z and replace with Z100 but when the program find Z4 it then becomes z1004.

      thx!

      droftartsundefined deckingmanundefined 2 Replies Last reply Reply Quote 0
      • droftartsundefined
        droftarts administrators @paboman
        last edited by droftarts

        @paboman I think you can use grep searches in Sublime, with which you can be more specific, and yet more flexible, about your search and replace; I do something similar using BBedit on macOS.
        eg find "[beginning of line]G1[space]Z[numbers after until space (assuming there's a speed command)]" replace with "G1[space]Z100". On BBedit it would be:

        Find: ^G1 Z.*
        there's a space after the *
        the ^ means start search at beginning of the line
        the .* means find any character, repeat until next search character, which is space in this case.

        Replace: 'G1 Z100 '
        Again, there's a space after the Z100.

        For me, this changed G1 Z0.300 F4800.000 (and all other instances) to G1 Z100 F4800.000, and didn't touch any other G commands.

        If there's X and Y commands between G1 and Z# then it gets a little more complex, but you can usually format a grep search to handle it! If in doubt, post a snippet of the gcode and I'll suggest a suitable search and replace.

        Ian

        Bed-slinger - Mini5+ WiFi/1LC | RRP Fisher v1 - D2 WiFi | Polargraph - D2 WiFi | TronXY X5S - 6HC/Roto | CNC router - 6HC | Tractus3D T1250 - D2 Eth

        1 Reply Last reply Reply Quote 1
        • deckingmanundefined
          deckingman @paboman
          last edited by

          @paboman Alternatively, notepad++ (which is free) will do what you want quickly and easily using "Search" - "Replace". Just remember that when you "save as" by default, it will add .txt to the end of the file so you need to remove that extension. Or you can associate .g files with notepad++ then it won't add the .txt extension.

          Ian
          https://somei3deas.wordpress.com/
          https://www.youtube.com/@deckingman

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