Machsupport Forum

Mach Discussion => Mach4 General Discussion => Topic started by: rhtuttle on May 07, 2018, 11:32:46 AM

Title: Mache4 Lathe-pmdx411 incremental move problem
Post by: rhtuttle on May 07, 2018, 11:32:46 AM
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
Title: Re: Mache4 Lathe-pmdx411 incremental move problem
Post by: joeaverage on May 07, 2018, 02:18:03 PM
Hi,
is it a typo but in the first piece of code:
Quote
\ng0 h'..tostring

Whereas in the second:
Quote
\ng0 c'..tostring

What's the 'h' axis?

Craig
Title: Re: Mache4 Lathe-pmdx411 incremental move problem
Post by: rhtuttle on May 07, 2018, 02:50:54 PM
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.
Title: Re: Mache4 Lathe-pmdx411 incremental move problem
Post by: joeaverage on May 07, 2018, 02:59:37 PM
Hi,
OK but why then are you using 'h' in one but 'c' in the other. Is 'h' equivalent to incremental 'a' or.....?

Craig
Title: Re: Mache4 Lathe-pmdx411 incremental move problem
Post by: rhtuttle on May 07, 2018, 03:04:38 PM
sorry, not A but C. No incremental support for A or B, just C
Title: Re: Mache4 Lathe-pmdx411 incremental move problem
Post by: joeaverage on May 07, 2018, 03:09:29 PM
Hi,
kool, learn something new every day!

That still leaves the original question unanswered. The code looks good.
When you say the incremental version doesn't work....what does it do?

Craig
Title: Re: Mache4 Lathe-pmdx411 incremental move problem
Post by: joeaverage on May 07, 2018, 08:43:57 PM
Hi,
thinking a little more about this may I suggest some experiments to find out whats going on.

First just set up a script to rotate the C axis in discrete steps... something like

local s
Local for i=1 to 100
s=s..'g0 h5\n'
end
mc.mcCntlMdiExecute(mc.mcGetInstance(),s)

The next question I have is 'is it possible that the lines of Gcode presented to the interpreter are returning
before being executed and being lost?'

Maybe something like this

local i,s
for i=0,100
s='g0 h5'
mc.mcCntlMdiExecuteWait(mc.mcGetInstance(),s)
end

Craig
Title: Re: Mache4 Lathe-pmdx411 incremental move problem
Post by: rhtuttle on May 08, 2018, 11:12:52 AM
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
Title: Re: Mache4 Lathe-pmdx411 incremental move problem
Post by: joeaverage on May 08, 2018, 02:55:39 PM
Hi,
sorry I have a Mach4 mill only.

I follow your argument that both strings are the same length, ergo length is not the determinate.

It rather suggests that 'h' axis movement is not properly supported by Mach.

Craig
Title: Re: Mache4 Lathe-pmdx411 incremental move problem
Post by: Graham Waterworth on May 12, 2018, 12:36:57 PM
Do you do an absolute return to start before the second cut ?
Title: Re: Mache4 Lathe-pmdx411 incremental move problem
Post by: rhtuttle on May 12, 2018, 05:36:12 PM
Yes, I home the C axis.

Title: Re: Mache4 Lathe-pmdx411 incremental move problem
Post by: joeaverage on May 12, 2018, 05:46:55 PM
Hi RT,
how about having your program cut marks at 10 degrees say, but over two revolutions. I ideally the cuts made during the second revolution would land
on top of the cuts made during the first revolution.

It may give some insight into whats happening.

Craig