Hello Guest it is October 17, 2019, 07:33:48 PM

Author Topic: Screen Set Ideas  (Read 108005 times)

0 Members and 1 Guest are viewing this topic.

Re: Screen Set Ideas
« Reply #340 on: October 26, 2018, 08:39:30 PM »
Thought id show how you can pass hParam values to the tool table in mill mode, got the idea from Tuttles lathe project code he created passing values to his tool table.

First thing all macros need to be saved in .mcs extension not .lua
the ZeroBrane defaults to a .lua extension and that bit me.
as I found out they never get compiled in the mcLua.mcc file (why... good question it says lua, right in the name)  ::)

I attached the sample code so all can learn and play with.
no way is it clean & refined but gives you an idea how its done and how you can test in the ZeroBrane's debug mode

thanks SMurph making my life even more ...  :-*

and yes there are other ways to update the table (G10), this was just a challenge I wanted to learn from.
the default tool is the current tool but you can use and pass a t# to write data to different tools
could be made into a looping routine that cleans out all the data in the table.
its all about whats being passed and how it is used in the function.

Offline smurph

*
  • *
  •  1,138 1,138
  • "That there... that's an RV."
    • View Profile
Re: Screen Set Ideas
« Reply #341 on: October 28, 2018, 04:03:40 PM »
Joyous?  I made you life more joyous, right?  :)

Offline Tweakie.CNC

*
  • *
  •  7,951 7,951
  • Super Kitty
    • View Profile
    • Tweakie.CNC
Re: Screen Set Ideas
« Reply #342 on: October 29, 2018, 03:16:43 AM »
 :)
Success consists of going from failure to failure without loss of enthusiasm.  Winston Churchill.
Re: Screen Set Ideas
« Reply #343 on: October 29, 2018, 09:25:32 AM »
 ::)  Funny guys,  ;D you know I love pushing  8)

showing how you can add to that same function, a start and stop tool cleanout routine using an "a# and b# value"
the loop uses "i" to select the current tool that needs cleaned out from a to b

Code: [Select]
local bVal = mc.mcCntlGetLocalVar(inst, hParam, mc.SV_B)
local bFlag = mc.mcCntlGetLocalVarFlag(inst, hParam, mc.SV_B)
--mc.mcCntlSetLastError(inst, 'bVal handle == ' .. tostring(bVal));
--mc.mcCntlSetLastError(inst, 'bFlag handle == ' .. tostring(bFlag));

if((aFlag == 1)and(bFlag == 1)) then
for i = aVal, bVal do
rc=mc.mcToolSetData(inst,mc.MTOOL_MILL_POCKET,i,0)
        rc=mc.mcToolSetData(inst,mc.MTOOL_MILL_HEIGHT,i,0)
rc=mc.mcToolSetData(inst,mc.MTOOL_MILL_HEIGHT_W,i,0)
        rc=mc.mcToolSetData(inst,mc.MTOOL_MILL_DIA,i,0)
        rc=mc.mcToolSetData(inst,mc.MTOOL_MILL_DIA_W,i,0)
rc=mc.mcToolSetData(inst,mc.MTOOL_MILL_X,i,0)
rc=mc.mcToolSetData(inst,mc.MTOOL_MILL_X_W,i,0)
rc=mc.mcToolSetData(inst,mc.MTOOL_MILL_Y,i,0)
rc=mc.mcToolSetData(inst,mc.MTOOL_MILL_Y_W,i,0)
        rc=mc.mcToolSetDesc(inst,i,tostring(""))
end
end