Remap G04 from P code F code
04 Jul 2021 14:47 - 04 Jul 2021 14:48 #213692
by CNC4Life
Remap G04 from P code F code was created by CNC4Life
Hello people I have a machine I’m retrofitting that has two sisters machines that are not retrofit. The original controller uses F instead of P on G04. Is there a relatively easy way I can fix this so all the machines can run the same code?
I was going to remap it but found on the man pages it’s protected.
Any help would be appreciated.
I was going to remap it but found on the man pages it’s protected.
Any help would be appreciated.
Last edit: 04 Jul 2021 14:48 by CNC4Life.
Please Log in or Create an account to join the conversation.
04 Jul 2021 14:59 #213695
by Aciera
Replied by Aciera on topic Remap G04 from P code F code
I think a filter program could be a solution:
linuxcnc.org/docs/devel/html/gui/filter_programs.html
So you could write a python code to search your gcode for 'G04 F' and replace it with 'G04 P'.
linuxcnc.org/docs/devel/html/gui/filter_programs.html
So you could write a python code to search your gcode for 'G04 F' and replace it with 'G04 P'.
Please Log in or Create an account to join the conversation.
05 Jul 2021 21:50 #213793
by andypugh
Replied by andypugh on topic Remap G04 from P code F code
Here is a filter file that might do the job:It works for me, anyway, to change P04 to F04. If you want to go the other way switch the P and F in the regex strings.
#! /usr/bin/python
import re
import sys
infile = sys.argv[1]
f = open(infile, 'r')
for line in f:
print(re.sub(r"G0*4\s*P\s*(\d*)",r"G04 F\1",line), end="")
The following user(s) said Thank You: Aciera
Please Log in or Create an account to join the conversation.
- tommylight
- Away
- Moderator
Less
More
- Posts: 19106
- Thank you received: 6398
05 Jul 2021 23:35 #213806
by tommylight
Replied by tommylight on topic Remap G04 from P code F code
He gets :
G04 Pn << n= number of seconds to wait
He needs :
G04 Fn << n= number of seconds to wait
At least that is what i understood from his post.
G04 Pn << n= number of seconds to wait
He needs :
G04 Fn << n= number of seconds to wait
At least that is what i understood from his post.
Please Log in or Create an account to join the conversation.
06 Jul 2021 11:05 #213845
by CNC4Life
Replied by CNC4Life on topic Remap G04 from P code F code
You are correct I just need to change G04 Fxx to G04 Pxx
Please Log in or Create an account to join the conversation.
06 Jul 2021 14:22 #213859
by Aciera
Replied by Aciera on topic Remap G04 from P code F code
So then you just need to swap P and F as suggested. Try:for line in f:
print(re.sub(r"G0*4\s*P\s*(\d*)",r"G04 F\1",line), end="")
for line in f:
print(re.sub(r"G0*4\s*F\s*(\d*)",r"G04 P\1",line), end="")
Please Log in or Create an account to join the conversation.
Time to create page: 0.067 seconds