1
Mach4 General Discussion / Re: Macros for lathe spindle range change
« on: August 28, 2017, 04:53:24 PM »
Just read your post.
The macro below does this job for me.
I have defined the spindle range (6 gears) in solidcam and the post pocessor call the macro on tool change.
M101 P <Range>
Hope that helps.
function M101(hVars)
local inst = mc.mcGetInstance()
local CurrentSpindleRange = mc.mcSpindleGetCurrentRange(inst)
local NextSpindleRange = mc.mcCntlGetLocalVar(inst, hVars, mc.SV_P)
mc.mcCntlSetLastError(inst, "Sets spindle range to " ..NextSpindleRange)
if CurrentSpindleRange ~= NextSpindleRange then
wx.wxMessageBox("Change Gear to " ..NextSpindleRange, "Gear box")
rc = mc.mcSpindleSetRange(inst, NextSpindleRange)
end
end
if (mc.mcInEditor() == 1) then
M101()
end
The macro below does this job for me.
I have defined the spindle range (6 gears) in solidcam and the post pocessor call the macro on tool change.
M101 P <Range>
Hope that helps.
function M101(hVars)
local inst = mc.mcGetInstance()
local CurrentSpindleRange = mc.mcSpindleGetCurrentRange(inst)
local NextSpindleRange = mc.mcCntlGetLocalVar(inst, hVars, mc.SV_P)
mc.mcCntlSetLastError(inst, "Sets spindle range to " ..NextSpindleRange)
if CurrentSpindleRange ~= NextSpindleRange then
wx.wxMessageBox("Change Gear to " ..NextSpindleRange, "Gear box")
rc = mc.mcSpindleSetRange(inst, NextSpindleRange)
end
end
if (mc.mcInEditor() == 1) then
M101()
end