105
« on: February 01, 2021, 10:08:33 AM »
A little over the top but works for me. After putting a collar on each one (I 3d print each one with a #6 set screw) you can then call a macro with the offset as one of the parameters in your gcode. For my fly rod ferrules I have to spot, drill, flat bottom and then ream each one. Multiply that by 10 different sizes and the tool table becomes cumbersome. My tool 60:
--[[
Macro to set Z or X offset or tool description
example: m6061 z1.3333 d.250
--]]
function m6061(hParam)
if (hParam ~= nil) then
--mc.mcCntlSetLastError(inst, 'handle == ' .. tostring(hParam));
local inst = mc.mcGetInstance();
local zVal = mc.mcCntlGetLocalVar(inst, hParam, mc.SV_Z)
local zFlag = mc.mcCntlGetLocalVarFlag(inst, hParam, mc.SV_Z)
local xVal = mc.mcCntlGetLocalVar(inst, hParam, mc.SV_X)
local xFlag = mc.mcCntlGetLocalVarFlag(inst, hParam, mc.SV_X)
local dVal = mc.mcCntlGetLocalVar(inst, hParam, mc.SV_D)
local dFlag = mc.mcCntlGetLocalVarFlag(inst, hParam, mc.SV_D)
if(zFlag == 1)or(xFlag==1)or(dFlag==1) then
if zFlag==1 then
rc=mc.mcToolSetData(inst,mc.MTOOL_LATHE_Z,61,tonumber(zVal))
end
if xFlag==1 then
rc=mc.mcToolSetData(inst,mc.MTOOL_LATHE_X,61,tonumber(xVal))
end
if dFlag==1 then
rc=mc.mcToolSetDesc(inst,61,'Bit Diameter: '..tostring(dVal))
end
else if zFlag==1 then
mc.mcCntlSetLastError(inst, 'ERROR: Z, X or D value required with M6001');
mc.mcCntlEStop(inst);
end
end
else
mc.mcCntlSetLastError(inst, 'ERROR: handle == nil');
end
end
if (mc.mcInEditor() == 1) then
m6061()
HTH
RT