- GCode and Part Programs
- G&M Codes
- Will the remapped code be executed first when the G code file is loaded?
Will the remapped code be executed first when the G code file is loaded?
01 Nov 2021 07:53 #224854
by chen1234
When I tested the G code, I found that writing the remapping code in the G code file, the remapping code will be executed first when the file is loaded, and I did not click to execute it.I don't understand how this is caused, hope someone can help me.Thank you in advance, here is my configuration and G code:
Attachments:
Please Log in or Create an account to join the conversation.
01 Nov 2021 22:25 #224924
by andypugh
Replied by andypugh on topic Will the remapped code be executed first when the G code file is loaded?
The code is run-through in simulation mode when the file is loaded to generate the graphical preview.
You can choose to exclude some code from execution if this causes a problem:
See #<_task>
linuxcnc.org/docs/2.8/html/gcode/overvie...ub:system-parameters
You can choose to exclude some code from execution if this causes a problem:
See #<_task>
linuxcnc.org/docs/2.8/html/gcode/overvie...ub:system-parameters
Please Log in or Create an account to join the conversation.
02 Nov 2021 08:21 #224963
by chen1234
Replied by chen1234 on topic Will the remapped code be executed first when the G code file is loaded?
Thank you for your answer, I solved the problem that it will be executed when the file is loaded. But I encountered a new problem: I used python to remap a G code: G02.1, its function is to assign the value of the parameter to another executable program. But after I load the G code file, it will be executed immediately when I click Start, and it is not executed in the order of the G code file. What should I do to make the remapped code execute in the order in the file? Thanks in advance, here is my code:The code is run-through in simulation mode when the file is loaded to generate the graphical preview.
You can choose to exclude some code from execution if this causes a problem:
See #<_task>
linuxcnc.org/docs/2.8/html/gcode/overvie...ub:system-parameters
Attachments:
Please Log in or Create an account to join the conversation.
04 Nov 2021 20:47 #225264
by andypugh
Replied by andypugh on topic Will the remapped code be executed first when the G code file is loaded?
I wonder if the Python storage class being used is not necessarily an ordered list?
Please Log in or Create an account to join the conversation.
05 Nov 2021 01:01 - 05 Nov 2021 01:06 #225320
by chen1234
Replied by chen1234 on topic Will the remapped code be executed first when the G code file is loaded?
I solved the order problem because the remapping code cannot be executed in order, I added yield INTERP_EXECUTE_FINISH. Now it can be executed in the order I wrote, but a new problem has arisen. I can’t get this remapping code to execute the function completely. It will execute the next line of G Code. The function of my remapping code is to pass parameters to the executable program .cpp. The executable program controls the movement of the galvanometer, but cannot make the galvanometer work complete before executing the next line of g code. That is, my galvanometer motion may not be completed yet, and cnc went to execute the next line of G code.Some people say that I need to return to INTERP_EXECUTE_FINISH, but I feel very confused when using it and cannot return it normally. I hope someone can help me. Thanks in advance, here is my code:
Attachments:
Last edit: 05 Nov 2021 01:06 by chen1234.
Please Log in or Create an account to join the conversation.
11 Dec 2021 20:59 #228888
by 93xshang
Replied by 93xshang on topic Will the remapped code be executed first when the G code file is loaded?
Not sure if you've figured this out, but the issue you are having is because you can't have bothandin the same remapped function. Remove the return lines from your functions and see if it will work. For more information checkout #9.4.5 in
linuxcnc.org/docs/2.6/html/remap/structu...ntions_ngc_to_python
return
yield
Please Log in or Create an account to join the conversation.
- GCode and Part Programs
- G&M Codes
- Will the remapped code be executed first when the G code file is loaded?
Time to create page: 0.259 seconds