Hello Guest it is November 11, 2019, 05:59:31 PM

Author Topic: Mache4 Lathe-pmdx411 incremental move problem  (Read 1096 times)

0 Members and 1 Guest are viewing this topic.

Mache4 Lathe-pmdx411 incremental move problem
« 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
Re: Mache4 Lathe-pmdx411 incremental move problem
« Reply #1 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
My wife left with my best friend...
     and I miss him!
Re: Mache4 Lathe-pmdx411 incremental move problem
« Reply #2 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.
Re: Mache4 Lathe-pmdx411 incremental move problem
« Reply #3 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
My wife left with my best friend...
     and I miss him!
Re: Mache4 Lathe-pmdx411 incremental move problem
« Reply #4 on: May 07, 2018, 03:04:38 PM »
sorry, not A but C. No incremental support for A or B, just C
Re: Mache4 Lathe-pmdx411 incremental move problem
« Reply #5 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
My wife left with my best friend...
     and I miss him!
Re: Mache4 Lathe-pmdx411 incremental move problem
« Reply #6 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
My wife left with my best friend...
     and I miss him!
Re: Mache4 Lathe-pmdx411 incremental move problem
« Reply #7 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
Re: Mache4 Lathe-pmdx411 incremental move problem
« Reply #8 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
My wife left with my best friend...
     and I miss him!

Offline Graham Waterworth

*
  • *
  •  1,903 1,903
  • Yorkshire Dales, England
    • View Profile
Re: Mache4 Lathe-pmdx411 incremental move problem
« Reply #9 on: May 12, 2018, 12:36:57 PM »
Do you do an absolute return to start before the second cut ?
Without engineers the world stops