Remap G04 from P code F code

More
04 Jul 2021 14:47 - 04 Jul 2021 14:48 #213692 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. 
Last edit: 04 Jul 2021 14:48 by CNC4Life.

Please Log in or Create an account to join the conversation.

More
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'.

Please Log in or Create an account to join the conversation.

More
05 Jul 2021 21:50 #213793 by andypugh
Here is a filter file that might do the job:
#! /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="")
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.
The following user(s) said Thank You: Aciera

Please Log in or Create an account to join the conversation.

More
05 Jul 2021 23:35 #213806 by tommylight
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.

Please Log in or Create an account to join the conversation.

More
06 Jul 2021 11:05 #213845 by CNC4Life
You are correct I just need to change G04 Fxx to G04 Pxx

Please Log in or Create an account to join the conversation.

More
06 Jul 2021 14:22 #213859 by Aciera
Replied by Aciera on topic Remap G04 from P code F code

for line in f:
print(re.sub(r"G0*4\s*P\s*(\d*)",r"G04 F\1",line), end="")

So then you just need to swap P and F as suggested. Try:
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.079 seconds
Powered by Kunena Forum