G-code decoding problem?
- chen1234
- Topic Author
- Offline
- Senior Member
Less
More
- Posts: 58
- Thank you received: 2
15 Nov 2021 03:16 #226532
by chen1234
G-code decoding problem? was created by chen1234
Hi everyone, I ran into a problem while trying to make a custom M code.
I need to implement a "decoding pause" function.
Its function on an NC device is probably: when G code is decoded, the "macro variable assignment" thread and the "G code running" thread can be paused synchronously.
When a custom M code (such as M100) is encountered, the "decoding pause" function will be realized, the PLC will execute the operation and feedback the completion status, and then click "start" or "next" to continue decoding.
Does linuxcnc have this function? Or is there any way to achieve this function?
Thank you all in advance, my use of Google Translate may be inaccurate.
I need to implement a "decoding pause" function.
Its function on an NC device is probably: when G code is decoded, the "macro variable assignment" thread and the "G code running" thread can be paused synchronously.
When a custom M code (such as M100) is encountered, the "decoding pause" function will be realized, the PLC will execute the operation and feedback the completion status, and then click "start" or "next" to continue decoding.
Does linuxcnc have this function? Or is there any way to achieve this function?
Thank you all in advance, my use of Google Translate may be inaccurate.
Please Log in or Create an account to join the conversation.
- Henk
- Offline
- Platinum Member
Less
More
- Posts: 395
- Thank you received: 80
15 Nov 2021 04:20 #226537
by Henk
Replied by Henk on topic G-code decoding problem?
Custom Modes execute typical Hal commands using a bash script. Not sure if it will execute a g code sub. I think to do that you are better off remapping the m code.
code. Search for linuxcnc remap
you can use a simple subroutine call o<prog_name> call to call a g code subroutine. In this sub, m66 can be used to wait on input from the PLC. After that M0 will pause the program until you press resume or step.
Henk
code. Search for linuxcnc remap
you can use a simple subroutine call o<prog_name> call to call a g code subroutine. In this sub, m66 can be used to wait on input from the PLC. After that M0 will pause the program until you press resume or step.
Henk
The following user(s) said Thank You: chen1234
Please Log in or Create an account to join the conversation.
- chen1234
- Topic Author
- Offline
- Senior Member
Less
More
- Posts: 58
- Thank you received: 2
15 Nov 2021 07:26 #226548
by chen1234
Replied by chen1234 on topic G-code decoding problem?
Thank you for your answer,
I will try to remap the code and use M66/M0.
I asked my colleague again, and he said: The function of "Decoding Pause" is: the decoding system will pause decoding after it reaches M100.
After the NC finishes executing M100, it informs the decoding system to start to continue decoding.
The M code will be sent to the PLC, and some auxiliary operations will be completed through the PLC.
So what is the way linuxcnc parses G code?
Will there be a thread for "macro variable assignment" to execute?
If not, how to realize the function of decoding pause?
Or is this feature necessary for Linuxcnc?
Hope someone can give me some pointers,
thank you.
I will try to remap the code and use M66/M0.
I asked my colleague again, and he said: The function of "Decoding Pause" is: the decoding system will pause decoding after it reaches M100.
After the NC finishes executing M100, it informs the decoding system to start to continue decoding.
The M code will be sent to the PLC, and some auxiliary operations will be completed through the PLC.
So what is the way linuxcnc parses G code?
Will there be a thread for "macro variable assignment" to execute?
If not, how to realize the function of decoding pause?
Or is this feature necessary for Linuxcnc?
Hope someone can give me some pointers,
thank you.
Please Log in or Create an account to join the conversation.
- Henk
- Offline
- Platinum Member
Less
More
- Posts: 395
- Thank you received: 80
15 Nov 2021 15:39 #226584
by Henk
Replied by Henk on topic G-code decoding problem?
I'm the remap python files there is a way to make the interpreter to wait until your code has completed. I don't know the detail, but it should be in the docs.
I Don't know the bash script that well, but I'm sure you will be able to do what you want using that method. It pauses the g code until your bash script exits. It may be a simpler sollution.
I Don't know the bash script that well, but I'm sure you will be able to do what you want using that method. It pauses the g code until your bash script exits. It may be a simpler sollution.
The following user(s) said Thank You: chen1234
Please Log in or Create an account to join the conversation.
- chen1234
- Topic Author
- Offline
- Senior Member
Less
More
- Posts: 58
- Thank you received: 2
16 Nov 2021 01:14 #226617
by chen1234
I used this method in the remapping code, it can wait for my code to complete before continuing to the next G code.
I still have a question, (maybe I can't express it clearly when I use translation software).
How does LInuxcnc decode the G code file, which can be seen in that file?
Replied by chen1234 on topic G-code decoding problem?
Thanks Henk,I'm the remap python files there is a way to make the interpreter to wait until your code has completed. I don't know the detail, but it should be in the docs.
I Don't know the bash script that well, but I'm sure you will be able to do what you want using that method. It pauses the g code until your bash script exits. It may be a simpler sollution.
I used this method in the remapping code, it can wait for my code to complete before continuing to the next G code.
def g021(self, **words):
yield INTERP_EXECUTE_FINISH
if self.task:
list = []
for key in words:
MESSAGE("word '%s' = %f" % (key, words[key]))
list.append(words[key])
res = str(list[0])+' '+str(list[1])+' '+str(list[2])
main = "/home/.../linuxcnc/...../BBB" #Executable path
out = os.system(main +' '+ res)
I still have a question, (maybe I can't express it clearly when I use translation software).
How does LInuxcnc decode the G code file, which can be seen in that file?
Please Log in or Create an account to join the conversation.
Time to create page: 0.055 seconds