Hello Guest it is November 08, 2024, 09:24:30 PM

Author Topic: Mach3 machine material surface ZERO script  (Read 99719 times)

0 Members and 1 Guest are viewing this topic.

Mach3 machine material surface ZERO script
« on: January 31, 2013, 02:50:24 AM »
Hi All

The script below must have been seen by a lot of users using cnc machines and mach3. A lot of the lines are self explained, but this is the problem i had trying to make this script work for me.
The whole procedure woks fine, and the toolbit moves down , touches the touchplate that is 2mm thick and moves back up. Mach3 tells that machine Z is now ZERO-ed.

The problem i had was this. I had to tell mach3 that my plate was 2.7mm thick and not 2mm in order to get the toolbit to be exactly on the workpiece surface.
Before  the toolbit was always like 1 mm , sometimes 2mm and other times .5 mm above the workpiece surface.
Now i realized that all machines and hardware are different in setup than just inserting the script and expect it to work will not be as easy.

I want to know now, what setting is causing this . My machine is calibrated on the z-axis , so 15mm is 15mm when i use the motor calibration option. Below is the script.

Thanx in advance everyone.
Andre

PlateThickness = 2.0 'Z-plate thickness DRO ' This option i had to change to 2.7mm in order to get it to work properly.

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 P5" ' this delay gives me time to get from computer to hold probe in place
Code "G31 Z-0.5 F5" '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 axact 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, PlateThickness) 'set the Z axis DRO to whatever is set as plate thickness
Code "G4 P0.25" 'Pause for Dro to update.
Code "G0 Z 20.0" 'put the Z retract height you want here
Code "(Z axis is now zeroed)" 'puts this message in the status bar
Else
Code "(Z-Plate is grounded, check connection and try again)" 'this goes in the status bar if aplicable
Exit Sub
End If
Re: Mach3 machine material surface ZERO script
« Reply #1 on: February 07, 2013, 02:58:44 AM »
no ideas ANYBODY !

Offline Tweakie.CNC

*
  • *
  •  9,249 9,249
  • Super Kitty
Re: Mach3 machine material surface ZERO script
« Reply #2 on: February 07, 2013, 05:43:19 AM »
Which Mach screen .set are you using ?

Tweakie.
PEACE
Re: Mach3 machine material surface ZERO script
« Reply #3 on: February 07, 2013, 06:12:54 AM »
Hi

The standard one that comes with the installation. ... no mods.

TX
A

Offline Tweakie.CNC

*
  • *
  •  9,249 9,249
  • Super Kitty
Re: Mach3 machine material surface ZERO script
« Reply #4 on: February 07, 2013, 06:39:43 AM »
Hi Andre,

If it is of any help to you this is the button script that I use (second half of page) and how I have implemented it   http://www.tweakie.byethost10.com/17.htm

Tweakie.
« Last Edit: February 13, 2020, 05:41:22 AM by Tweakie.CNC »
PEACE
Re: Mach3 machine material surface ZERO script
« Reply #5 on: February 11, 2013, 01:51:49 PM »
Hi there
Quote
Code "G31 Z-0.5 F5" 'probing move, can set the feed rate here as well as how far to move

Perhaps the original has been written for inch measurement units.
With millimeters it is a very short move at very slow speed.
"G31 Z-40 F200" would be more appropriate for millimeters. The tool has enough space to move down to touch the plate provided it is positioned before the start at less than 40 mm above the plate.
Re: Mach3 machine material surface ZERO script
« Reply #6 on: March 01, 2013, 11:55:41 AM »
Hi Tweakie, I have implemented your auto-tool-zero button script and it works very nicely with a little height-setting button I've made.  This has an insulated carbide sprung plate on a magnetic base that sits on the mill table.  Being sprung it can cope with tool over travel.  Thanks very much for this, a very nice utility. As you predicted I had a couple of issues with odd unicode characters in the copied code but soon fixed those.  I have a couple of questions.

First, I'd like to use the code as a macro in a program so that after a tool change I can just call the macro from the code - say "M100" - and it will set the tool height then let the program continue.  So I have copied the button code into a file and given it the name M100.m1s, but when I insert that code in a programme or type it into the MDI window, nothing happens!  There's probably something simple I've forgotten about or never knew - any ideas please?

The second thing is that I would like to generate modified code to set the X and Y zeros, using an isolated probe of known diameter I've made.  As you are the copyright owner, may I have your consent to this please as my code is likely to copy many of the same lines?

Thanks,

John.

Offline Tweakie.CNC

*
  • *
  •  9,249 9,249
  • Super Kitty
Re: Mach3 machine material surface ZERO script
« Reply #7 on: March 01, 2013, 12:12:20 PM »
Hi John,

I am pleased to hear that you got it all working OK.

Quote
First, I'd like to use the code as a macro in a program so that after a tool change I can just call the macro from the code - say "M100" - and it will set the tool height then let the program continue.  So I have copied the button code into a file and given it the name M100.m1s, but when I insert that code in a programme or type it into the MDI window, nothing happens!  There's probably something simple I've forgotten about or never knew - any ideas please?

I can't help with this one as it's not something I use and have a sound working knowledge of - but I am sure there are others who can help.

Quote
The second thing is that I would like to generate modified code to set the X and Y zeros, using an isolated probe of known diameter I've made.  As you are the copyright owner, may I have your consent to this please as my code is likely to copy many of the same lines?

My code is yours to do with as you please - it is my pleasure sir.

Tweakie.
PEACE
Re: Mach3 machine material surface ZERO script
« Reply #8 on: March 01, 2013, 12:51:18 PM »
Many thanks!
Re: Mach3 machine material surface ZERO script
« Reply #9 on: March 01, 2013, 01:25:12 PM »
Fixed it!  Little bit of searching on this forum and I found that M codes up to and including 100 appear to be reserved for Mach...so I changed my file name to M999.m1s and it sprung into life!