Machsupport Forum

Mach Discussion => General Mach Discussion => Topic started by: glengeniii on December 17, 2009, 12:21:59 AM

Title: Help with Auto tool zero macro?
Post by: glengeniii on December 17, 2009, 12:21:59 AM
How can I assign a M number to this macro I found that is for the auto tool zero button.  I would like to be able to use the button to zero the tool, and I would also like to assign a M-number so that immediately after a tool change, the the macro will be ran, the tool will be zeroed and the program then continue.

Example :
M28
T3 M06 G43 H3
M99991 (Auto zero's tool)
M1 (press cycle start to continue)
G0 z.375
......

Also, I would like to know if after the probe is triggered, does the z axis de-accelerate normally, or does it come to an abrupt stop (like when an e-stop is triggered).  I'm afraid the I'll lose steps in absolute coordinates on the z axis with my stepper system.

Here is the macro I found:

Put a user DRO on the screen using Mach's screen utility, Screen4. Assigned it OEM code 1151

Also put a LED for Probe and one for Pause or Dwell. These I will explain later. See the screen grab below as pic.

Assigned the following macro to the "Auto Tool Zero" button.

PlateThickness = GetUserDRO(1151) 'Z-plate thickness DRO

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 P5" ' this delay gives me time to get from computer to hold probe in place
Code "G31Z-40 F500" '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 axact 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) 'set the Z axis DRO to whatever is set as plate thickness
Code "G4 P0.25" 'Pause for Dro to update.
Code "G0 Z25.4" 'put the Z retract height you want here
Code "(Z axis is now zeroed)" 'puts this message in the status bar
Else
Code "(Z-Plate is grounded, check connection and try again)" 'this goes in the status bar if aplicable
Exit Sub
End If


 
Title: Re: Help with Auto tool zero macro?
Post by: HimyKabibble on December 17, 2009, 10:03:22 AM
M-macros are created simply by naming the file M*********.m1s.  So, if you want to run a particular macro as M199, put it in a file named M199.m1s.

G31 does obey the acceleration specified for each axis, so it *will* over-shoot if you probe at high speed.

Regards,
Ray L.
Title: Re: Help with Auto tool zero macro?
Post by: Greolt on December 18, 2009, 01:50:33 AM
I recognise the comment wording as an old example of mine.  (Which was based on someone else's)

Try a couple of mods, slowing it down for one,

PlateThickness = GetUserDRO(1151) 'Z-plate thickness DRO

If GetOemLed (825)=0 Then 'Check to see if the probe is already grounded or faulty
DoOEMButton (1010) 'zero the Z axis
Code "G4 P2" ' this delay gives me time to get from computer to hold probe in place, 2 seconds
Code "G90 G31 Z-30 F50" '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 axact 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) 'set the Z axis DRO to whatever is set as plate thickness
Sleep 150 'Pause for Dro to update.
Code "G1 Z30 F200" 'put the Z height to retract to here
Code "(Z axis is now zeroed)" 'puts this message in the status bar
Else
Code "(Z-Plate is grounded, check connection and try again)" 'this goes in the status bar if aplicable
End If
Exit Sub
Title: Re: Help with Auto tool zero macro?
Post by: sawdustman18 on February 01, 2010, 02:52:22 PM
Can anyone help me.  When I give the code g31 z-3 f5 the router moves but when I touch the probe to the bit the probe lights but the z movement does not stop.  It does not stop when it gets to -4 either I have to hit the stop button.
Title: Re: Help with Auto tool zero macro?
Post by: Greolt on February 01, 2010, 06:03:42 PM
When you say the probe lights, what do you mean?

Look on the diagnostics page.  When the probe "lights" then the "digitize" LED should light.

Greg

PS:  Are you using the LPT or another external pulsing device?
Title: Re: Help with Auto tool zero macro?
Post by: sawdustman18 on February 02, 2010, 01:30:32 AM
The digitize light on the diagnostic screen lights when the probe touches the router bit.
Title: Re: Help with Auto tool zero macro?
Post by: sawdustman18 on February 02, 2010, 03:20:24 PM
I am using LPT
Title: Re: Help with Auto tool zero macro?
Post by: ftec on February 02, 2010, 04:14:23 PM
Quote
Code "G90 G31 Z-30 F50" 'probing move, can set the feed rate here as well as how far to move
While IsMoving() 'wait while it happens
Wend


I don't see anything in this code fragment that would stop the Z movement once it has been commenced until it has reached Z-30. So I would assume that there must be internal code within Mach which stops the movement while the program loops  in IsMoving() - Wend and when the digitize led lits. I would check the enabling of the probe and how it is connected and how it has been set up in Input Signal etc.

There is a function IsSuchSignal(SignalID As Integer) with which you could check if the probe signal is valid but I don't know the SignalID constant for the probe input.

PS. Is there a list available of the constants names and values used within Mach. There must be constants also for XHOME, YHOME etc.
Title: Re: Help with Auto tool zero macro?
Post by: Greolt on February 02, 2010, 06:51:01 PM
Quote
Code "G90 G31 Z-30 F50" 'probing move, can set the feed rate here as well as how far to move
While IsMoving() 'wait while it happens
Wend

I don't see anything in this code fragment that would stop the Z movement once it has been commenced until it has reached Z-30.

G31 is a probe move, so it is inherent in the move to stop when the probe input goes active.

Sawdustman,  will the probe move stop when triggered if you manually enter the "G31 Z-30 F50" in the MDI?

Greg
Title: Re: Help with Auto tool zero macro?
Post by: sawdustman18 on February 03, 2010, 01:30:26 AM
Greg,  The probe does not stop the movement with a manual input either.

Steve
Title: Re: Help with Auto tool zero macro?
Post by: Greolt on February 03, 2010, 05:21:58 AM
Steve

You had better post your XML and I will have a look.

Greg
Title: Re: Help with Auto tool zero macro?
Post by: sawdustman18 on February 03, 2010, 10:33:23 AM
Greg,

I am not all that savvy with computers how do I post the XML.  Also I have a legacy version of the software and there are 2 XMlL files do you want them both.

Steve
Title: Re: Help with Auto tool zero macro?
Post by: ftec on February 03, 2010, 05:25:09 PM
Quote
I don't see anything in this code fragment that would stop the Z movement once it has been commenced until it has reached Z-30.

G31 is a probe move, so it is inherent in the move to stop when the probe input goes active.

Sawdustman,  will the probe move stop when triggered if you manually enter the "G31 Z-30 F50" in the MDI?

Greg


Thanks Greg, gradually learning to understand this. Btw. my Z zeroing does not stop with the assigned emulating key either but it stops with the real input. Using now Mach 036, was same with 033.
Title: Re: Help with Auto tool zero macro?
Post by: Greolt on February 03, 2010, 06:45:00 PM

I am not all that savvy with computers how do I post the XML.  Also I have a legacy version of the software and there are 2 XMlL files do you want them both.

What do you mean by "Legacy Version".    You should probably be using the latest lockdown version.

The XML will most likely be called, "Mach3Mill.xml", unless you have made a custom one.  Just add it to your post as an attachment.

Greg
Title: Re: Help with Auto tool zero macro?
Post by: sawdustman18 on February 04, 2010, 01:34:49 AM
Greg

I have a legacy cnc machine and it has it's own profile with the xml below.

Steve
Title: Re: Help with Auto tool zero macro?
Post by: Greolt on February 04, 2010, 10:02:31 PM
Steve

I looked at your XML and could see no issues regarding probe input.

While I had it loaded I tried a G31 move and it stopped when the probe input was emulated.

I don't know what else to suggest apart from try a clean reinstall of Mach.

Greg

EDIT:  Just had a thought.   :)

If you are testing on a computer without the driver installed then emulation of the probe input will not work.

Do you have the driver installed?
Title: Re: Help with Auto tool zero macro?
Post by: sawdustman18 on February 05, 2010, 01:31:28 AM
I am running it on both one has the driver installed and the other is not.  both computers are vista if that matters.  I was planning to try it on an old xp computer that I have to see if that works.I have my probe on active hi and I am running 5volts to the mill and a probe lead.  Does it matter how the digitize light is lit?  I was thinking that if it can be emulated that how it lights should not matter.