Comment line in Gcodes

Hi, I need to comment this lines in my gcodes

REGEX
^M220 S100 ;Reset Feedrate

by that

;M220 S100 ;Reset Feedrate

I tried to use the Replacements but i think this does not work.

That is correct?








Comments

  • Looks correct if the spaces are matching. You can easily verify in https://regex101.com/ if an expression matches.

    Only thing is in replacements no further replacements may occur. Otherwise endless recursion would be possible.
  • edited November 2021
    I try this

    Regular Expresion: /M220 S100 ;Reset Feedrate/g

    Gcode to execute
    M220 S80 ;FEEDRATE 80 Personalizado


    this matches on regex101


    But not work.

    for this Gcode 

    M140 S60
    M105
    M190 S60
    M104 S195
    M105
    M109 S195
    M82 ;absolute extrusion mode
    M201 X500.00 Y500.00 Z1000.00 E5000.00 ;Setup machine max acceleration
    M203 X500.00 Y500.00 Z12.00 E120.00 ;Setup machine max feedrate
    M204 P1250.00 R2250.00 T1250.00 ;Setup Print/Retract/Travel acceleration
    M205 X10.00 Y10.00 Z0.40 E2.50 ;Setup Jerk
    M220 S100 ;Reset Feedrate
    M221 S100 ;Reset Flowrate

    G28 ; home all axes
    M117 Purge extruder
    G92 E0 ; reset extruder
    G1 Z1.0 F3000 ; move z up little to prevent scratching of surface
    G1 X2 Y20 Z0.3 F5000.0 ; move to start-line position
    G1 X2 Y200.0 Z0.3 F1500.0 E15 ; draw 1st line




  • You need to omit the javascript marker / and /g in your expression. Also you should start with ^ if it matches from line start to improve comparison speed.
  • I try that and not work.

    Can you check that on your test setup?

  • Set replacement to: M118 Replaced M220
    So I can better see if it was executed. Then executing your demo code above and as you see in output it got replaced:

    Send:9:32:44.700: N6 M530 S1 L1
    Send:9:32:44.700: N7 M531 TestReplace
    Send:9:32:44.700: N8 M532 X0 L0
    Send:9:32:44.700: N9 M539 P0
    Send:9:32:44.700: N10 M999
    Send:9:32:44.700: N0 M110
    Send:9:32:44.712: N1 M111 S14
    Send:9:32:44.712: N0 M110
    Send:9:32:44.713: N1 M415 S1
    Send:9:32:44.713: N2 M140 S60
    Send:9:32:44.717: N4 M190 S60
    Send:9:32:44.718: N5 M532 X22.1364 L0
    Send:9:32:44.718: N6 M104 S195
    Send:9:32:44.723: N8 M109 S195
    Send:9:32:44.724: N9 M82 ;absolute extrusion mode
    Send:9:32:44.724: N10 M201 X500.00 Y500.00 Z1000.00 E5000.00 ;Setup machine max acceleration
    Send:9:32:44.724: N11 M203 X500.00 Y500.00 Z12.00 E120.00 ;Setup machine max feedrate
    Send:9:32:44.725: N12 M204 P1250.00 R2250.00 T1250.00 ;Setup Print/Retract/Travel acceleration
    Send:9:32:44.725: N13 M205 X10.00 Y10.00 Z0.40 E2.50 ;Setup Jerk
    Recv:9:32:44.726: EPR:2 75 250000 Baudrate
    Recv:9:32:44.726: EPR:2 79 0 Max. inactive time [ms,0=off]
    Recv:9:32:44.726: EPR:2 83 60000 Stop stepper afer inactivity [ms,0=off]
    Recv:9:32:44.726: EPR:3 3 40.00 X-axis steps per mm
    Recv:9:32:44.726: EPR:3 7 40.00 Y-axis steps per mm
    Recv:9:32:44.726: EPR:3 11 3333.59 Z-axis steps per mm
    Recv:9:32:44.726: EPR:3 15 20000.00 X-axis max. feedrate [mm/min]
    Recv:9:32:44.726: EPR:3 19 20000.00 Y-axis max. feedrate [mm/min]
    Recv:9:32:44.727: EPR:3 23 2.00 Z-axis max. feedrate [mm/min]
    Recv:9:32:44.727: EPR:3 27 1500.00 X-axis homing feedrate [mm/min]
    Recv:9:32:44.727: EPR:3 31 1500.00 Y-axis homing feedrate [mm/min]
    Recv:9:32:44.727: EPR:3 35 100.00 Z-axis homing feedrate [mm/min]
    Recv:9:32:44.727: EPR:3 39 20.00 X-axis start speed [mm/s]
    Recv:9:32:44.727: EPR:3 43 20.00 Y-axis start speed [mm/s]
    Recv:9:32:44.727: EPR:3 47 1.00 Z-axis start speed [mm/s]
    Recv:9:32:44.727: EPR:3 51 750.00 X-axis acceleration [mm/s^2]
    Recv:9:32:44.728: EPR:3 55 750.00 Y-axis acceleration [mm/s^2]
    Recv:9:32:44.728: EPR:3 59 50.00 Z-axis acceleration [mm/s^2]
    Recv:9:32:44.728: EPR:3 63 750.00 X-axis travel acceleration [mm/s^2]
    Recv:9:32:44.728: EPR:3 67 750.00 Y-axis travel acceleration [mm/s^2]
    Recv:9:32:44.728: EPR:3 71 50.00 Z-axis travel acceleration [mm/s^2]
    Recv:9:32:44.728: EPR:3 150 373.00 Extr. steps per mm
    Recv:9:32:44.728: EPR:3 154 1200.00 Extr. max. feedrate [mm/min]
    Recv:9:32:44.729: EPR:3 158 10.00 Extr. start feedrate [mm/s]
    Recv:9:32:44.729: EPR:3 162 10000.00 Extr. acceleration [mm/s^2]
    Recv:9:32:44.729: EPR:0 166 1 Heat manager [0-1]
    Recv:9:32:44.729: EPR:0 167 130 PID drive max
    Recv:9:32:44.729: EPR:2 168 300 PID P-gain [*0.01]
    Recv:9:32:44.729: EPR:2 172 2 PID I-gain [*0.01]
    Recv:9:32:44.730: EPR:2 176 2000 PID D-gain [*0.01]
    Recv:9:32:44.730: EPR:0 180 200 PID max value [0-255]
    Recv:9:32:44.730: EPR:2 181 0 X-offset [steps]
    Recv:9:32:44.730: EPR:2 185 0 Y-offset [steps]
    Recv:9:32:44.730: EPR:2 189 40 Temp. stabilize time [s]
    Send:9:32:44.730: N14 M118 Replaced M220
    Send:9:32:44.730: N15 M221 S100 ;Reset Flowrate
    Send:9:32:44.730: N16 G28 ; home all axes
    Send:9:32:44.731: N17 M117 Purge extruder
    Send:9:32:44.731: N18 G92 E0 ; reset extruder
    Recv:9:32:44.733: Replaced M220
    Recv:9:32:44.734: N17 M117 Purge extruder
    Send:9:32:44.734: N19 G1 Z1.0 F3000 ; move z up little to prevent scratching of surface
    Send:9:32:44.734: N20 G1 X2 Y20 Z0.3 F5000.0 ; move to start-line position
    Send:9:32:44.734: N21 G1 X2 Y200.0 Z0.3 F1500.0 E15 ; draw 1st line
    Send:9:32:45.057: N22 M530 S0
    Send:9:32:45.057: N23 M539 P0
    Send:9:32:45.057: N24 M415 S0
    Send:9:32:45.057: @stopLog

    So not sure what you are doing wrong. I assume you have no trailing space and are using latest 1.2.0 release.
    If you want to replace all M220 S100 you can omit the ; .... part. Just in case comment got stripped, but it doe snot get stripped in my version so at that stage it is still there.
  • I have great news.

    Replace code works.
    I did not realize it because the speed is not updated in the interface.

    But yesterday I put the same file to print on two different machines and one finished before the other. So it works ... I don't know if it was when I removed the part of the comment or something else. But it works.


Sign In or Register to comment.