Run G-Code on application shutdown

More
12 Nov 2021 21:18 #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
12 Nov 2021 22:04 #226248 by tommylight
Never tried this but pretty sure the Axis way will not work, maybe this will:
[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
13 Nov 2021 00:33 #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
14 Nov 2021 05:59 - 14 Nov 2021 06:05 #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: 14 Nov 2021 06:05 by nkp.

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

More
14 Nov 2021 09:44 - 14 Nov 2021 09:45 #226443 by furynick
Thank you for pointing me in the right direction.

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.

More
14 Nov 2021 10:39 #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.

More
14 Nov 2021 16:02 #226487 by cakeslob
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?"

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

More
15 Nov 2021 03:15 #226531 by cmorley
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.

More
16 Nov 2021 06:30 #226627 by furynick
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.

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

More
01 May 2022 12:38 #241797 by mgm
Where can I find the file ".axisrc"?

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

Time to create page: 0.195 seconds
Powered by Kunena Forum