Hello Guest it is April 23, 2024, 05:16:49 AM

Author Topic: Mach 4 Lua - YES/NO OK/Cancel messagebox  (Read 1392 times)

0 Members and 1 Guest are viewing this topic.

Offline Rimmel

*
  •  208 208
    • View Profile
Mach 4 Lua - YES/NO OK/Cancel messagebox
« on: May 17, 2022, 04:29:41 PM »
Mach 4 Lua - YES/NO OK/Cancel messagebox.  Is there such a thing?

thanks
Re: Mach 4 Lua - YES/NO OK/Cancel messagebox
« Reply #2 on: May 18, 2022, 12:44:43 AM »
Hi,
Mach4 has .wxWidgets which has all those dialogue boxes and so, so, much more.

Easiest idea is to find a piece of code that has the widget you want, copy and paste to your code and edit to suit your application.

Craig
'I enjoy sex at 73.....I live at 71 so its not too far to walk.'
Re: Mach 4 Lua - YES/NO OK/Cancel messagebox
« Reply #3 on: May 18, 2022, 02:29:47 PM »
You can use wx.wxMessageBox

It can be customised to suit.

wx.wxMessageBox("Main text", "title text", wx.wxYES_NO)     --Message box with Yes/No
wx.wxMessageBox("Main text", "title text", wx.wxOK + wx.wxCANCEL)    --Message box with Ok/Cancel 

You can also change the icon using wx.wxICON_INFORMATION, wx.wxICON_ERROR, wx.wxICON_WARNING, wx.wxICON_NONE

For example
wx.wxMessageBox("Main text", "title text", wx.wxYES_NO + wx.wxICON_ERROR)

When the user presses one of the button on the dialog it returns what they pressed

rc = wx.wxMessageBox("Main text", "title text", wx.wxYES_NO)
if (rc == wx.wxYES) then             --If dialog had Ok or Cancel you would used wx.wxOK or wx.wxCANCEL here depending on what you wanted to do
      --user pressed Yes
else
      --user pressed no or closed the dialog
end

Offline Rimmel

*
  •  208 208
    • View Profile
Re: Mach 4 Lua - YES/NO OK/Cancel messagebox
« Reply #4 on: May 18, 2022, 03:06:28 PM »
Brilliant - thank you again.

Do you know if mach4 has a shutdown script? e.g. for setting a servo off command before cutting the charge pump.

thanks
Re: Mach 4 Lua - YES/NO OK/Cancel messagebox
« Reply #5 on: May 18, 2022, 04:14:08 PM »
Hi,

Quote
Do you know if mach4 has a shutdown script? e.g. for setting a servo off command before cutting the charge pump.

Why bother with a charge pump? Its so last century. I've never used a charge pump, with either Mach3 nor Mach4.

You should arrange Mach such that if it fails or crashes then all critical outputs are off, PWM to the spindle for example.

All servos/steppers should have an Enable signal to each. It may well be that Mach/ESS/BoB produces just one Enable signal and that one signal is applied to ALL
the servos/steppers. An Estop will de-energise the Mach/ESS/BoB Enable signal and all servos/steppers will stop.

You do not need some specialised shut down script, just sensible use of the Enable signal or signals.

Craig
'I enjoy sex at 73.....I live at 71 so its not too far to walk.'

Offline Rimmel

*
  •  208 208
    • View Profile
Re: Mach 4 Lua - YES/NO OK/Cancel messagebox
« Reply #6 on: May 19, 2022, 05:26:08 AM »
Hi,

Quote
Do you know if mach4 has a shutdown script? e.g. for setting a servo off command before cutting the charge pump.

Why bother with a charge pump? Its so last century. I've never used a charge pump, with either Mach3 nor Mach4.

You should arrange Mach such that if it fails or crashes then all critical outputs are off, PWM to the spindle for example.

All servos/steppers should have an Enable signal to each. It may well be that Mach/ESS/BoB produces just one Enable signal and that one signal is applied to ALL
the servos/steppers. An Estop will de-energise the Mach/ESS/BoB Enable signal and all servos/steppers will stop.

You do not need some specialised shut down script, just sensible use of the Enable signal or signals.

Craig

I thought that is exactly what a cherge pump did? If something happens to the BoB then the charge pump signal turns off?
Re: Mach 4 Lua - YES/NO OK/Cancel messagebox
« Reply #7 on: May 19, 2022, 03:12:52 PM »
Hi,
in the early days of Mach with a parallel port it was possible that outputs of the parallel port could be high despite the fact that the PC
was not running Mach yet. That might potentially allow the machine to move/run without Mach being in control, a dangerous situation.
Ergo a charge pump. The charge pump could only run and therefore enable the machine if Mach were up and running.

All of my outputs are low when the ESS/BoB is unpowered, or is powering up but prior to Mach seizing control of the ESS, and so the machine will
not move nor the spindle run until Mach is in control. Thus the safety of the machine is assured without the need for a charge pump, and I would
recommend you do the same.

With the ESS/BoB powered down what are the state of the outputs?
With the ESS/BoB powered up but not under Mach control what are the state of the outputs?

The most critical outputs for safeties sake are the ENABLE signal (or signals if you have one per axis say) and the spindle ON/OFF signal.
Provided they both remain in inactive state while un-powered, or powering up but not under Mach control, then the servos cannot move
nor the spindle operate. Its not that hard. I think with a charge pump and shut down scripts you are making work for yourself.

Craig
'I enjoy sex at 73.....I live at 71 so its not too far to walk.'