Hello Guest it is April 26, 2024, 02:55:54 AM

Show Posts

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.


Messages - dude1

851
Mach4 General Discussion / Re: need some lua help
« on: May 07, 2015, 12:17:20 AM »
do i need to put in a address for this
unction m1005()   
   --local macroname = "m1005"
   function GetRegister(regname)
      local rc;
      local inst = mc.mcGetInstance();
      local hreg = mc.mcRegGetHandle(inst, string.format("iRegs0/%s", regname));
      return mc.mcRegGetValueString(hreg);
   end
   local TS_XPosVal = tostring(GetRegister("TS_XPos"));
   local YPosVal = tostring(GetRegister("TS_YPos"));
   local TypeVal = tostring(GetRegister("TS_Type"));
   local TouchPosVal = tostring(GetRegister("TS_TouchPos"));
   local ProbeHVal = tostring(GetRegister("TS_ProbeH"));
   local RetractLVal = tostring(GetRegister("TS_RetractL"));
   local DefaultVal = tostring(GetRegister("TS_DefaultL"));
   --regval = GetRegister("TS_Type");
   --wx.wxMessageBox(regval);
end

if (mc.mcInEditor() == 1) then
    m1005();
end

so the tool height probing macro can find it what is m1005 from the manual

852
Mach4 General Discussion / Re: need some lua help
« on: May 06, 2015, 03:47:15 PM »
I should of been more correct I get this with the m1005 tool height probing from the scripting manual

I keep getting this
[string "C:\Mach4Hobby\Macros\m1005.mcs"]:34: attempt to call global 'GetRegister' (a nil value)
stack traceback:
   [string "C:\Mach4Hobby\Macros\m1005.mcs"]:34: in function 'm1005'
   [string "C:\Mach4Hobby\Macros\m1005.mcs"]:103: in main chunk


mcLua ERROR: Lua: Error while running chunk

having the reg in reg or the macro I can call them but the tool height probing macro cant find them

853
Mach4 General Discussion / Re: need some lua help
« on: May 06, 2015, 05:30:44 AM »
this is what I have so far its still not working

local macroname = "m1005"
function GetRegister(regname)


local rc
local inst = mc.mcGetInstance()
local hreg = mc.mcRegGetHandle(inst, string.format("iRegs0/%s", regname))
return mc.mcRegGetValueString(hreg)
end

local TS_XPosVal = tostring(GetRegister("TS_XPos"));
local YPosVal = tostring(GetRegister("TS_YPos"));
local TypeVal = tostring(GetRegister("TS_Type"));
local TouchPosVal = tostring(GetRegister("TS_TouchPos"));
local ProbeHVal = tostring(GetRegister("TS_ProbeH"));
local RetractLVal = tostring(GetRegister("TS_RetractL"));
local DefaultVal = tostring(GetRegister("TS_DefaultL"));


--regval = GetRegister("TS_Type")
--wx.wxMessageBox(regval)

if (mc.mcInEditor() == 1) then
    GetRegister ();
end

I have put them in the Register and can call them using
egval = GetRegister("TS_Type")
wx.wxMessageBox(regval)

I keep getting this
[string "C:\Mach4Hobby\Macros\m1005.mcs"]:34: attempt to call global 'GetRegister' (a nil value)
stack traceback:
   [string "C:\Mach4Hobby\Macros\m1005.mcs"]:34: in function 'm1005'
   [string "C:\Mach4Hobby\Macros\m1005.mcs"]:103: in main chunk


mcLua ERROR: Lua: Error while running chunk

854
if you look in tool box`s there`s list`s of all sort`s of things

855
Mach4 General Discussion / Re: ESS problem
« on: May 04, 2015, 06:59:10 PM »
it will be one of you settings what you are experiencing is what happens with the ESS when using M4 I did a install yesterday that took 2 hours  first hour was getting the estop and outputs to work once they where working it came right

856
Mach4 General Discussion / Re: ESS problem
« on: May 04, 2015, 03:43:46 PM »
do you have estop enabled

857
Mach4 General Discussion / Re: need some lua help
« on: May 04, 2015, 08:01:04 AM »
thank`s scott my brains burt for to day I will get back to it tommrow I have done half of that i have put the registers in

then i will do what you have suggested.

858
there are some good one`s now kflop, ESS and quite a few more look here http://www.machsupport.com/software/plugins/   they are there for a reason and there are some more coming soon

859
Mach4 General Discussion / Re: need some lua help
« on: May 04, 2015, 07:42:54 AM »
right this lua is a pita

what I think I need to do is use this

function GetRegister(regname)
local inst = mc.mcGetInstance()
local hreg = mc.mcRegGetHandle(inst, string.format("iRegs0/%s", regname))
return mc.mcRegGetValueString(hreg)
end

and have it like this

function GetRegister(TS_XPos)
local inst = mc.mcGetInstance()
local hreg = mc.mcRegGetHandle(inst, string.format("iRegs0/%s, TS_XPos",10))

end

function GetRegister(TS_YPos)
local inst = mc.mcGetInstance()
local hreg = mc.mcRegGetHandle(inst, string.format("iRegs0/%s, TS_Pos",10))

so on

then end with this
return mc.mcRegGetValueString(hreg)
end

it compiles and runs and debugs with no problem

then at top of m1005 put in path to it or not

but when I run m1005 it compiles but does not run as it cant find the Register`s

I have put them in as iregs and gregs that did fa I could find and read them using one of Scott examples this one Quicky Wizard and/or Macro variable value viewer function.

the thing I am getting stuck on is m1005 finding them I meant to put them in a use macro or module.

with what I have put in here how wrong am I

also Scott is there something you or ya bro have posted that is the correct way of doing just pointers please, if I can`t work this out by the end of the week I might ask for the answer

for the time being I will just use the macro b to do tool height probing it works but I would rather use the code in the manual it`s a bit safer 

and i will be doing the first cut with M4 Friday or monday just got to fix a bobo

860
nup it says what it is and has a usb port on it that`s way you got a yes