Hello Guest it is April 26, 2024, 04:31:28 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 - DazTheGas

321
Mach4 General Discussion / Re: Mach 4 Bug showing in M6 Script
« on: December 22, 2016, 04:38:26 PM »
This could answer your question

4) Changed handling of T codes in interpreter so that
   multiple T codes on individual lines before an M6
   is issued will be handled gracefully. Some CAM programs
   seem to like to issue T codes when no tool changes are
   actually happening. Multiple T codes in one block is
   still an error.

DazTheGas

322
Mach4 Plugins / Re: mcX360 Plugin for Lua
« on: December 22, 2016, 10:03:22 AM »
X360_Timer:Stop() this will be explained in next video, when you start a timer you also need to disable it when shutting down mach4 or this can cause the gui to lock up.

DazTheGas

323
Mach4 General Discussion / Re: Logging M4/ESS probe events
« on: December 22, 2016, 04:38:10 AM »
Try posting an example of what your running and the result, then include an example of what you should have. Its very difficult to imagine what someone requires. (well it is for me)

DazTheGas

324
Mach4 General Discussion / Re: Logging M4/ESS probe events
« on: December 22, 2016, 03:50:26 AM »
Im having either dejavous or i have gone back in time, but thought you had solved this??

DazTheGas

325
Mach4 Plugins / Re: mcX360 Plugin for Lua
« on: December 20, 2016, 04:21:46 PM »
Just noticed with that code i have used "inst" but needs to be "mInst" to fit with rest of code.

DazTheGas

326
Mach4 Plugins / Re: mcX360 Plugin for Lua
« on: December 20, 2016, 03:53:29 PM »
You would be better using the signals for jogging.

 
Code: [Select]
DPad_Panel:Connect(wx.wxEVT_TIMER, function (event)

  -- Inc Moves
if GetXin("Btn_X") == 1 and AIState == false then
mc.mcSignalSetState (mc.mcSignalGetHandle (inst, mc.OSIG_JOG_CONT), 0)
mc.mcSignalSetState (mc.mcSignalGetHandle (inst, mc.OSIG_JOG_INC), 1)
        AIState = true
end
if GetXin("Btn_X") == 0 and AIState == true then
AIState = false
end
-- Cont Moves
if GetXin("Btn_START") == 1 and CJIState == false then
                mc.mcSignalSetState (mc.mcSignalGetHandle (inst, mc.OSIG_JOG_INC), 0)
mc.mcSignalSetState (mc.mcSignalGetHandle (inst, mc.OSIG_JOG_CONT), 1)

        CJIState = true
end
if GetXin("Btn_START") == 0 and CJIState == true then
CJIState = false
end
 
-- Y++
if GetXin("DPad_UP") == 1 and YPState == false then
mc.mcSignalSetState (mc.mcSignalGetHandle (inst, mc.ISIG_JOGYP), 1)
YPState = true
end
if GetXin("DPad_UP") == 0 and YPState == true then
mc.mcSignalSetState (mc.mcSignalGetHandle (inst, mc.ISIG_JOGYP), 0)
YPState = false
end

-- Y--
if GetXin("DPad_DOWN") == 1 and YNState == false then
mc.mcSignalSetState (mc.mcSignalGetHandle (inst, mc.ISIG_JOGYN), 1)
YNState = true
end
if GetXin("DPad_DOWN") == 0 and YNState == true then
mc.mcSignalSetState (mc.mcSignalGetHandle (inst, mc.ISIG_JOGYN), 0)
YNState = false
end
end)

DazTheGas

327
Mach4 General Discussion / Re: Understanding Lua
« on: December 20, 2016, 03:38:23 PM »
A big oooooops from me  ??? ??? ??? ??? :o :o :'(,  just had a rather interesting debug session and yep all works well.

It all boils down to forgetting what you did previously, I already have a macro functions file in my macro directory and forgot so by adding the load_modules.mcs file overwrites my "package.path" with the one containing the .lua extension.

my package.path normally consists of both mcs and lua

Code: [Select]
package.path = path .. "\\Profiles\\" .. profile .. "\\Modules\\?.lua;" .. path .. "\\Modules\\?.lua;"
package.path = package.path ..path .. "\\Profiles\\" .. profile .. "\\Modules\\?.mcs;" .. path .. "\\Modules\\?.mcs;"

DazTheGas

328
Mach4 Plugins / Re: mcX360 Plugin for Lua
« on: December 20, 2016, 03:02:19 PM »
Firstly i must erge you to remove the code from the plc and back into a panel by itself, you will have unlimited problems with your machine and could result in very bad things.

I will write you a small bit of cose to get you on the way.

if wanting to use the buttonjogmode function then instead you can also use the signals for Xplus and Xneg etc

DazTheGas

329
Mach4 General Discussion / Re: Understanding Lua
« on: December 19, 2016, 06:42:57 PM »
Yep changing the code to below without the messagebox worked fine using mc.mcCntlSetLastError(inst,Message) instead

Code: [Select]
local mcUserScript = {}
local inst = mc.mcGetInstance()

function mcUserScript.UserMessage(Message)
if (Message == nil) then --No message was passed
Message = "No message passed" --If no message is passed this will be the default message
end
--wx.wxMessageBox(Message)
mc.mcCntlSetLastError(inst,Message)
end

return mcUserScript -- Module End

with this now working it should give you something to play with ;-)

DazTheGas

330
Mach4 General Discussion / Re: Understanding Lua
« on: December 19, 2016, 06:28:39 PM »
This is where I have place files

C:\Mach4Hobby\Modules\mcUserScript.mcs

Code: [Select]
local mcUserScript = {}

function mcUserScript.UserMessage(Message)
if (Message == nil) then --No message was passed
Message = "No message passed" --If no message is passed this will be the default message
end
wx.wxMessageBox(Message)
end

return mcUserScript -- Module End

both the m110.mcs and load_modules.mcs goes in your profiles own macro directory

load_modules.mcs

Code: [Select]
local inst = mc.mcGetInstance()
local profile = mc.mcProfileGetName(inst)
local path = mc.mcCntlGetMachDir(inst)
   
package.path = path .. "\\Profiles\\" .. profile .. "\\Modules\\?.lua;" .. path .. "\\Modules\\?.lua;"

package.loaded.mcUserScript = nil
us = require "mcUserScript"

m110.mcs

Code: [Select]
function m110()

us.UserMessage("This is my message from m110")
 
  end

if (mc.mcInEditor() == 1) then
 m110()
end


This is working within the mdi no problem but still debugging why its not working when called from within gcode, my bet is its something to do with the messagebox not being able to show in the gui from gcode. when running gcode its run within another lua instance that does not have access to the lua instance that is within the gui.

DazTheGas