671
Mach4 General Discussion / Re: well that's a Screwie Screenset.....having fun with the screen editor
« on: October 23, 2015, 07:31:23 PM »
Where is Screwie??
Daz
Daz
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.
on this line... "local Carousel = mc.mcSignalSetState (mc.mcSignalGetHandle (inst, mc.OSIG_OUTPUT1),1)" You have combined SetState with GetHandle just by using "( )"? Is this correct?
local inst = mc.mcGetInstance()
local Carousel = mc.mcSignalSetState (mc.mcSignalGetHandle (inst, mc.OSIG_OUTPUT1),1)
mc.mcCntlSetLastError(inst, "Carousel Moving Forward")
mc.mcSignalWait(inst, mc.ISIG_INPUT1, mc.WAIT_MODE_HIGH, 10)
mc.mcSignalSetState (mc.mcSignalGetHandle (inst, mc.OSIG_OUTPUT1),0)
function M6()
local inst = mc.mcGetInstance();
local selectedtool = mc.mcToolGetSelected(inst)
local currenttool = mc.mcToolGetCurrent(inst)
local xstart = mc.mcAxisGetPos(inst,0)
local ystart = mc.mcAxisGetPos(inst,1)
if selectedtool == currenttool then
return
mc.mcCntlSetLastError(inst, "ToolChange Activated But Not Required")
else
mc.mcCntlGcodeExecuteWait(inst,"G90 G53 G0 Z0.0 \n X14 Y30")
wx.wxMessageBox("Please turn off spindle and click ok to continue") --can be removed if required
RunProbe(currenttool)
local toolz = mc.mcAxisGetPos(inst,2)
mc.mcCntlGcodeExecuteWait(inst,"G90 G53 G0 Z0.0")
local changetoo = mc.mcToolGetDesc(inst,selectedtool)
wx.wxMessageBox("Please change to tool number "..selectedtool.." "..changetoo.." and press ok to continue")
mc.mcCntlGcodeExecuteWait(inst,"G90 G53 G0 X14 Y30")
RunProbe(selectedtool)
mc.mcAxisSetPos(inst, 2 , toolz)
mc.mcCntlGcodeExecuteWait(inst,"G90 G53 G0 Z0.0")
wx.wxMessageBox("Please turn on spindle and click ok to continue") --can be removed if required
mc.mcCntlGcodeExecuteWait(inst,"G90 G0 X"..xstart.." Y"..ystart)
mc.mcToolSetCurrent(inst, selectedtool)
mc.mcCntlSetLastError(inst, "ToolChange Finished")
end
end
function RunProbe(tool)
local inst = mc.mcGetInstance()
toollen = mc.mcToolGetData(inst, mc.MTOOL_MILL_HEIGHT, tool)
if toollen == 0 then toollen = 40 end -- User Preference
mc.mcCntlSetLastError(inst, "Changing to Fallback Length")
local probestart = -60 + toollen
mc.mcCntlGcodeExecuteWait(inst,"G90 G53 G0 Z"..probestart.."\nG91 G31 Z-15 F25")
end
if (mc.mcInEditor() == 1) then
M6()
end
function M6()
local inst = mc.mcGetInstance();
local guesslen = -60.00
local selectedtool = mc.mcToolGetSelected(inst)
local currenttool = mc.mcToolGetCurrent(inst)
local toollen = mc.mcToolGetData(inst, mc.MTOOL_MILL_HEIGHT, currenttool)
local probestart = guesslen + toollen
local xstart = mc.mcAxisGetPos(inst,0)
local ystart = mc.mcAxisGetPos(inst,1)
if selectedtool == currenttool then
return
mc.mcCntlSetLastError(inst, "ToolChange Activated But Not Required")
else
mc.mcCntlGcodeExecuteWait(inst,"G90 G53 G0 Z0.0")
mc.mcCntlGcodeExecuteWait(inst,"G90 G53 G0 X14 Y30")
mc.mcCntlGcodeExecuteWait(inst,"G90 G53 G0 Z"..probestart)
mc.mcCntlGcodeExecuteWait(inst, "G91 G31 Z-15 F25")
local toolz = mc.mcAxisGetPos(inst,2)
mc.mcCntlGcodeExecuteWait(inst,"G90 G53 G0 Z0.0")
local changetoo = mc.mcToolGetDesc(inst,selectedtool)
wx.wxMessageBox("Please change to tool number "..selectedtool.." "..changetoo.." and press ok to continue")
currenttool = selectedtool
toollen = mc.mcToolGetData(inst, mc.MTOOL_MILL_HEIGHT, currenttool)
probestart = guesslen + toollen
mc.mcCntlGcodeExecuteWait(inst,"G90 G53 G0 X14 Y30")
mc.mcCntlGcodeExecuteWait(inst,"G90 G53 G0 Z"..probestart)
mc.mcCntlGcodeExecuteWait(inst, "G91 G31 Z-15 F25")
mc.mcAxisSetPos(inst, 2 , toolz)
mc.mcCntlGcodeExecuteWait(inst,"G90 G53 G0 Z0.0")
mc.mcCntlGcodeExecuteWait(inst,"G90 G0 X"..xstart.." Y"..ystart)
mc.mcToolSetCurrent(inst, selectedtool)
wx.wxMessageBox('Toolchange finished')
end
end
if (mc.mcInEditor() == 1) then
M6()
end