Hello Guest it is June 13, 2021, 04:23:06 AM

Author Topic: Z probe macro with offset  (Read 13255 times)

0 Members and 1 Guest are viewing this topic.

Offline AVRnj

*
  •  52 52
    • View Profile
Z probe macro with offset
« on: May 18, 2015, 10:49:53 AM »
Hey everyone, I posted this in a different area but I think this area is more appropriate.

I am trying to get my Probe working in Mach3, so I entered 2 tools into my tool table, tool 99 (my probe) at 6.5 height, and tool 30 at 4 height.

I went into the offset tab in Mach3, I changed the tool from 0 to 99 which is my probe, and I am using the following macro for Z:
Code: [Select]
CurrentFeed = GetOemDRO(818) 'Get the current feedrate to return to later
PlateThickness = GetUserDRO(1151) 'Z-plate thickness DRO

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 P2" ' two second delay
Code "G31 Z-1.0 F5" 'Z goes down a max of 1.0 at 5IPM
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 Z1.0" 'retract Z to 1.0 inch
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 aplicable
Exit Sub
End If

When I enter tool 99, the offset light goes green, as I would expect. If I run that macro, it touches, and starts retracting, and then it actually goes up the full 6.5 from the offset, than an extra 1" for the Z1.0, and then it sets my DRO at 1, which is actually way off.

If I manually turn the offset off, and run the macro, it behaves as I would expect, it touches down, retracts 1, and sets the DRO at 1. The problem is, if I do that with the offset off, when I change tools, it does not change the DRO, which is exactly what I would expect.

So, it seems as though I need to use the offsets, but my macro is not working correctly. Can anyone help me out here with this? I have tried a few different macros for this that I found either in things I bought from Hoss, or in various forum posts, and they all behave the same way.

Do I need to reed the tool offset before retracting, and then somehow change my retraction accordingly?

Any help would be appreciated

Offline BR549

*
  •  6,952 6,952
    • View Profile
Re: Z probe macro with offset
« Reply #1 on: May 18, 2015, 11:32:56 AM »
You do not normally set he tool height with an offset already in play.  Also the Macro you are running it not really setting the tool height it is simply Zeroing Z at the tip of the tool.

IF you run the Zero macro you don't need/want the tool length offset in play(active) that is what the macro does it accounts for the tool length to set Z zero. So you would run one OR the other but not both at the same time.

Just a thought, (;-) TP

Offline AVRnj

*
  •  52 52
    • View Profile
Re: Z probe macro with offset
« Reply #2 on: May 18, 2015, 12:18:05 PM »
TP, thanks for the reply.

I am not trying to set tool height, so if that is what this macro is doing, its definitely wrong.

All I am really trying to do is tell Mach3 where my Z zero is, by using the probing, and the tool table. So, for example, my probe has a height of 4, and my end mill has a height of 2, and both of those are in my tool table, I want to use the probe to touch the part, call that Z zero for the probe's height of 4, and when I switch to my end mill tool, it will use the offsets to adjust the z height accordingly.

My tool table works fine. If I manually touch my work piece with an end mill in my tool table, set my DRO to zero, and then change the tool, the DRO adjust automatically to the new tool using the new height.

I am just trying to automate the zeroing out with my probe.

Is that not what this macro is doing?

Offline BR549

*
  •  6,952 6,952
    • View Profile
Re: Z probe macro with offset
« Reply #3 on: May 18, 2015, 01:33:19 PM »
The function you turned on is a special internal function and it links all the dros in that section to the tool table. That is NOT what you need to do .  With it active it is doing exactly what it was designed for , Setting tool height via the tool table. 

When you turn OFF the routine the Macro responds as it should . But since you have not invoked the tool offsets you get what you see.

I think IF you run it all from a Gcode program it will work fine.

(;-) TP



Offline AVRnj

*
  •  52 52
    • View Profile
Re: Z probe macro with offset
« Reply #4 on: May 18, 2015, 02:04:11 PM »
Thanks for your reply again TP.

So I am not sure how to run it from a Gcode program to be honest, I thought it had to be done from a macro, so that you can change the DRO.

The button I am clicking is the Tool Offset On/Off toggle button. When I click it off, not green, the macro works perfectly. But the problem is if I turn offset back on, so that my other tools can use offset, it does not work at all.

Can you help me out with the macro or the process I should be using?

Offline BR549

*
  •  6,952 6,952
    • View Profile
Re: Z probe macro with offset
« Reply #5 on: May 18, 2015, 03:45:35 PM »
The best approach is to MAKE the probe the MASTER tool that everything is reference from. Its offset is always ZERO.   ALL other tools are set as compared to the master tool.

When it is time to setup the Part put the master tool into the Spindle. THEN run the Macro to find the TOM (top of material) it will then auto set the Z to ZERO. Now when you call any other tool the offsets will be correct.

The macro can simply be

Code"G91"
Code"G31 -5.000 F20" 'probe down 5 inches looking for surface
While Ismoving()
Wend
Code"G90"
Code"G00 Z#2002"     'Retract back to contact point
While Ismoving()
Wend
Code"G92 Z0.000"       'Set Z to ZERO
Code"G00 Z1.000"       ' Retract Z back to 1.000


From Gcode

M6 T99   ( change to Tool 99)
G91
G31 Z-5 F20  ( Probe for surface)
G90
G0 Z#2002  ( move back to contact point)
G92 Z0.000  ( set Z to ZERO )
G0 Z1.000   ( retract to Z1.000)

Change tool to 1st tool and start.

(;-) TP


Offline TPS

*
  •  2,177 2,177
    • View Profile
Re: Z probe macro with offset
« Reply #6 on: May 18, 2015, 04:22:49 PM »
Hi AVRnj,

not realy sure what you are trying to do.
in Your macro you are setting the z-axis zero to something (plate height, i asume).

tool hieght is set by g43 H??,

so i am not sure what you want to to,
set the z-axis height,
or set set the tool height ??

Thomas





anything is possible, just try to do it.
if you find some mistakes, in my bad bavarian english,they are yours.

Offline AVRnj

*
  •  52 52
    • View Profile
Re: Z probe macro with offset
« Reply #7 on: May 18, 2015, 04:23:54 PM »
I see what you are saying, but I must be missing something.

If my probe is tool zero with no offset, and say for argument sake my probe has a height of 5". When I put in my first tool, which say has a height of 4", how is it going to know that the new tool is 1" shorter than my tool zero?

I thought that was the whole reason to use offsets to begin with?

Offline AVRnj

*
  •  52 52
    • View Profile
Re: Z probe macro with offset
« Reply #8 on: May 18, 2015, 04:27:33 PM »
Hi AVRnj,

not realy sure what you are trying to do.
in Your macro you are setting the z-axis zero to something (plate height, i asume).

tool hieght is set by g43 H??,

so i am not sure what you want to to,
set the z-axis height,
or set set the tool height ??

Thomas







Thomas, sorry for the confusion with my post.

Here is exactly what I am trying to do:


Say my tool table looks something like this:

Tool 1  Digital Probe Height 4"
Tool 2  End Mill Height 3"
Tool 3 End Mill Height 2"

I want to be able to run a macro with Tool 1, my digital probe in the spindle, to touch zero on my work material, and have the DRO set to that zero for tool 1, and its 4" height.

Then, when I switch to tool 2, wherever my Z is, Mach3 should then adjust the Z DRO to be 1" less than it was when probed, which is correct.

Does that make sense?

Offline TPS

*
  •  2,177 2,177
    • View Profile
Re: Z probe macro with offset
« Reply #9 on: May 18, 2015, 04:47:01 PM »
OK,

again try to "play" a little bit with
G43 H??

G43H0 is your master, an then you will understand this
tool hight thing.

Thomas
« Last Edit: May 18, 2015, 04:48:36 PM by TPS »
anything is possible, just try to do it.
if you find some mistakes, in my bad bavarian english,they are yours.