Hello Guest it is December 03, 2020, 09:17:57 AM

Author Topic: Zero Tool not reading allowance  (Read 6693 times)

0 Members and 1 Guest are viewing this topic.

Zero Tool not reading allowance
« 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?

Offline ger21

*
  • *
  •  6,287 6,287
    • View Profile
    • The CNC Woodworker
Re: Zero Tool not reading allowance
« Reply #1 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.

Gerry

2010 Screenset
http://www.thecncwoodworker.com/2010.html

JointCAM Dovetail and Box Joint software
http://www.g-forcecnc.com/jointcam.html
Re: Zero Tool not reading allowance
« Reply #2 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
Re: Zero Tool not reading allowance
« Reply #3 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
Re: Zero Tool not reading allowance
« Reply #4 on: July 20, 2016, 07:05:51 PM »
Thanks Highspeed,

I'll try that tomorrow...

J.R.
Re: Zero Tool not reading allowance
« Reply #5 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
Re: Zero Tool not reading allowance
« Reply #6 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
« Last Edit: July 21, 2016, 02:07:42 AM by Highspeed1964 »
Re: Zero Tool not reading allowance
« Reply #7 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
Re: Zero Tool not reading allowance
« Reply #8 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
« Last Edit: July 21, 2016, 07:53:29 PM by Highspeed1964 »

Offline ger21

*
  • *
  •  6,287 6,287
    • View Profile
    • The CNC Woodworker
Re: Zero Tool not reading allowance
« Reply #9 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?
Gerry

2010 Screenset
http://www.thecncwoodworker.com/2010.html

JointCAM Dovetail and Box Joint software
http://www.g-forcecnc.com/jointcam.html