Hello Guest it is July 21, 2019, 09:34:22 AM

Author Topic: Problem with Auto Zero Script  (Read 4123 times)

0 Members and 1 Guest are viewing this topic.

Problem with Auto Zero Script
« on: March 14, 2009, 08:28:15 PM »
This is driving me crazy. I am running ver 3.042.021. I have added this code to my "Auto Tool Zero" button in Mach, which I got from this forum.  If I step through the code it works perfectly, and the machine stops at +0.438. This is .500 above the work piece. If I run it by clicking the button it adds the touch plate thickness to the retract height, or .562.  If I run it again it then retracts to .624. I couple of times it has doubled the height. If I edit the script and single step through it it works and stops at 0.438. I have tried increasing the dwell times (I am set for milliseconds) which had the same results. What am I doing wrong?  I am running out of ideas and hair.....
RJ  ???
Re: Problem with Auto Zero Script
« Reply #1 on: March 14, 2009, 11:20:03 PM »
I notice you have one invalid line in there:

   Code "(Z axis is now zeroed and at   )" &RetractHeight

This will feed a line to Mach that looks like this:

   (Z axis is now zeroed and at   ) 0.4620

Mach will ignore the part in parentheses, but will be confused by the following number, and will probably not execute the rest of the macro, and won't re-set the proper coordinate mode.  If you invoke the macro while in incremental mode, that would explain your problem.

That line should read:

   Code "(Z axis is now zeroed and at  " & RetractHeight & ")"

Regards,
Ray L.
Regards,
Ray L.
Re: Problem with Auto Zero Script
« Reply #2 on: March 14, 2009, 11:36:52 PM »
Hi Ray, 
Thanks for the reply. I was trying to get Mach to tell me what the variable was when not stepping through the macro. So if I want to output a variable in the message the format should be Code "(message string " & var goes here & ")" . Thanks for that   ;D. In my start up I do a G90, so I am in the ABS mode. I will try that tomorrow, I have shut it all down for the night. I believe that it is your script that I am using, so Thanks for the script.
RJ

Re: Problem with Auto Zero Script
« Reply #3 on: March 15, 2009, 01:36:04 PM »
I modified the script and it displays the variable properly now.
Thanks. What I am trying to do is zero out the Z and retract to .500 above the work. I ran the script and it still does not work properly. If I step through it works the way I think it is supposed to. DRO reads 0.438 and is .500 above the work.  If I run the script with the hiddenscript.mls window open, I noticed that the Z DRO reads correct for just a second then it updates to higher number than the retract height. I preset the height over the touch plate to several values (.100, .200) then run the code. Checking the variable after the script runs Each time i run it it appears to adds the value of the ZTouchDRO var(2002) to the DRO after the script is done. The Z DRO matches the DRO on the machine, so its moving the right number of steps, just not the right number. Do I need to zero the ZTouchDRO var, or do a SetVar(2002,0) call before the code ends or maybe both?
Thanks,
RJ
Re: Problem with Auto Zero Script
« Reply #4 on: March 15, 2009, 03:30:30 PM »
RJ,

   Startup Mach fresh, and look near the top-right corner of the screen, where the current modes are indicated.  Make sure it indicates G90.  Now run the macro, and again check that it still says G90.  It sounds to me like G91 is getting set.  This could happen in the script, if the AbsoluteModeLED is not getting read reliably.  I know when I wrote the script, I found the IncrementalModeLED did NOT work correctly, which is why I did it the way I did.  The original script I started with did not check or set this mode at all.

Regards,
Ray L.
Regards,
Ray L.
Re: Problem with Auto Zero Script
« Reply #5 on: March 15, 2009, 06:37:32 PM »
Ray,

Mach was in the G90 mode, and the code said that it was and did not change after running the code. After trying a few things, what worked for me was to comment out the 'Call SetDro(ZDRO, 0.0000)'. Everything worked after that. I am still learning the ins and outs of the OEM codes. Thanks for the help. Now to cut some chips..... ;D

Still have hair left,
RJ

ps I don't post a lot because I find if you do a little research, you can find most of the questions have already been asked ( and answered ). So A big thanks to everyone in the forum also.
Re: Problem with Auto Zero Script
« Reply #6 on: March 15, 2009, 11:22:25 PM »
This is driving me crazy. I am running ver 3.042.021. I have added this code to my "Auto Tool Zero" button in Mach, which I got from this forum.  If I step through the code it works perfectly, and the machine stops at +0.438. This is .500 above the work piece. If I run it by clicking the button it adds the touch plate thickness to the retract height, or .562.  If I run it again it then retracts to .624. I couple of times it has doubled the height. If I edit the script and single step through it it works and stops at 0.438. I have tried increasing the dwell times (I am set for milliseconds) which had the same results. What am I doing wrong?  I am running out of ideas and hair.....
RJ  ???

I'm afrarid that doesn't make a lot of sense....  Without that, you can't be certain the probe move will move at all, or may move the wrong direction, depending on your starting position.  In any case, it shouldn't prevent the rest of the macro from working if the probe move does work correctly.  There's something funny going on in there....

Regards,
Ray L.
Regards,
Ray L.