Machsupport Forum

Mach Discussion => General Mach Discussion => Topic started by: Llaves on April 09, 2016, 05:56:11 PM

Title: Z-Probe macro for inches and millimeters
Post by: Llaves on April 09, 2016, 05:56:11 PM
This Z-probe macro that works fine for me, as long as Mach3 is in inches:

Code: [Select]
Message( "Auto Zeroing..." )
If IsSuchSignal (22) Then
code "G31 Z-1 F10"
While IsMoving()
Wend
Call SetDRO( 2, .996 )
code "G1 Z1.5"
End If
 

But if the previous program is in millimeters, the distances and speeds are all wrong. I've tried adding a G20 ahead of the G31 in the code statement, but it appears to have no effect.
Any idea how to make this work?
Thanks
Title: Re: Z-Probe macro for inches and millimeters
Post by: Tweakie.CNC on April 10, 2016, 07:21:32 AM
Try putting the G20 on a separate line


Message( "Auto Zeroing..." )
Code “G20”
While IsMoving()
Wend
If IsSuchSignal (22) Then
code “G31 Z-1 F10”
While IsMoving()
Wend
Call SetDRO( 2, .996 )
code “G1 Z1.5”
End If


Tweakie.
Title: Re: Z-Probe macro for inches and millimeters
Post by: Llaves on April 14, 2016, 12:12:05 PM
That worked. Thanks.
Is there an explanation why you can't combine G20 on the same block/line? I've encountered this before in my Mach3 initialization string. I have "G80 G20 F1875". I had originally tried setting the F parameter in inches, but the controller is still in millimeters when this line is processed. Obviously the same problem is occurring here, but why?
Title: Re: Z-Probe macro for inches and millimeters
Post by: Tweakie.CNC on April 14, 2016, 12:35:40 PM
Ahh, the peculiarities of Mach3 abound.

Obviously there is an explanation but I don't have much interest in why, I just try to remember what works and what doesn't work and then go from there.  ;)

Tweakie.
Title: Re: Z-Probe macro for inches and millimeters
Post by: Llaves on April 14, 2016, 12:43:13 PM
Ahh, the peculiarities of Mach3 abound.

Obviously there is an explanation but I don't have much interest in why, I just try to remember what works and what doesn't work and then go from there.  ;)

Tweakie.

Fair enough.
But is there a way to make the G20 work in the initialization so that the F parameter is inches? Some extra punctuation, perhaps?
Title: Re: Z-Probe macro for inches and millimeters
Post by: Tweakie.CNC on April 15, 2016, 01:49:19 AM
There is no problem including the G20 in the initialization string to force the machine to operate in Inch units of dimension.
It is however always best to have Mach3 set-up with separate profiles for Inch and Millimeter units and then choose the appropriate profile at start-up.

Different versions of Mach3 may behave differently when it comes to the units of Feed-Rate so, unless someone else knows for sure, I will have to carry out a few tests on my machine regarding G20/G21 and F#### and report back on this one.

Tweakie.