Ich mache einige Gcode-Maschinenanweisungen und muss am Anfang der Zeile eine Anweisung hinzufügen, bei der jede 1. Instanz von, F 180.0
aber die zweite überspringt
z.B
G00 X 0.0000 Y 0.0000 Z 10.0000
G00 X 24.5230 Y 44.6619 Z 5.0000
G01 X 24.5230 Y 44.6619 Z 0.0000 F 180.0
G01 X 24.5585 Y 45.2432 Z 0.0000 F 180.0
G01 X 24.6723 Y 45.8451 Z 0.0000
Würde werden
G00 X 0.0000 Y 0.0000 Z 10.0000
G00 X 24.5230 Y 44.6619 Z 5.0000
M03 G01 X 24.5230 Y 44.6619 Z 0.0000 F 180.0
G01 X 24.5585 Y 45.2432 Z 0.0000 F 180.0
G01 X 24.6723 Y 45.8451 Z 0.0000
Ich vermute, dass das gleiche Prinzip angewendet werden könnte, aber dann muss ich zu jeder Zeile hinzufügen, dieZ5.0000
G00 X 0.0000 Y 0.0000 Z 10.0000
M05 G00 X 24.5230 Y 44.6619 Z 5.0000
M03 G01 X 24.5230 Y 44.6619 Z 0.0000 F 180.0
G01 X 24.5585 Y 45.2432 Z 0.0000 F 180.0
G01 X 24.6723 Y 45.8451 Z 0.0000
Antwort1
- Ctrl+H
- Finde was:
\A(?:(?:(?!\bF 180\.0\b).)+\R)+\K^(?=.+?\bF 180\.0\b)
- Ersetzen mit:
M03
<-- nach M03 steht ein Leerzeichen - ÜBERPRÜFEN Groß-/Kleinschreibung beachten
- ÜBERPRÜFEN Umwickeln
- ÜBERPRÜFEN Regulären Ausdruck
- DEAKTIVIEREN
. matches newline
* - Replace all
Erläuterung:
\A # beginning of file
(?: # non capture group ()
(?: # non capture group (1 line that doesn't contain F 180.0)
(?! # negative lookahead, make sure we haven't after:
\b # word boundary
F 180\.0 # literally
\b # word boundary
) # end lookahead
. # any character but newline
)+ # end group, may appear 1 or more times
\R # any kind of line break
)+ # end group, may appear 1 or more times
\K # forget all we have seen until this position(i.e. skip all lines before the first occurrence of F 180.0)
^ # beginning of line
(?= # positive lookahead, make sure we have after:
.+? # 1 or more any character but newline, not greedy
\b # word boundary
F 180\.0 # literally
\b # word boundary
) # end lookahead
Bildschirmaufnahme (vorher):
Bildschirmaufnahme (nachher):
Der zweite Ersatz ist ähnlich, aber einfacher:
- Finde was:
^(?=.+?\bZ 5.0000\b)
- Ersetzen mit:
M03
Bildschirmaufnahme (nachher):