Hello Guest it is March 28, 2024, 04:22:30 PM

Author Topic: Auto Tool Zero Script  (Read 761 times)

0 Members and 1 Guest are viewing this topic.

Offline kolias

*
  •  1,154 1,154
    • View Profile
Auto Tool Zero Script
« on: July 05, 2022, 02:46:14 PM »
I have been using in the past on Mach3 this scrip and it’s all I need for my needs but after it touches the touch plate it raises the tool up by 1” and then zeros the DRO. I want to raise the tool ONLY 1/2" instead of 1” but I don’t know what I have to change in the script. (I only know the .060 is the thickness of my plate). Do you know what needs to be changed on this script?

Message( "Auto Zeroing..." )
If IsSuchSignal (22) Then
code "G31 Z-3 F20"
While IsMoving()
Wend
Call SetDRO( 2, .060 )
code "G1 Z1"
End If

If there another simple script please let me know

Thanks
Nicolas
Re: Auto Tool Zero Script
« Reply #1 on: July 05, 2022, 02:57:26 PM »
Message( "Auto Zeroing..." )
If IsSuchSignal (22) Then
code "G31 Z-3 F20"
While IsMoving()
Wend
Call SetDRO( 2, .060 )
code "G1 Z0.5"
End If

But it would be quicker if the line was:

code "G0 Z0.5"

What "IsSuchSignal (22)" means I have no idea!

Offline kolias

*
  •  1,154 1,154
    • View Profile
Re: Auto Tool Zero Script
« Reply #2 on: July 05, 2022, 09:13:02 PM »
Many thanks John, no idea either what “If IsSuchSignal (22) Then”

Can you please explain what “code "G31 Z-3 F20" do?
It looks like it tells the Z axis to go down by 3” at speed F20
What will happen if I don’t have 3”? will it stop when it hits the touch plate?

No problem to change the G1 to G0 (BTW what’s the difference between G1 and G0”?


Nicolas
Re: Auto Tool Zero Script
« Reply #3 on: July 06, 2022, 04:54:16 AM »
Well, do you have a copy of the Mach3 manual?  If not you need one for a summary of the G code definitions as well as lots of other relevant info.

The G31 Z-3 F20 command does exactly what you say but G31 is a "straight probe" command.  While it's moving Mach3 continually monitors the state of the probe input and movement stops when the probe triggers.  The value of Z at which trigger happens is written into an internal register though your code doesn't access it, instead just using the value of Z at which the probe stopped (which is probably slightly different as the axis has to decelerate).

The command:
code "G1 Z0.5"
causes the Z axis to move up 0.5 at the last commanded feedrate which is F20 from the G31 command.  Usually there's no reason to move so slowly, using G0 just makes the move at the programmed rapid rate. 

I'd be nervous BTW of making the probe move at F20, that's 20 inches/minute = 500mm/minute!  A more common value would be 50mm/minute, and probe routines often probe at this speed first then take a second go at perhaps 5mm/minute after a very small retract.

I strongly recommend that you learn how G code programming works.  You might never actually write a program to make a part, but it is very useful to have some understanding of what the statements in the code produced by CAM means.  You could for example be able to answer the questions you asked here!
Re: Auto Tool Zero Script
« Reply #4 on: July 06, 2022, 06:53:39 AM »
...also you can do quick precise moves using the MDI screen when setting up.  For example, if you want to move the X axis to a precise position having just jogged it somewhere else, just enter G0 X10 into the MDI box and clock return - the X axis will move to coordinate 10.

Offline kolias

*
  •  1,154 1,154
    • View Profile
Re: Auto Tool Zero Script
« Reply #5 on: July 06, 2022, 09:57:53 AM »
Thanks for your time John and the education,

Actually I do have the Mach3 manual in my cnc binder including all my comments since I first read it about 12 years ago. I also used to read the G code before feeding it to Mach3 to assure all was correct but I forgot a lot about it. I stopped making cnc as a hobby a few years back and went to building wooden clocks but now I’m back at it and slowly I refresh my memory in the cnc building.

From day 1 I knew that G code programming was the key to master Mach3 and although I was never an expert on it I knew enough to be able to add/modify certain lines in the G code text file. Now that text file was not a huge one, just a small one from some simple shapes I was making in Mastercam X5. Before I will start my current cnc, I will have to read again my notes to assure that all is correct.

My thanks again for your time. 
Nicolas