Machsupport Forum

Mach Discussion => FAQs => Topic started by: jroberson on July 18, 2016, 10:21:21 PM

Title: Zero Tool not reading allowance
Post by: jroberson on July 18, 2016, 10:21:21 PM
nHappily marching along with getting my zero tool working, but will not hit top of surface when I go to zero.  Its off 3 - 7mm, at different times, after touch off.
I'm using Mach3 USB, Windows 10, 64 bit, on a SaleCnc 6090 machine, with a zero puck 10mm thick.
I downloaded the HiddenScript from GuruBrew, just to get the tool to retract when it touched off. But when I hit go to 0, it was stopping above workpiece.  I zero-ed
tool above puck before touch off, and  I had changed the script for tool thickness to 10mm.
I went back to the internet, and saw where there was a script for Mach3, but I have not been able to delete the GuruBrew script...
I even tried to trick the script by playing with the thickness setting for 2 hours to zero in, but the machine started going down after touch off?

In addition, how does the Tool Offsets Page Settings fit in with this Hidden Script?
Title: Re: Zero Tool not reading allowance
Post by: ger21 on July 19, 2016, 10:20:11 AM
The "HiddenScript"macro is a placeholder, and should'nt be edited or saved, as it isn't really where the macros reside.

You need to be editing the button script for the auto zero button.
You also should post the macro here if you want help with it.

Title: Re: Zero Tool not reading allowance
Post by: jroberson on July 19, 2016, 06:39:37 PM
Thanks Gerry,

My bad... I should have said " button script" when I was talking about Hidden Script because I saw that in the header.
Here's the macro:

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

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 P3" ' this delay gives me time to get from computer to hold probe in place
Code "G90 G31Z-4. F4" '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, .060) ' change .060 to your plate thickness and then adjust for final accuracy
Sleep 200 'Pause for Dro to update.
Code "G1 Z1. F50" '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   

Thanks
Title: Re: Zero Tool not reading allowance
Post by: Highspeed1964 on July 20, 2016, 05:28:34 PM
"Sleep 200"  should read "Sleep(200)".  Sleep is not a command but a function.  So it may be that the DRO is still updating when it is trying to make the next move.  Also, I find it is good practice to put a sleep function with just a short time (i.e. Sleep(10)) within my While/Wend loops.  This is supposed to give time back to the main processes (like updating DROs, etc.) while you're waiting on the machine to complete its' move.

Hope this helps,

Stephen "Highspeed" Kruse
Title: Re: Zero Tool not reading allowance
Post by: jroberson on July 20, 2016, 07:05:51 PM
Thanks Highspeed,

I'll try that tomorrow...

J.R.
Title: Re: Zero Tool not reading allowance
Post by: jroberson on July 20, 2016, 09:23:53 PM
Highspeed,

I changed Sleep 200 to Sleep(200), but tool goes back to top of puck position when I go to zero z, and message says tool is zeroed?
Since I'm using mm for machine, I changed the following #s:

line 4 Code "G90  G31Z-25. F4"  'probing move
line 11 Call SetDro (2,10)  ' probe thickness
line 13 Code "G1 Z25. F50"  ' Z retract height

Are there any other numbers that might effect script?  I asked earlier how the Tool Offsets Page works with the Button Script?  I was
wondering if the Tool # needs to be set?
Also, I was going to try your suggestion to add a sleep function with a short time, but since I know nothing about code, would you tell me
where to put it within the While/Wend loops?

Thanks Again For Your Help,
JR
Title: Re: Zero Tool not reading allowance
Post by: Highspeed1964 on July 21, 2016, 01:58:22 AM
Sounds like we've got some consistency, now.  Yay!  So the sleep command would go on a separate line between the "While IsMoving()" line and the "Wend" line as follows:

While IsMoving()
Sleep(10)
Wend

Now as far as top of the puck is concerned, that is where the probe actually touches.  Then the DRO should be set to the height of your puck (in my case, 25.69 mm) which would mean that zero should be at the bottom of the puck.  Are you saying that you then try to move to Z0 and it does not go there but remains at the puck height?  Then a couple of other things I see that need to be checked:

Does the probe actually touch the puck surface?  The SetDRO(2, 10) puts the the value of the puck height (10 in this case) into the Z DRO.  So if the probe move did not find the puck it will set the current location to 10 which may be 10 or 15 mm above the actual surface.  G31 is a code that tells the machine to move the Z axis a certain amount and if it detects the probe then stop the move.  However, if it does not detect the probe it will move the full amount and stop there.  Additionally, GetVar(2002) would return random (possibly a previously set) value that would be meaningless to this operation.  The macro should check for the probe to be active before checking the GetVar(2002) and setting the DRO.

Here is a little snippet of the code I use (you can follow along in the comments to see what it's all doing):

ProbeD = 20                                              'Sets how far to probe with the G31 Command below
   Code "G53 G0 Z" & ToolChangeZ         'ToolChangeZ is MC for starting location of probing
   While IsMoving()
      Sleep (10)
   Wend
   ZCurrent = GetOemDro(802)         'Current Z DRO
   ZNew = ZCurrent - ProbeD         'Probe depth end height
   Code "G90F100"               'slow feed rate to 100 MM/MIN
   Code "G31 Z" &ZNew            'Start the probe move
   While IsMoving()
      Sleep(10)
   Wend
   If GetOEMLed(825) = True Then         'Probing successful
      ProbeTouch = GetVar(2002)      'Exact height touch plate was contacted
      Code "G1 Z" & ProbeTouch      'Go there (corrects for potential over-run)
      While IsMoving()
         Sleep(10)
      Wend
      Call SetDro(2,GageH)         'Set Z DRO to adjusted value
      FinalMove = GageH + 10
      Code  "G0 Z" &FinalMove         'Raise probe off of touch plate
      While IsMoving()
         Sleep(10)
      Wend
      Message("Press Cycle Start to continue...")
   Else                  'Probe did not contact touch plate
      Message("Zero not achieved - Check probe and try again manually")
   End If
Else                     'User selected Cancel on Auto Tool Zero prompt


This is not the whole code as I'm doing a lot more in the M6Start macro so some of the variables are defined prior to these lines of code.  However, the line "If GetOEMDed(825) = True" checks that the probe has made contact before performing the commands to set the DRO and raise the tool off of the surface of the puck.  If this check fails and your code proceed to set the DRO you will get unpredictable results.

Finally, I do not use tool offsets as my CAM software adjusts accordingly.  The tool path it generates is already offset.  So I'm not sure how tool offsets would affect this process.  But I would imagine it could affect where the tool tip is after a zeroing operation.  Remember, the coordinate systems (Machine coordinate, Workpiece coordinate, etc.) refer to the location of the tool tip as long as everything is zeroed correctly so if a tool offset is in effect for the Z axis, it could definitely change where the tip actually is..  One other thing that could throw this off would be a G92 offset.  It is really recommended not to use this command unless you fully understand how it would impact the other coordinate systems.  So until we get this figured out for you, make sure your G-Code program is not using it.

We'll get to the bottom of this for you.  Let me know how things go.

Stephen "Highspeed" Kruse
Title: Re: Zero Tool not reading allowance
Post by: jroberson on July 21, 2016, 02:35:53 PM
HighSpeed,
I have a Abnormal Condition yellow tab that I cant find any reason to be on for several days.  How can I get back to Normal Condition?

I inserted the Sleep function and tried to auto zero tool.  It is touching the puck, but when it hit the puck and stopped, it went all the way up home and kept trying
to go higher. It had hit the puck around z -6, stopped, went up to z 23, made several hits to go higher but was at top of z travel, then dro changed to 11.  So, when
I tried Go to Zero, it went back to where I had zeroed tool before running auto zero?

I thought it might help to lower the code for Z retract height in button script from 25 to 15.  When I auto zero again, it hit probe about Z -6, stopped, went up to
Z 28, bumped a few times, then went back down to Z 15.  Go to Zero took me back to where I zeroed tool before running auto tool zero.

I also checked to make sure I was using G58, and puck was working properly.

Any Suggestions?
JR
Title: Re: Zero Tool not reading allowance
Post by: Highspeed1964 on July 21, 2016, 07:51:09 PM
Firstly, that yellow "Abnormal Condition" was a bugger for me, too.  Not related to this tool zero, but rather when I changed the table size in the limits/homing configuration.  What you DO NOT want to do is double click that yellow button and accept the following prompt as this is guaranteed to further muck things up.  I ended up having to start a new profile all over again.

Now having said that, I found since then that you can go to the Operator menu and do a restore.  The system backs up the previous 21 configurations (a new one each time you run Mach 3) so you can back track to a previously known good state... if it's within the last 21 times you've run Mach 3.  What I found out to be my issue was that it seems one of the Y axis limit switches had gotten stuck and that triggered the abnormal condition.  But instead of realizing the issue and fixing it, I double clicked the button and accepted the abnormal condition as normal.

Bottom line here is try to determine what is causing the abnormal condition.  It could be any number of things and I have not found any specific documentation on it.  if you're sure everything is operating normal (with the exception of your tool zeroing) try going back to a previous known good configuration as mentioned above.

Now, regarding that tool zero... could you post the current macro you are using (and what you are using to trigger it, i.e. Auto Tool Zero button or M6 Macro)?  I'm sure there have been a couple of changes or so since you first posted it so let's look at the current state.  Also, G54 is a more common Workpiece offset to use, so if the code is expecting to use G54, but your machine is running in G58 then you are working with two different offsets and this would definitely cause inconsistent operation like this.

Let me know what you find on the abnormal condition and post the current iteration of your macro.  I'll look it over.

We'll get you there.

Highspeed
Title: Re: Zero Tool not reading allowance
Post by: ger21 on July 21, 2016, 09:59:34 PM
The "Abnormal Condition" does not indicate an "abnormal" condition.
It means that at one time you set a "Normal" condition, and you've changed a setting since then.
You can normally just ignore the abnormal condition.


Watch the DRO when the tool touches the puck. It should display 10.000 right after it touches. Does it?
Title: Re: Zero Tool not reading allowance
Post by: jroberson on July 22, 2016, 03:40:02 PM
I tried 3rd time, touched at Z -9, dro changed to +10.???, moved to Z +15.  Go To 0, it went all the way up and came back down 1mm above model surface.
4th try, touched at Z -7, moved up to Z +26, then down to +15.  Go to 0, it went all the way up and came back down 2mm above model surface.
5th try, touched at Z -9, changed to +10.???, moved to +15.  Go to 0, it went all the way up and came back down just touching model surface!  Whoohoo ;D

But Atlas,
6th try, touched at Z -7, moved up to +11, changed to +10.???, then moved to +15.  Go to 0, it went all the way up and came back down where I had zeroed tool before auto zero?

I thought I had something...
JR
Title: Re: Zero Tool not reading allowance
Post by: ger21 on July 22, 2016, 03:45:57 PM
Quote
I tried 3rd time, touched at Z -9, dro changed to +10

Which is correct. When the tool touches your puck, it sets the DRO to the puck thickness, making Z zero the bottom of the puck.


Quote
Go To 0, it went all the way up and came back down 1mm above model surface.

It's going all the way up because of your SafeZ setting.
It sounds like your losing position somewhere between rapid moving to SafeZ, and rapid moving back down.

Try cutting your Z acceleration in half, and reduce the velocity by 25%.
Title: Re: Zero Tool not reading allowance
Post by: jroberson on July 22, 2016, 04:56:39 PM
Gerry,

I dont think you got my previous reply ( 1st & 2nd try / current macro)

1st time, touched puck at Z -18, changed dro to +10, moved to +15.  Go To 0, went all the way up, hit max and stopped.
2nd time, touched puck at Z -10.2, changed dro to -7, then +10, then moved to +15.  Go To 0, went all the way up to +38,
stopped, dro changed to +28.  Never went to zero, I guess it hit limit switch.

I will send current macro for button script in a few minutes.

Thanks Again,
JR
Title: Re: Zero Tool not reading allowance
Post by: jroberson on July 22, 2016, 05:11:48 PM
Gerry,

I thought the button script for retract height would control that, not safe Z?
I try adjusting motor tuning for Z, and let you know what happens.

Heres copy of my current macro for button script:

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

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 P3" ' this delay gives me time to get from computer to hold probe in place
Code "G90 G31Z-25. F4" 'probing move, can set the feed rate here as well as how far to move
While IsMoving() 'wait while it happens
Sleep(10)
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 ()
Sleep(10)
Wend
Call SetDro (2,10)' change .060 to your plate thickness and then adjust for final accuracy
Sleep (200)'Pause for Dro to update.
Code "G1 Z15. F50" 'put the Z retract height you want here, must be greater than the touch plate thickness
While IsMoving ()
Sleep(10)
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                     


Thanks
JR
Title: Re: Zero Tool not reading allowance
Post by: jroberson on July 22, 2016, 05:47:48 PM
Gerry,

I lowered Z motor as suggested, but now when I auto zero and Go To 0, Its now returning to my zero position before I auto zero.  ( Above the Puck) ?
JR
Title: Re: Zero Tool not reading allowance
Post by: ger21 on July 23, 2016, 03:59:20 PM
What version of Mach3 are you using?

Parallel port, or motion controller? If motion controller, which one?
Title: Re: Zero Tool not reading allowance
Post by: jroberson on July 23, 2016, 05:08:25 PM
I have a Mach3 USB motion controller MKX-IV, Version R3.043.066 and I'm running Windows 10 on a new HP All in One.  My machine is from China, SaleCnc, XJ6090.


JR
Title: Re: Zero Tool not reading allowance
Post by: ger21 on July 23, 2016, 05:24:10 PM
Two things.

1) 3.043.066 has serious issues and should not be used, especially with probing.
2) Many chinese motion controllers do not support the GetVar() command.

Try eliminating these lines:

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 ()
Sleep(10)
Wend
Title: Re: Zero Tool not reading allowance
Post by: jroberson on July 23, 2016, 05:44:18 PM
I thought I was getting the latest version when I ordered Mach3 just 2 months ago?  There were no choices then.  Is there another version I can download?

When I return home I will try deleting those lines.

I just realized when I told Highspeed that I was using G58 offset, I was mistaken.  I have been using G54.

Also, I have had intermitten problem with my mouse & keyboard completely stop working, it just did it again.  Usually, it doesnt come back until the next day startup?

Thanks,
JR

Title: Re: Zero Tool not reading allowance
Post by: ger21 on July 23, 2016, 05:52:49 PM
That is the latest (last) version, but it's no good. You need to use an older version. Try 3.043.062 from the FTP site, in the Mach folder.
http://www.machsupport.com/software/downloads-updates/#tabs-6
The current offset in use makes no difference.

If you're mouse and keyboard are USB, try using a different port.
Title: Re: Zero Tool not reading allowance
Post by: Highspeed1964 on July 23, 2016, 06:05:14 PM
Interesting, I'm using 3.043.066 and have had no issues with the Zero probing.  Being somewhat new to this myself, it's the only version I have used.

Regarding your earlier post that showed different readings for each try, is it possible that the offset was correctly set for the previous probe movement and the next one would show the reading in this new offset coordinate value?  Also, are you getting the message "Z axis is now zeroed" on your status line?

Finally, I see Gerry asked you to remove the lines pertaining to the ZProbePos variable and understand the reasoning behind this.  It is something I was not aware of.  However, I have a general coding question for Gerry.  Assuming one DOES use these lines in their code, shouldn't there be a space between the & and the variable name or is VBScript not so particular about that?

In any case, thanks for stepping in with additional help Gerry.  I'm sure we can get this solved for JR.

Stephen "Highspeed" Kruse
Title: Re: Zero Tool not reading allowance
Post by: Highspeed1964 on July 23, 2016, 06:48:42 PM
One additional thought, you had asked if tool offsets could make a difference.  You could try putting a "G49" into the line with the G31 move.  G49 cancels any tool offset so if you still need those after the zero operation (in my opinion tool offsets and zero tool operations are pretty much mutually exclusive - at least in my limited understanding of these things) then you'll need the macro to account for the current offset and restore it at the end.

Highspeed
Title: Re: Zero Tool not reading allowance
Post by: jroberson on July 23, 2016, 09:09:30 PM
Hi Guys,

I downloaded older version of Mach3, but do I have to go through the complete setup again, or how can I transfer all settings from original version?  Delete original version?
Remember, I'm just an ol' cabinetmaker...

I switched mouse and Keyboard to side usb ports and they started working again, but the usb for mach3 motion controller, only worked in the side ports to start with.  
The mouse and Keyboard were in the rear ports, and they are the ones giving me the problem, about every fifth or sixth time I use it?  Could that be hardware or software?
How do I fix it?

I am using an Acer Aspire ZC-700G All in One, 64 bit, new computer, Windows 10, to run Mach3 USB.  The HP I told you about earlier, I use for ArtCam Express.  My Bad.

I appreciate your help,
JR
Title: Re: Zero Tool not reading allowance
Post by: Highspeed1964 on July 23, 2016, 09:59:08 PM
Back up your .xml file and any screen sets you're using if not the default screen set.  Then after you reinstall, put the .xml file back and start up Mach 3 with that profile.  You should be good to go then.

As for the USB ports, not sure what to do there.  It could be an older (or even newer!) USB protocol and have incompatibility with the specific USB device.  For example, my new laptop has 1 USB 2.0 port and 2 USB 3.0 ports.  Fortunately, I have not found any older equipment that I use that is not compatible with the newer 3.0 ports so I'm ok.  I guess if you can live with it not being connected on the back port and use only the side ports you should be ok.

Highspeed
Title: Re: Zero Tool not reading allowance
Post by: ger21 on July 23, 2016, 10:01:14 PM
Just install it right over the version that's installed, and all your settings should remain.

I've seen similar USB keyboard and mouse issues on multiple PC's, and the only thing I can suggest would be a different mouse and keyboard.

Quote
Assuming one DOES use these lines in their code, shouldn't there be a space between the & and the variable name or is VBScript not so particular about that?

I don't think it cares if you have a space or not. I prefer to add the spaces and format the code more consistently, which makes it a lot easier to read.

Quote
Interesting, I'm using 3.043.066 and have had no issues with the Zero probing.  Being somewhat new to this myself, it's the only version I have used.

Since I sell a screenset which is heavily dependent on auto zero probing, I've seen lot's of people with issues. It really depends on the motion controller and plugin that one is using.

I was 2500 miles from home last week, with spotty internet access, so couldn't read forums too often.
Title: Re: Zero Tool not reading allowance
Post by: jroberson on July 24, 2016, 05:10:15 PM
Hey Guys,

Praise The Lord !

When I came back out to my machine this am and started it up, I had controll of mouse/keybd. This was good.

I was trying to find out which version of Mach3 that I downloaded, might be running on my original Mach 3 profile, unsuccessful.  So, I decided to delete the
5 lines that Gerry suggested in button script.  It Worked !   I tried to Auto Zero 4 times, it worked perfect.  Life Is Good.

By the way, how do I find which version is now running on my original profile of Mach3?

Still a few bugs to work out, but I want to go out and Auto Zero my Tool a few more times...

Thanks Again, for hanging in there for me,
JR
Title: Re: Zero Tool not reading allowance
Post by: Highspeed1964 on July 24, 2016, 05:58:21 PM
Hey!  Looks like you're making progress on multiple fronts!  Got the homing working correctly and now this, too.  Congratulations!!!!

To check which version you're running, go to "Help | About Mach3 CNC Controller..." and it'll show you the version right below the "Licensed to:" box.

Highspeed