¿ªÔÆÌåÓý

ctrl + shift + ? for shortcuts
© 2025 Groups.io

Re: Question about Macros and dialog box's, and or messagebox


 

¿ªÔÆÌåÓý

We can SO do this! Testing now

______________________________

Brian Barker
Engineering / Development
ArtSoft | Newfangled Solutions
Livermore Falls, Maine (USA)
Phone: 207(618)1449
Webpage: 
On 12/7/2021 2:56 PM, Gary wrote:

Here is an example of the code in the PLC
I did try the dialog in the macro but didn't seem to work it would display the dialog, but no text or buttons would display.. and i couldn't close the dialog
as far as a a semaphore and spin lock looking at the flag not sure how to implement that above my skill level i'm thinking..

Thanks gary
-------------------------------------------------------
--? M6 message
-------------------------------------------------------
local M6DialogReg = mc.mcRegGetHandle(inst,"gRegs0/M6Message")
local M6Flag = mc.mcRegGetValue(M6DialogReg)

if (M6Flag == 1) then -- and state == idle

ID_RETURN_GCODE = 1
ID_CLOSE_BUTTON = 2

-- create MyDialog1
???? MyDialog1 = wx.wxDialog (wx.NULL, wx.wxID_ANY, "M6 Manual Tool Change Avtivated", wx.wxDefaultPosition, wx.wxSize( 327,325 ), wx.wxDEFAULT_DIALOG_STYLE )
?? ? MyDialog1:SetSizeHints( wx.wxDefaultSize, wx.wxDefaultSize )

?? ? gSizer3 = wx.wxGridSizer( 0, 2, 0, 0 )

?? ? m_staticText1 = wx.wxStaticText(? MyDialog1, wx.wxID_ANY, "TURN OFF SPINDLE, then jog to a safe tool change position\n\nSwap to new tool\n\nThen migrate to the probing screen and PRESS PROBE Z\n\nOR mannual jog Z down and use a feeler gauge for Z hight\nWhen Finished move Z up to 1\" or so..\n\nOnce tool probe is finished, or feeler gauge test Complete\nTURN ON SPINDLE\n\nPRESS OK to return control back to the running G_Code\n\nPress ABORT to Stop ALL\nMachine will be disabled and Gcode Stopped", wx.wxDefaultPosition, wx.wxDefaultSize, 0 )
?? ? m_staticText1:Wrap( -1 )

?? ? gSizer3:Add(? m_staticText1, 0, wx.wxALL, 5 )
?? ? gSizer3:Add( 0, 0, 1, wx.wxEXPAND, 5 )
?? ? gSizer3:Add( 0, 0, 1, wx.wxEXPAND, 5 )
?? ? gSizer3:Add( 0, 0, 1, wx.wxEXPAND, 5 )
?? ? gSizer3:Add( 0, 0, 1, wx.wxEXPAND, 5 )
?? ? gSizer3:Add( 0, 0, 1, wx.wxEXPAND, 5 )
?? ? gSizer3:Add( 0, 0, 1, wx.wxEXPAND, 5 )
?? ? gSizer3:Add( 0, 50, 1, wx.wxEXPAND, 5 )
?? ? gSizer3:Add( 0, 0, 1, wx.wxEXPAND, 5 )
?? ? gSizer3:Add( 0, 0, 1, wx.wxEXPAND, 5 )

?? ? fgSizer1 = wx.wxFlexGridSizer( 0, 2, 0, 50 )
?? ? fgSizer1:SetFlexibleDirection( wx.wxBOTH )
?? ? fgSizer1:SetNonFlexibleGrowMode( wx.wxFLEX_GROWMODE_SPECIFIED )

?? ? m_button8 = wx.wxButton(? MyDialog1, ID_RETURN_GCODE, "OK", wx.wxDefaultPosition, wx.wxDefaultSize, 0 )
?? ? fgSizer1:Add(? m_button8, 0, wx.wxALL, 5 )
?? ?
?? ? m_button9 = wx.wxButton(? MyDialog1, ID_CLOSE_BUTTON, "Abort", wx.wxDefaultPosition, wx.wxDefaultSize, 0 )
?? ? fgSizer1:Add(? m_button9, 0, wx.wxALIGN_CENTER+wx.wxALL, 2 )

?? ? gSizer3:Add(? fgSizer1, 1, wx.wxEXPAND, 0 )

?? ? MyDialog1:SetSizer(? gSizer3 )
?? ? MyDialog1:Layout()

?? ? MyDialog1:Centre( wx.wxBOTH )
?? ? MyDialog1:Show( true )
?? ?
???? MyDialog1:Connect(ID_CLOSE_BUTTON, wx.wxEVT_COMMAND_BUTTON_CLICKED,
??? function(event)
???? MyDialog1:Destroy()
??? end)
?? ?
???? MyDialog1:Connect(ID_RETURN_GCODE, wx.wxEVT_COMMAND_BUTTON_CLICKED,
??? function(event)
???? MyDialog1:Destroy()
??? end)
??? wx.wxGetApp():MainLoop()

? ???? local rc = mc.mcRegSetValue(M6DialogReg, 0)
end

Join [email protected] to automatically receive all group messages.