Replace part of Gcode



  • Hi,

    I want to replace a part of my Gcode.
    Example:
    G1 Z0.250 F1800.000
    G1 X84.650 Y85.654 F1800.000

    I can’t simply replace the F1800.000 because it is used in other parts. I only want to replace the F1800.000 with F90.000 in the lines with Z. The number behind the Z also changes.
    So for the example. The first line has to change but the second line has to be the same.

    I already tried:
    Find: G1 Z(.*) F1800.000
    Replace: G1 Z\1 F90 \nG1 F1800

    Where’s the mistake? It doesn’t change anything. Do I have to change the search method?

    Thank you :),

    Axel



  • Hallo @Axel-Dekeyser,

    Do I have to change the search method?

    Yes, if you didn’'t use regular expression

    Cheers
    Claudia



  • with the regular expression it also doesn’t change what I want.
    Is the Find and Replace that I use correct?



  • Well it depends, your replace does more than you have described,
    so I don’t know if it is expected or just an error.
    If you could give something like

    This is what I have
    and
    this is what I want to have

    we can definitively say what is going wrong.
    So from what you described, you wanna replace F1800.000
    value in lines with Z coordinates, which of course will differ…
    From your description it is only needed to have
    G1 Z\1 F90

    There is room for simplifying the regex like
    Find: (G1 Z.* F)1800.000
    Replace with: \190

    But your find/replace should work as well.

    Cheers
    Claudia



  • With the simplification it worked fine :)

    Thank you so much Claudia.


Log in to reply