FlexGui custom buttons
- Dave3891
- Away
- Senior Member
-
Less
More
- Posts: 45
- Thank you received: 4
10 Oct 2025 19:29 #336214
by Dave3891
FlexGui custom buttons was created by Dave3891
Hi,
I am working on a FlexGui for a waterjet and I want to have some custom buttons that call hal and emc functions.
I see I can import a python module and do the "from functools import partial" to get the parent, but does the parent also pass access to hal and emc?
I am trying to make a custom stop button that will turn off some hal output pins with hal.set_p() and then call emc.abort() in python so it will turn off the jet and sand when pressed. I also need to make one that will pause by setting the hal pins off and setting the motion.adaptivefeed to 0.
Any help would be appreciated
I am working on a FlexGui for a waterjet and I want to have some custom buttons that call hal and emc functions.
I see I can import a python module and do the "from functools import partial" to get the parent, but does the parent also pass access to hal and emc?
I am trying to make a custom stop button that will turn off some hal output pins with hal.set_p() and then call emc.abort() in python so it will turn off the jet and sand when pressed. I also need to make one that will pause by setting the hal pins off and setting the motion.adaptivefeed to 0.
Any help would be appreciated
Please Log in or Create an account to join the conversation.
- Dave3891
- Away
- Senior Member
-
Less
More
- Posts: 45
- Thank you received: 4
14 Oct 2025 17:42 - 14 Oct 2025 17:43 #336437
by Dave3891
Replied by Dave3891 on topic FlexGui custom buttons
For anyone else with this question, this seems to work
parent.command passes the connection to emc
parent.command passes the connection to emc
from functools import partial
import hal
def startup(parent):
parent.JetOnBtn.clicked.connect(jet_on)
parent.JetOffBtn.clicked.connect(partial(jet_off, parent))
def jet_on():
hal.set_p("lcec.0.4.out-01", "True")
print('Jet On')
def jet_off(parent):
hal.set_p("lcec.0.4.out-01", "False")
parent.command.abort()
print('Jet Off')
Last edit: 14 Oct 2025 17:43 by Dave3891.
Please Log in or Create an account to join the conversation.
Time to create page: 0.095 seconds