- GCode and Part Programs
- O Codes (subroutines) and NGCGUI
- How to pause a GCode program, run a remapped MCode, then resume GCode program
How to pause a GCode program, run a remapped MCode, then resume GCode program
14 May 2018 04:54 #110714
by stark
Hi All,
I have a 3D printer with a paste extruder (four axes: X, Y, Z, A). Sometimes paste fouls the nozzle, which can effect the quality of the print. I have remapped an MCode so that the extruder moves to a place on my build plate where it can be cleaned on foam, as below. I can run this MCode from a button I have created in Axis.
When a GCode program is being run and when I notice the nozzle is dirty, I want to be able to press the button such that the program pauses, the MCode is run, and the program resumes from where it left off. At the moment, when I press the button during a program, I get the error "Can't switch mode while mode is AUTO and interpreter is not IDLE". I wonder if someone can suggest a way I can get around this please?
Thanks very much in advance.
o<m300> sub
#1 = 0 (set first counter to zero)
#2 = -1 (set secound reversing counter)
#3 = #<_x> (remember current print coordinates)
#4 = #<_y>
#5 = #<_z>
#6 = 2 (number of wipes)
G1 X-50.000 Y50.000 Z0.000 F1200 (go to wipe tower)
G91 (change to incremental distance for G1 moves)
o100 while [#1 LT #6] (loop from 1 to value set by user in M300 command)
#1 = [#1+1] (increase first counter)
#2 = -#2 (reverse sign of second counter)
G1 X[#2*10] (wipe needle)
o100 endwhile
G90 (change to absolute distance)
G1 X[#3] Y[#4] Z[#5] (return back to print coordinates)
o<m300> endsub
M2 (end sub routine)
I have a 3D printer with a paste extruder (four axes: X, Y, Z, A). Sometimes paste fouls the nozzle, which can effect the quality of the print. I have remapped an MCode so that the extruder moves to a place on my build plate where it can be cleaned on foam, as below. I can run this MCode from a button I have created in Axis.
When a GCode program is being run and when I notice the nozzle is dirty, I want to be able to press the button such that the program pauses, the MCode is run, and the program resumes from where it left off. At the moment, when I press the button during a program, I get the error "Can't switch mode while mode is AUTO and interpreter is not IDLE". I wonder if someone can suggest a way I can get around this please?
Thanks very much in advance.
o<m300> sub
#1 = 0 (set first counter to zero)
#2 = -1 (set secound reversing counter)
#3 = #<_x> (remember current print coordinates)
#4 = #<_y>
#5 = #<_z>
#6 = 2 (number of wipes)
G1 X-50.000 Y50.000 Z0.000 F1200 (go to wipe tower)
G91 (change to incremental distance for G1 moves)
o100 while [#1 LT #6] (loop from 1 to value set by user in M300 command)
#1 = [#1+1] (increase first counter)
#2 = -#2 (reverse sign of second counter)
G1 X[#2*10] (wipe needle)
o100 endwhile
G90 (change to absolute distance)
G1 X[#3] Y[#4] Z[#5] (return back to print coordinates)
o<m300> endsub
M2 (end sub routine)
Please Log in or Create an account to join the conversation.
14 May 2018 05:28 #110716
by cmorley
Replied by cmorley on topic How to pause a GCode program, run a remapped MCode, then resume GCode program
Linuxcnc can't pause in auto mode and run other code.
(well there has been code developed to do something similar but it never got finished/integrated)
You would have to abort the program, run your code then restart your original program.
restarting linuxcnc in an existing program is also a big weakness of linuxcnc - sucess depends on the type of gcode written.
Chris M
(well there has been code developed to do something similar but it never got finished/integrated)
You would have to abort the program, run your code then restart your original program.
restarting linuxcnc in an existing program is also a big weakness of linuxcnc - sucess depends on the type of gcode written.
Chris M
Please Log in or Create an account to join the conversation.
14 May 2018 05:32 #110717
by cmorley
Replied by cmorley on topic How to pause a GCode program, run a remapped MCode, then resume GCode program
You could possible do something along these lines with the moveoff component.
It's a kinda hacky way to do what you want but....
linuxcnc.org/docs/2.7/html/config/moveoff.html
Chris M
It's a kinda hacky way to do what you want but....
linuxcnc.org/docs/2.7/html/config/moveoff.html
Chris M
Please Log in or Create an account to join the conversation.
14 May 2018 21:31 #110743
by stark
Replied by stark on topic How to pause a GCode program, run a remapped MCode, then resume GCode program
Thanks Chris,
It might be easier to incorporate the MCode into the GCode program so that there is regular wiping, say at times when my extruder lifts to move to another point on the print.
I appreciate your help.
It might be easier to incorporate the MCode into the GCode program so that there is regular wiping, say at times when my extruder lifts to move to another point on the print.
I appreciate your help.
Please Log in or Create an account to join the conversation.
15 May 2018 21:22 #110774
by cmorley
Replied by cmorley on topic How to pause a GCode program, run a remapped MCode, then resume GCode program
This is where block delete would work great.. unfortunately linuxcnc is weak there too .. it doesn't respond to block delete changes after it starts running..something I've meant to look into but never got too.
The inner workings of the motion controller is a hard pill to swallow.
There probably is a way to make a subroutine that checks a HAL pin state..then you could just add that subroutine at appropriate places - not elegent but workable.
Chris M
The inner workings of the motion controller is a hard pill to swallow.
There probably is a way to make a subroutine that checks a HAL pin state..then you could just add that subroutine at appropriate places - not elegent but workable.
Chris M
Please Log in or Create an account to join the conversation.
22 May 2018 01:43 #111007
by stark
Replied by stark on topic How to pause a GCode program, run a remapped MCode, then resume GCode program
Sorry for the late reply Chris,
We've talked amongst ourselves in the group and decided it's probably more practical to regularly, automatically wipe by placing MCode into the GCode at regular intervals (at layer changes for example), which will free us to walk away for the hour it might take to print something, rather than sit there and assiduously check for fouling and manually press a button. It will probably take a little trial and error to figure out where in the GCode is best to place the wipe sequence, but that's ok. Once again, thanks for your help.
We've talked amongst ourselves in the group and decided it's probably more practical to regularly, automatically wipe by placing MCode into the GCode at regular intervals (at layer changes for example), which will free us to walk away for the hour it might take to print something, rather than sit there and assiduously check for fouling and manually press a button. It will probably take a little trial and error to figure out where in the GCode is best to place the wipe sequence, but that's ok. Once again, thanks for your help.
Please Log in or Create an account to join the conversation.
- GCode and Part Programs
- O Codes (subroutines) and NGCGUI
- How to pause a GCode program, run a remapped MCode, then resume GCode program
Time to create page: 0.070 seconds