Hello Guest it is April 18, 2024, 12:43:36 PM

Author Topic: Setting Tool Table Values  (Read 1015 times)

0 Members and 1 Guest are viewing this topic.

Setting Tool Table Values
« on: October 23, 2018, 12:13:39 PM »
I am trying to programatically set tool table values.  The following macro runs and returns a rc=0 and the pVal is what is passed but the tool table values do not change.  Anyone have an idea as to what I am doing wrong?

Code: [Select]
function m6001(hParam)
if (hParam ~= nil) then
--mc.mcCntlSetLastError(inst, 'handle == ' .. tostring(hParam));
local inst = mc.mcGetInstance();
local pVal = mc.mcCntlGetLocalVar(inst, hParam, mc.SV_P)
local pFlag = mc.mcCntlGetLocalVarFlag(inst, hParam, mc.SV_P)
if(pFlag == 1) then
rc=mc.mcToolSetDataExDbl(inst,61,'ZOffset',tonumber(pVal))
wx.wxMessageBox(tostring(rc)..' - '..tostring(pVal))
else
mc.mcCntlSetLastError(inst, 'ERROR: P Falue required with M6001');
mc.mcCntlEStop(inst);
end
else
mc.mcCntlSetLastError(inst, 'ERROR: handle == nil');
end
end

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

TIA

RT
Re: Setting Tool Table Values
« Reply #1 on: October 23, 2018, 01:40:44 PM »
Found the error. 

rc=mc.mcToolSetDataExDbl(inst,61,'ZOffset',tonumber(pVal)) is only used for user and extended fields, not the standard fields, should be:

rc=mc.mcToolSetData(inst,mc.MTOOL_LATHE_Z,61,tonumber(pVal))


HTH

RT
Re: Setting Tool Table Values
« Reply #2 on: October 23, 2018, 05:21:24 PM »
RT,
What are you doing with this Macro?  And User fields; is that in the tool table?  We can add custom fields to it?
Chad Byrd
Re: Setting Tool Table Values
« Reply #3 on: October 23, 2018, 05:30:45 PM »
This macro sets the Z offset in the tool table for the specified tool entry to a new value.

Yes, it is the tool table and yes you can add custom fields.  view->tool table->edit->table fields->user fields  add.

HTH

RT
Re: Setting Tool Table Values
« Reply #4 on: October 23, 2018, 08:57:58 PM »
Nice!  I was asking someone about this a while back, wondering if you could add fields for things like a programmable coolant position, like Haas has.  Also, I was going to add a field for an approximate tool length from the gauge line, again, like Haas has for their automatic tool setting.  Probably going to adjust my auto tool setting macro to use an additional tool field now for Tool Gauge Length.  Very cool!
Chad Byrd