Hello Guest it is April 28, 2024, 04:00:22 AM

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Bill_O

281
Mach4 General Discussion / Re: Mach4 Lua for Dummies
« on: August 04, 2020, 12:17:43 PM »
new version

282
Mach4 General Discussion / Re: Cycle Time Display
« on: August 04, 2020, 09:25:53 AM »
Here is a simple fix to the plc in mach to keep the time until you click on cycle start again.

Code: [Select]
-------------------------------------------------------
--  Cycle time label update
-------------------------------------------------------
--Requires a static text box named "CycleTime" on the screen
if (machEnabled == 1) then
local running = mc.mcCntlIsInCycle(inst)
if (running == 1) then
local cycletime = mc.mcCntlGetRunTime(inst, time)
scr.SetProperty("CycleTime", "Label", SecondsToTime(cycletime))
end
end


283
Mach4 General Discussion / Re: Custom m7
« on: August 03, 2020, 04:42:47 PM »
Sorry all that i did not post this before.
It is functioning well.

Code: [Select]
function m7()
local inst = mc.mcGetInstance()
--Get Mist On and Mister Auto handles
local hMist = mc.mcSignalGetHandle(inst, mc.OSIG_MISTON)
local hreg = mc.mcRegGetHandle(inst, 'iRegs0/MisterAuto')
--Get Mister Auto value
local MistVal = mc.mcRegGetValue(hreg)
if (MistVal == 0) then
mc.mcSignalSetState(hMist, 0)
--wx.wxMessageBox('Mist OFF')
else
mc.mcSignalSetState(hMist, 1)
--wx.wxMessageBox('Mist ON')
end
end
if (mc.mcInEditor() == 1) then
m7()
end

284
Mach4 General Discussion / Re: spindle dwell before run
« on: August 03, 2020, 04:39:52 PM »
devinw,

I ended up making a custom m3.
This has some extra things in it for my machine but it might help.

Bill

Code: [Select]
function m3()
local inst = mc.mcGetInstance()
--Get Spindle On and Spindle Auto handles
local hSpin = mc.mcSignalGetHandle(inst, mc.OSIG_SPINDLEON)
local hreg = mc.mcRegGetHandle(inst, 'iRegs0/SpindleAuto')
--Get spindle on state
local SpinOn = mc.mcSignalGetState(hSpin)
--Get Spindle Auto value
local SpinVal = mc.mcRegGetValue(hreg)
if (SpinVal == 0) then
mc.mcSignalSetState(hSpin, 0)
--wx.wxMessageBox('Spindle OFF')
else
if (SpinOn == 0) then
mc.mcSignalSetState(hSpin, 1)
wx.wxMilliSleep(5500)
--wx.wxMessageBox('Spindle ON')
end
end
end
if (mc.mcInEditor() == 1) then
m3()
end

285
Mach4 General Discussion / Re: loop help
« on: July 31, 2020, 03:07:26 PM »
Steve,

I had done that and it still did not work but it did the last time I did it.
I am beginning to think I did not restart Mach4 after changing.

Bill

286
Mach4 General Discussion / Re: loop help
« on: July 30, 2020, 06:02:45 PM »
Sergio,

This might help.
It goes over several basic things.

https://www.machsupport.com/forum/index.php?topic=43260.0

Bill

287
Mach4 General Discussion / Re: Custom m7
« on: July 30, 2020, 01:39:34 PM »
MN300
I have tried both but will look at that thread and try again.
Thanks,
Bill

288
Mach4 General Discussion / Custom m7
« on: July 30, 2020, 10:57:24 AM »
I have a custom m7 that i wrote.
When the gcode gets to M07 it does not even go into the macro.
Is there a setting I need to change to use the custom macro instead of the standard?

Code: [Select]
function M07()
--wx.wxMessageBox('In M07')
mc.mcCntlSetLastError(inst, "In M07")
local inst = mc.mcGetInstance()
--Get Mist On and Mister Auto handles
local hMist = mc.mcSignalGetHandle(inst, mc.OSIG_MISTON)
local hreg = mc.mcRegGetHandle(inst, 'iRegs0/MisterAuto')
--Get Mister Auto value
local MistVal = mc.mcRegGetValue(hreg)
if (MistVal == 0) then
mc.mcSignalSetState(hMist, 0)
--wx.wxMessageBox('Mist OFF')
else
mc.mcSignalSetState(hMist, 1)
--wx.wxMessageBox('Mist ON')
end
end
if (mc.mcInEditor() == 1) then
M07()
end

289
Mach4 General Discussion / Re: loop help
« on: July 30, 2020, 09:18:27 AM »
jbuehn,

That works great.
Thanks for the help.

Bill

290
Mach4 General Discussion / Re: loop help
« on: July 29, 2020, 10:55:51 AM »
Well I could not get the original to work.
It went in the loop but did not change the output states.

I tried using NextHandle.
It is not going into the loop.

Once again I am sure it is a format error but I have tried all that look possible to me.
Here is the last code.

HMCSIG, OutputSig = 0
   while (mcSignalGetNextHandle(inst, SIG_TYPE_OUTPUT, OutputSig, 63)) do
      mc.mcSignalSetState(OutputSig, 0)
      wx.wxMessageBox("In the loop")
   end


Bill