Hello Guest it is October 04, 2023, 09:57:20 PM

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 - rhtuttle

261
Mach4 General Discussion / Re: mcMasterModule question
« on: June 29, 2018, 04:01:15 PM »
you don't need to create a mcp variable as mc is defined and available at load to macros as well as buttons etc.  If you were to add the line wx.wxMessageBox(tostring(mc)) at the beginning of your m6 macro you will see that it is defined as a table, the one created at Mach4 load.  I don't think the mcp table that is returned links to your running version of Mach4 but rather creates another lua chunk.

You can access the the register values by requesting a handle to it an then requesting the value using the mc variable and the core API's:

hReg, rc = mc.mcRegGetHandle(mInst, 'gRegs0/SafeZ')

mVal, rc = mcRegGetValue(hReg)

Assuming you have created a gReg0 value named SafeZ through Configure->Plugins->Regfile

I can't help with with the scr problem since I get the same result as you do with the version I listed.  maybe there is a development version that allows direct access to the scr variable loaded at screenload.  My workaround shown in the link I provided does work but it would be better if someone (SMURPH) would respond on this one.

HTH

RT

262
Mach4 General Discussion / Re: mcMasterModule question
« on: June 29, 2018, 12:50:58 PM »
found my old thread where smurph says it is a vailable but doesn't say what versions

https://www.machsupport.com/forum/index.php/topic,36554.0.html

263
Mach4 General Discussion / Re: mcMasterModule question
« on: June 29, 2018, 12:44:04 PM »
I'm not the expert on Lua or Mach4 so take this for what you paid for it.

Not sure about the new versions (using 3741) but the scr variable was not available to macros.  You had to set a register with a value and then retrieve the register value.  I seem to recall a post about it being available in the newer versions though.  While you can load a variable 'scr' from a macro I don't believe you get connected to Mach4's scr.

   SafeZ = mcp.LoadRegister(N_, "SafeZ", "0.00")

I assume N_ was set somewhere from N_=mc.mcGetInstance()
assume typo mcp

mc.mcLoadRegister name is of the form 'iRegs0/SafeZ' or 'gRegs0/SafeZ' depending on where you defined the register.

I think should be    SafeZ = mc.mcLoadRegister(N_, "gRegs0/SafeZ", "0.00")

HTH

RT





264
Mach4 General Discussion / Re: mcAxisGetInfoStruct
« on: June 18, 2018, 11:05:19 AM »
If all you want is the axis position:

val, rc = mc.mcAxisGetPos(number mInst, number axisId)

HTH

RT


265
Yes, I home the C axis.


266
Hi Craig,

Since both strings passed to the interpreter contain the same number of lines and characters they would both fail but the absolute one does execute as expected.

I have attached two pictures.  Two ops were run on each.  A 25 tic, .100" length and a 5 tic .200" length.  You can see in the incremental photo that the spacing from the 25 is short and the 5 tic does not line up with the 25 tic.

If there is someone out there that has Mach4 on a lathe with a rotary that could test the 2 code samples it could narrow it down as to whether it is Mach4 or pmdx411 that is failing.

TIA

RT

267
sorry, not A but C. No incremental support for A or B, just C

268
Mach4 follows fanuc implementation so for lathe there is no g91.  X,Y,Z,A axis are referred to as U,V,W,H for incremental mode.

269
Trying to determine if my coding is incorrct or if Mach4 or PMDX411 is incorrect.

using the following code to produce tick marks on a dial.  the first example uses an incremental approach to advance the C axis for each tick.  The 2nd uses absolute positioning.

They produce different results
move h, deg

Code: [Select]
local n=scr.GetProperty('droNmarks','Value')
local dpth=scr.GetProperty('droMarkXdepth','Value')
local lngth=scr.GetProperty('droMarkXlength','Value')
local deg=360/n
local i,s
s=''
for i=1,n do
  s=s..'g0 z-'..lngth..'\ng0 x-'..dpth..'\ng0z0\ng0x0\ng0 h'..tostring(deg)..'\n'
end
s=s..'g0 c0'
mc.mcCntlMdiExecute(mc.mcGetInstance(),s)

Absolute, move c, deg*i
Code: [Select]
local n=scr.GetProperty('droNmarks','Value')
local dpth=scr.GetProperty('droMarkXdepth','Value')
local lngth=scr.GetProperty('droMarkXlength','Value')
local deg=360/n
local i,s
s=''
for i=1,n do
  s=s..'g0 z-'..lngth..'\ng0 x-'..dpth..'\ng0z0\ng0x0\ng0 c'..tostring(deg*i)..'\n'
end
s=s..'g0 c0'
mc.mcCntlMdiExecute(mc.mcGetInstance(),s)


The latter gives correct results but both should be the same.


TIA

RT

270
Possibly rework your code to work in incremental rather than absolute coordinates g91/g90

HTH

RT