Run G-Code on application shutdown
12 Nov 2021 21:18 #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 or Create an account to join the conversation.
- tommylight
- Away
- Moderator
Less
More
- Posts: 19209
- Thank you received: 6438
12 Nov 2021 22:04 #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.
[HAL]
HALUI = halui
HALFILE = 7i92_7i77_7i74.hal
HALFILE = custom.hal
POSTGUI_HALFILE = postgui_call_list.hal
SHUTDOWN = shutdown.hal
Please Log in or Create an account to join the conversation.
13 Nov 2021 00:33 #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.
The following user(s) said Thank You: tommylight
Please Log in or Create an account to join the conversation.
14 Nov 2021 05:59 - 14 Nov 2021 06:05 #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
Last edit: 14 Nov 2021 06:05 by nkp.
Please Log in or Create an account to join the conversation.
14 Nov 2021 09:44 - 14 Nov 2021 09:45 #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 :
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
Last edit: 14 Nov 2021 09:45 by furynick.
Please Log in or Create an account to join the conversation.
14 Nov 2021 10:39 #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 or Create an account to join the conversation.
14 Nov 2021 16:02 #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 or Create an account to join the conversation.
15 Nov 2021 03:15 #226531
by cmorley
Replied by cmorley on topic Run G-Code on application shutdown
M2 is not remappable - currently anyways.
The following user(s) said Thank You: ikkuh
Please Log in or Create an account to join the conversation.
16 Nov 2021 06:30 #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 or Create an account to join the conversation.
01 May 2022 12:38 #241797
by mgm
Replied by mgm on topic Run G-Code on application shutdown
Where can I find the file ".axisrc"?
Please Log in or Create an account to join the conversation.
Time to create page: 0.084 seconds