- Posts: 33
- Thank you received: 0
Run G-Code on application shutdown
4 years 11 months ago #226247
by furynick
Run G-Code on application shutdown was created by furynick
I rapidly search on axis doc but didn't find a way to run g-code on application shutdown to park spindle for ex.
I guess there is some trick in .axisrc with something likeroot_window.tk.call("wm","protocol",".","WM_DELETE_WINDOW","destroy .")but don't know which syntax to use, does anybody have an idea ?
I guess there is some trick in .axisrc with something likeroot_window.tk.call("wm","protocol",".","WM_DELETE_WINDOW","destroy .")but don't know which syntax to use, does anybody have an idea ?
Please Log in to join the conversation.
- tommylight
-
- Away
- Administrator
-
Less
More
- Posts: 22012
- Thank you received: 3
4 years 11 months ago #226248
by tommylight
Replied by tommylight on topic Run G-Code on application shutdown
Never tried this but pretty sure the Axis way will not work, maybe this will:
Notice the last line, i suppose you could add something there, but i do not know what or how.
Code:
[HAL]
HALUI = halui
HALFILE = 7i92_7i77_7i74.hal
HALFILE = custom.hal
POSTGUI_HALFILE = postgui_call_list.hal
SHUTDOWN = shutdown.hal
Please Log in to join the conversation.
4 years 11 months ago #226259
by cmorley
Replied by cmorley on topic Run G-Code on application shutdown
That will only run HAL commands on shutdown.
It's gui screen specific and probably undocumented or not accounted for.
Sounds li8ke you sre using AXIS and that would be not accounted for.
The .axisrc would be the way to try besides changing the source code.
Others like QtDragon or QtAxis (aka Qtvcp) would be a bit easier because they cater to modifications.
It's gui screen specific and probably undocumented or not accounted for.
Sounds li8ke you sre using AXIS and that would be not accounted for.
The .axisrc would be the way to try besides changing the source code.
Others like QtDragon or QtAxis (aka Qtvcp) would be a bit easier because they cater to modifications.
Please Log in to join the conversation.
4 years 11 months ago #226435
by nkp
Replied by nkp on topic Run G-Code on application shutdown
axis.py trying to change the function like this :
def General_Halt():
text = _("The machine will be parked.\nDo you mind?")
if not root_window.tk.call("nf_dialog", ".error", _("Confirm Close"), text, "warning", 1, _("Yes"), _("No")):
print "o<before_go>call"
ensure_mode(linuxcnc.MODE_MDI)
c.wait_complete()
c.mdi("o<before_go>call")
c.wait_complete()
root_window.destroy()
=====================================================
checked with such a file
before_go.ngc:
o<before_go>sub
g0 x111 y222
G10 L20 P1 X1.5
o<before_go>endsub
m2
def General_Halt():
text = _("The machine will be parked.\nDo you mind?")
if not root_window.tk.call("nf_dialog", ".error", _("Confirm Close"), text, "warning", 1, _("Yes"), _("No")):
print "o<before_go>call"
ensure_mode(linuxcnc.MODE_MDI)
c.wait_complete()
c.mdi("o<before_go>call")
c.wait_complete()
root_window.destroy()
=====================================================
checked with such a file
before_go.ngc:
o<before_go>sub
g0 x111 y222
G10 L20 P1 X1.5
o<before_go>endsub
m2
Please Log in to join the conversation.
4 years 11 months ago #226443
by furynick
Replied by furynick on topic Run G-Code on application shutdown
Thank you for pointing me in the right direction.
I achieved that goal with the following in .axisrc :
And the macro as suggested
I achieved that goal with the following in .axisrc :
Code:
def Custom_Halt():
text = _("The machine will be parked.\nDo you mind?")
if not root_window.tk.call("nf_dialog", ".error", _("Confirm Close"), text, "warning", 1, _("Yes"), _("No")):
root_window.tk.call("wm","protocol",".","WM_DELETE_WINDOW","destroy .")
ensure_mode(linuxcnc.MODE_MDI)
c.wait_complete()
c.mdi("o<park>call")
c.wait_complete()
General_Halt()
root_window.protocol("WM_DELETE_WINDOW", Custom_Halt)
And the macro as suggested
Please Log in to join the conversation.
4 years 11 months ago #226447
by anfänger
Replied by anfänger on topic Run G-Code on application shutdown
Just a stupid question, would it be more useful to park the spindle with a remap of m2 / M30?
I usually stop the machine before shutting down linuxcnc. Then none of the drives would have power to park the spindle.
I was one searching for something similar and yet quite different. I antes to send a signal to my air compressor to power off, when leaving linuxcnc. In the end I used a python hal component and send the signal on exit.
I usually stop the machine before shutting down linuxcnc. Then none of the drives would have power to park the spindle.
I was one searching for something similar and yet quite different. I antes to send a signal to my air compressor to power off, when leaving linuxcnc. In the end I used a python hal component and send the signal on exit.
Please Log in to join the conversation.
4 years 11 months ago #226487
by cakeslob
Replied by cakeslob on topic Run G-Code on application shutdown
As I was reading the thread, I was thinking the same thing, it would be less surprising, and yeah I also usually turn off everything before I close. Thats how the machine at my work does it, not remapped m2, but remapped custom gcode that parks everything right before m2
That being said, good stuff nkp, lol I like that" Do you mind?"
That being said, good stuff nkp, lol I like that" Do you mind?"
Please Log in to join the conversation.
4 years 11 months ago #226531
by cmorley
Replied by cmorley on topic Run G-Code on application shutdown
M2 is not remappable - currently anyways.
Please Log in to join the conversation.
4 years 11 months ago #226627
by furynick
Replied by furynick on topic Run G-Code on application shutdown
In my case I can't stop field power before shutting down LxCNC, my 7i76e throw a power error in that case.
I can certainly update your post-processor to add a remapped M100 juste before M2 to do that stuff.
I can certainly update your post-processor to add a remapped M100 juste before M2 to do that stuff.
Please Log in to join the conversation.
Time to create page: 0.108 seconds
