Machsupport Forum

Mach Discussion => General Mach Discussion => Topic started by: MadTooler on March 26, 2013, 01:08:30 AM

Title: Auto Tool Zero Touch Plate/Probe Driving A/4th axis
Post by: MadTooler on March 26, 2013, 01:08:30 AM
I am working out the kinks with a 4 axis router run by a SmoothStepper USB.  I thought everything was about done, but my "Auto Tool Zero" started acting up after I installed the A/4th axis drive.

If the 4th is not 0 or 360 on the DRO, both Z (super duper slow, almost not at all) and 4th move when the macro is started.  Mostly the 4th to the extent that the macro would seem to run a very long time before Z has moved the distance in the macro.  I don't really know if this is a problem with my macro or a bug in Mach R3.043.066 on an XP machine.  Also, it acts this way even when I am running offline.

Here's the code I am using (inches):

CurrentFeed = GetOemDRO(818) 'Get the current feedrate to return to later
CurrentAbsInc = GetOemLED(48) 'Get the current G90/G91 state
CurrentGmode = GetOemDRO(819) 'Get the current G0/G1 state
PlateThickness = GetUserDRO(1151) 'Z-plate thickness DRO. This line can be omited if no DRO on screen

If GetOemLed (825)=0 Then 'Check to see if the probe is already grounded or faulty
DoOEMButton (1010) 'zero the Z axis so the probe move will start from here
Code "G4 P2" ' this delay gives me time to get from computer to hold probe in place
Code "G90 G31Z-.6 F5" 'probing move, can set the feed rate here as well as how far to move
While IsMoving() 'wait while it happens
Wend
ZProbePos = GetVar(2002) 'get the exact point the probe was hit
Code "G0 Z" &ZProbePos 'go back to that point, always a very small amount of overrun
While IsMoving ()
Wend
'Call SetDro (2, PlateThickness) 'use this line if DRO is used
Call SetDro (2, .0595) 'use this line for no on-screen plate thickness DRO, change 1.5 to your plate thickness
Sleep 100 'Pause for Dro to update.
Code "G1 Z0.2 F80" 'put the Z retract height you want here, must be greater than the touch plate thickness
While IsMoving ()
Wend
Code "(Z axis is now zeroed)" 'puts this message in the status bar
Code "F" &CurrentFeed 'Returns to prior feed rate
Else
Code "(Z-Plate is grounded, check connection and try again)" 'this goes in the status bar if applicable
End If
If CurrentAbsInc = 0 Then 'if G91 was in effect before then return to it
Code "G91"
End If
If CurrentGMode = 0 Then 'if G0 was in effect before then return to it
Code "G0"
End If
     

Side note:  I never found a specific location within machsupport to download a clean probe script.  The one I am using is from scouring threads and has some undesirable operations, but it seemed well enough until I get the time to better understand all the variables and syntax.

Thanks to anyone that may be able to help.
Title: Re: Auto Tool Zero Touch Plate/Probe Driving A/4th axis
Post by: MadTooler on March 26, 2013, 03:23:05 AM
UPDATE

I found if I inhibited the A axis on the Settings Screen, the Auto Tool Zero works fine.  I can still jog the A, but cannot run code (I think) or send it gcode from MDI.

One additional note, the first session that I inhibited and then enable the A, everything was working.  I closed the session and restarted to find it broken again.  It works properly inhibited still, yet not if I re enable.

Thanks again.
Title: Re: Auto Tool Zero Touch Plate/Probe Driving A/4th axis
Post by: MadTooler on March 28, 2013, 04:48:23 PM
Update 2

While I have not run across anyone else with this problem, nor any better idea of what is causing it, I have revised my script to toggle the Inhibit A automatically to allow for the tool probe to work properly.

This will do for now, but it is a bandaid.  I would appreciate any possible input as to what the underlying problem may be.

Thanks.

CurrentFeed = GetOemDRO(818) 'Get the current feedrate to return to later
CurrentAbsInc = GetOemLED(48) 'Get the current G90/G91 state
CurrentGmode = GetOemDRO(819) 'Get the current G0/G1 state
PlateThickness = GetUserDRO(1151) 'Z-plate thickness DRO. This line can be omited if no DRO on screen
Ainhibit = 0


If GetOemLed (89)=0 Then 'check if Inhibit A is already active
DoOemButton (253) 'Press Inhibit A button
Ainhibit = 1
End If

If GetOemLed (825)=0 Then 'Check to see if the probe is already grounded or faulty
DoOEMButton (1010) 'zero the Z axis so the probe move will start from here
Code "G4 P2" ' this delay gives me time to get from computer to hold probe in place
Code "G90 G31Z-.6 F5" 'probing move, can set the feed rate here as well as how far to move
While IsMoving() 'wait while it happens
Wend
ZProbePos = GetVar(2002) 'get the exact point the probe was hit
Code "G0 Z" &ZProbePos 'go back to that point, always a very small amount of overrun
While IsMoving ()
Wend
'Call SetDro (2, PlateThickness) 'use this line if DRO is used
Call SetDro (2, .0595) 'use this line for no on-screen plate thickness DRO, change 1.5 to your plate thickness
Sleep 100 'Pause for Dro to update.
Code "G1 Z0.2 F80" 'put the Z retract height you want here, must be greater than the touch plate thickness
While IsMoving ()
Wend
Code "(Z axis is now zeroed)" 'puts this message in the status bar
Code "F" &CurrentFeed 'Returns to prior feed rate
Else
Code "(Z-Plate is grounded, check connection and try again)" 'this goes in the status bar if applicable
End If
If CurrentAbsInc = 0 Then 'if G91 was in effect before then return to it
Code "G91"
End If
If CurrentGMode = 0 Then 'if G0 was in effect before then return to it
Code "G0"
End If

If Ainhibit Then 'If A was inhibited in this script then reset
DoOemButton (253) 'Press Inhibit A button
End If