supermerill / SuperSlicer

G-code generator for 3D printers (Prusa, Voron, Creality, etc.)
4.13k stars 520 forks source link

G-code substitutions run after Print remaining times #2644

Open Lecso11 opened 2 years ago

Lecso11 commented 2 years ago

What happened?

I wanted to replace the M117 Time Left 0h3m53s line with a line such as _MYMACRO R=0h3m53s so I could pass the time as a variable, but the Gcode substitutions might run before SS adds the M117 lines, and that results in no change in my code, since it can't find those lines.

Project file & How to reproduce

OpenLOCK-Clip-v5.3.zip Enable Print remaining times with M117 Enter a Gcode substitution for M117 Time Left and replace it with R= The resulting gcode does not have the M117 lines changed.

Version

2.4.58.2

Operating system

Windows 10

Printer model

Voron 2.4 with klipper

neophyl commented 2 years ago

Its my understanding that the M117 remaining times are produced by a post processor, that means it has to have the gcode done before it can produce them.

I dont know how feasible it is to control the ordering of any /all of these various post processing options that we seem to have now though. Have to wait for Merill on that one.

supermerill commented 2 years ago

I guess what you have to do for now is to create a post-process script that replace M117 (.*) by MY_MACRO R=$1

I won't change the behavior of the gcode replace current alog in the near future, as I already ahve a bit too much thing to change.

mmm... I guess i can re-apply it at the end. I'll see if it's easy enough.

aleung commented 2 years ago

A workaround is to call sed in post processing script. (It's available on Linux. Need to find alternative on Windows)

I use this post-processing script to turn off bed heating 4 minutes before printing finish:

/usr/local/bin/sed -i 's/M117 Time Left 0h4m0s/M140 S0/';