Run G-Code on application shutdown

More
4 years 11 months ago #226247 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 ?

Please Log in or Create an account to join the conversation.

More
4 years 11 months ago #226248 by tommylight
Never tried this but pretty sure the Axis way will not work, maybe this will:
Code:
[HAL] HALUI = halui HALFILE = 7i92_7i77_7i74.hal HALFILE = custom.hal POSTGUI_HALFILE = postgui_call_list.hal SHUTDOWN = shutdown.hal
Notice the last line, i suppose you could add something there, but i do not know what or how.

Please Log in or Create an account to join the conversation.

More
4 years 11 months ago #226259 by cmorley
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.
The following user(s) said Thank You: tommylight

Please Log in or Create an account to join the conversation.

More
4 years 11 months ago - 4 years 11 months ago #226435 by nkp
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
Last edit: 4 years 11 months ago by nkp.

Please Log in or Create an account to join the conversation.

More
4 years 11 months ago - 4 years 11 months ago #226443 by furynick
Thank you for pointing me in the right direction.

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
Last edit: 4 years 11 months ago by furynick.

Please Log in or Create an account to join the conversation.

More
4 years 11 months ago #226447 by anfänger
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.

Please Log in or Create an account to join the conversation.

Time to create page: 0.059 seconds
Powered by Kunena Forum