Hello Guest it is September 21, 2019, 12:15:34 PM

Author Topic: Tool Offset Macro...  (Read 24889 times)

0 Members and 1 Guest are viewing this topic.

Offline Hood

*
  •  25,853 25,853
  • Carnoustie, Scotland
    • View Profile
Re: Tool Offset Macro...
« Reply #20 on: July 29, 2016, 05:24:10 AM »
Ah yes memories flooding back now, I used to use a home made probe for the Z touch off \(and edge finding) before I made the setter and the DRO was the normal work offsets Z DRO.
Just looked for the probe I made, not used it for a long time, here it is .
https://youtu.be/zsspbAu9bZE

Hood

Offline Hood

*
  •  25,853 25,853
  • Carnoustie, Scotland
    • View Profile
Re: Tool Offset Macro...
« Reply #21 on: July 29, 2016, 05:25:36 AM »
It is the normal Z DRO I think, memories coming back to how I originally did it and I had the VB in a button looking at the Z DRO. So you would have to add a button but no DRO.
Hood

Offline Davek0974

*
  •  2,577 2,577
    • View Profile
    • DD Metal Products Ltd
Re: Tool Offset Macro...
« Reply #22 on: July 29, 2016, 05:26:25 AM »
Obviously this is all manual and requires you to jog via the MPG but as the CSMIO MPG jogging is so accurate and predictable compared to Machs normal method, it is no real hardship :)
Hood

Ah, i was looking at using a probing routine of some sort, if doing it manual, how would i know the tool is at a repeatable zero? The difference between 0 and -0.1 or -0.2mm in "feel" is bugger all really until it comes to a cut ;)

Bridgeport Mill, Mach3 V062, CSMIO-IP/A controller, AC Servo Drives

Offline Hood

*
  •  25,853 25,853
  • Carnoustie, Scotland
    • View Profile
Re: Tool Offset Macro...
« Reply #23 on: July 29, 2016, 05:29:10 AM »
Well I suppose you could use a probing routine, just I did it manually. However if you had a LED connected to the plate then it would be very accurate and you can set the IP-A to jog at 0.001mm if you want :)

Hood

Offline Davek0974

*
  •  2,577 2,577
    • View Profile
    • DD Metal Products Ltd
Re: Tool Offset Macro...
« Reply #24 on: July 29, 2016, 05:37:33 AM »
Ah so a modified 'set tool' button with your code at the end and a simple probe routine at the start sounds possible - why jog when you can probe :)

No need to take the touch-plate thickness into account as the 3d-taster will be referenced to to that anyway.

I have a vision now, a bit cloudy still but clearing.....
Bridgeport Mill, Mach3 V062, CSMIO-IP/A controller, AC Servo Drives

Offline Hood

*
  •  25,853 25,853
  • Carnoustie, Scotland
    • View Profile
Re: Tool Offset Macro...
« Reply #25 on: July 29, 2016, 05:40:44 AM »
The code would have to be modified to look at the Z DRO rather than the user DRO or maybe even would have to look atthe variables, depends how your probing macro works.

As said I do all the setting off the machine so no jogging required for me  except for the actual top of material with the Haimer.
Hood

Offline Davek0974

*
  •  2,577 2,577
    • View Profile
    • DD Metal Products Ltd
Re: Tool Offset Macro...
« Reply #26 on: July 29, 2016, 05:53:32 AM »
Is that the Z machine DRO?

I guess so.

I'll have a look at some code and see what can be done.

train of thought.....

Place 3d probe and ref it then zero the work DRO.

the setting routine would first copy the machine DRO to a #var
probe fast,
probe slow,
the point when it hits the plate for the slow probe would then read the machine DRO and compare to the first stored reading - the difference would then be passed to the VB code to store it?
Bridgeport Mill, Mach3 V062, CSMIO-IP/A controller, AC Servo Drives

Offline Davek0974

*
  •  2,577 2,577
    • View Profile
    • DD Metal Products Ltd
Re: Tool Offset Macro...
« Reply #27 on: July 29, 2016, 06:22:20 AM »
Ok, a little more thought....

Place 3d probe and ref it, no need to zero anything.

Press the 'set tool' button...
the setting routine would first copy the current machine DRO to a #var
move Z in machine co-ords to Zero so that drawbar can be undone and new tool fitted,
probe fast,
probe slow (more accurate),
at the point when it hits the plate for the slow probe it would then read the machine DRO and compare to the first stored reading - the difference would then be passed to the VB code to store it in the tool table
Bridgeport Mill, Mach3 V062, CSMIO-IP/A controller, AC Servo Drives

Offline Hood

*
  •  25,853 25,853
  • Carnoustie, Scotland
    • View Profile
Re: Tool Offset Macro...
« Reply #28 on: July 29, 2016, 07:01:10 AM »
Yes that sounds like it may work, I just used machine coords DRO but as said that was manually touching off per tool.
I think it doesnt really matter where you take the reference from whether machine or work coords  or for that matter some arbitrary DRO value like with my tool setter. The important thing is it is all from a repeatable position, as said I use the Machine zero for X and Z on my lathe as the reference point as that is very accurate being Index homing and never changes.
Hood

Offline Davek0974

*
  •  2,577 2,577
    • View Profile
    • DD Metal Products Ltd
Re: Tool Offset Macro...
« Reply #29 on: July 29, 2016, 08:52:23 AM »
Ok, on paper at least, I think this macro will work ;) ...

Ref machine,
Place 3-taster in spindle,
Place touch-plate,
Jog Z to zero on plate,
Press macro start button or MDI it

User is asked if they want to store the new reference offset (this bit needs automating somehow)
If yes then current Z machine DRO is stored in var

then z raises to zero so drawbar can be released

user prompted to fit first tool

height is probed

difference in new z machine DRO and reference one calculated and passed to code for storage in tool table as per Hoods' idea (nice)

rinse and repeat



Code: [Select]
Sub Main()
' Tool Height Offset Measuring
' Based on the macros created be Big Tex -  May 25 2010
' and modified by D. Kearley 29 July 2017 with help from Hood via Mach3 forum
' Machine Z should be set with 3d Height Probe first to top of touch-plate

Dim ZNew, ZMachineEnd
Dim ClearAllow, NewOffSet

If GetOemLED(800) Then
  MsgBox ("Mach In Reset, Enable And Start Again")
  End
End If

If MsgBox ("Reset Reference Tool Offset?", 260, "Master Reset")=6 Then
  SetVar(500, GetOEMDRO(85))   ' Get Current Z Machine Coordinate at first pass of routine - this was set manually with 3d-Taster
End If

' Move the Z axis up so 3d-taster can be replaced with a tool
Code "G0 G53 Z0" 'move in machine coordinates to Z zero

MsgBox "Please Mount First Tool In Spindle"

'//////// the block below will set all your reusable vars depending on Inch or mm.
'//////// this sets the vars so you only need ONE large block of probing code.

If GetOEMLED(801) Then  ' On = English Measure INCH
  FirstProbeDist = 6.0 ' Probe down 6 inches
  FirstRetractDist = 0.05 ' Then retract .05 inch
  SecProbeDist = 0.25 ' Then probe down .25 inches
  FirstProbeFeed = 10.0 ' First probe feed @ 10 ipm
  SecondProbeFeed = 1.0 ' Second probe feed @ 1 ipm
  ClearAllow = 0.125 ' Max Allowable Clearance = Z Machine Zero - .125in
Else ' Off = Metric Measure MM
  FirstProbeDist = 150.0 ' Probe down 150mm
  FirstRetractDist = 1.0 ' Then retract 1mm
  SecProbeDist = 6.0 ' Then probe down 6mm
  FirstProbeFeed = 250.0 ' First probe feed @ 250 mm/min
  SecondProbeFeed = 25.0 ' Second probe feed @ 25 mm/min
  ClearAllow = 2.0 ' Max Allowable Clearance = Z Machine Zero - 2mm
End If

'//////// Error Condition checking...

If GetOemLED(16)<>0 Then ' Check for Machine Coordinates
  Code "(Please change to working coordinates)"
  Exit Sub ' Exit if in Machine Coordinates
End If

If GetOemLED(825)<>0 Then
  Code "(Touch-Plate Is Grounded Check connection and try again)"
  Exit Sub ' Exit if probe is tripped
End If

'//////// Start Probing Code, Probe In -Z direction.
'//////// The vars will be Inch or Metric from above if/else statment

MsgBox "Touch-plate should be in position" ' Get user to check probe plate

Code "F" & FirstProbeFeed ' Set feedrate to 10 ipm or 300mm/min
Code "(Probing for Z Zero.....)" ' Puts this message in the status bar
ZNew = (GetOEMDro(802) - FirstProbeDist ) ' Probe move to current Z - 6 inches
Code "G90 G31 Z" & Znew
  While IsMoving() ' Wait for probe move to finish
  Wend
ZNew = GetVar(2002) ' Read the touch point
Code "G0 Z" & ( ZNew + FirstRetractDist ) ' Move up .05 inch or 1mm in case of overshoot
  While IsMoving()
  Wend

Code "F" & SecondProbeFeed ' Set feedrate to 1 ipm or 25mm/min
ZNew = (GetOEMDro(802) - SecProbeDist ) ' Probe move to current Z - .25 inches
Code "G90 G31 Z" & Znew
  While IsMoving()
  Wend
ZNew = GetVar(2002) ' Read the touch point
ZMachineEnd = GetVar(2002) 'store the final machine co-ordinate

Code "G0 G53 Z0" 'Fully Retract the Z ready for next tool
While IsMoving()
Wend

NewOffset = GetVar(500) - ZMachineEnd 'calculate the result

Tool = Question("Enter Tool Number For This Offset")

Code "G90" & "G10" & "L1" & "P" & Tool &"Z" & NewOffset

DoOemButton(121)  'show the tool table

End Sub    

What we reckon ?? :)

Will have a play with it tonight on the machine just to see what happens.
« Last Edit: July 29, 2016, 08:55:11 AM by Davek0974 »
Bridgeport Mill, Mach3 V062, CSMIO-IP/A controller, AC Servo Drives