To clear up a problem, noted earlier, about REPLACE not modifying the line.
The reasoning is that the person was looking for "; layer <num>,
\n", and of course the newline was not to be found there. You can as others have noted put the changes
before the layer comment, but I like it after the layer comment, so it's contained in that layer's definition. Anal? maybe...
Here is the incantation of the command that I use:
Code: Select all
{REPLACE "; layer 151," "; layer 151 - Preparing to change filament,\nG28 X\nM0\n;"}
The reason is as follows: In the normal generated gcode, the comment line will be:
When we replace "; layer 151," we are only replacing that part of the string; the "Z = 30.002" part does not get replaced. By including a final "\n;" at the
end of the replacement, the "Z = 30.002" will become a comment at the end of it, like so:
BEFORE:
AFTER:
Code: Select all
; layer 151 - Preparing to change filament,
G28 X
M0
; Z = 30.002
Hope that may help someone.
Cheers,
Christopher