Hello Guest it is March 28, 2024, 08:42:49 PM

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

0 Members and 1 Guest are viewing this topic.

Offline Davek0974

*
  •  2,606 2,606
    • View Profile
Re: Tool Offset Macro...
« Reply #40 on: July 30, 2016, 12:15:57 PM »
Right, stuff learnt :)

By trial and error I got the math right for tool offsets :)

Made up some sacrificial tools from 2mm ally Tig rods, master ref tool was longest and rest got shorter by random amounts around 10-12mm each

Put master tool (eventually my Haimer probe) in the drill chuck (easy for messing about) and set it manually onto my touch-plate.

Ran my setting macro and stored the master offset, then fitted tool 1 and allowed the macro to auto-probe, then set that as tool 1 in the tool-table.

Rinse and repeat the last step up to tool number 4

Move the knee a bit, put tool zero (ref tool) in the Current Tool box, manually ref the work (top of vise) and set Z zero

Change to tool 2, enter tool 2 in current tool box, MDI'd G0 Z0 and it went exactly where it should,

Repeat the last step with all tools and all went to the exact spot (top of material) - things were looking up, i could now use my four tools without re-refing the surface.


OK, what i did wrong which trashed my Z axis....

I had put tool 1 in the machine and entered tool 1 in the current tool box but then ran an auto-probe routine on the surface, expecting it to just set that tool as Z0 and then be able to carry on as normal with other tools.

I did it again and only sacrificed 6" of Tig rod this time, what happens is this....

Tool comes down at fast probe speed,
Touches off the plate,
Tool lifts 2mm,
Tool then plunges rapidly downwards.

So for some reason it seems you cannot use the 2010 screen simple probe macro with tool length offsets applied????

Scary stuff - so easy to trash things.

Is this normal or total operator failure??

Maybe i should block that macro running if tool number is >0 ??
« Last Edit: July 30, 2016, 12:19:03 PM by Davek0974 »

Offline Hood

*
  •  25,835 25,835
  • Carnoustie, Scotland
    • View Profile
Re: Tool Offset Macro...
« Reply #41 on: July 30, 2016, 04:02:16 PM »
You would probably have to ask Gerry what his macro does, assuming you can not see it.
Think I would look at the M31 macro and adapt it if wanting to use the probing cycle.

Hood

Offline Davek0974

*
  •  2,606 2,606
    • View Profile
Re: Tool Offset Macro...
« Reply #42 on: July 30, 2016, 04:05:46 PM »
Nah, its all accessible - buttons just call macros.

It was the same macro i hacked to bits to create my tool setting routine;)

ill have another look - the crash happens between the first pass and the second so should be easy to read.

Offline Davek0974

*
  •  2,606 2,606
    • View Profile
Re: Tool Offset Macro...
« Reply #43 on: July 31, 2016, 10:32:54 AM »
Just a couple of pics of the busted Z axis coupler and the replacement, I had no idea the original part was cast iron!

New one should be a fair bit stronger.

Offline Davek0974

*
  •  2,606 2,606
    • View Profile
Re: Tool Offset Macro...
« Reply #44 on: August 14, 2016, 10:30:23 AM »
Hmm, i thought I had this working, seems not.

My routine seems to be coming up with odd results, here's the setup...

Ref tool = 126mm long approx
T1 = 145mm long approx

With ref tool in and zeroed at touch-plate surface manually, Machine Z = -66.7062
With T1 in and run to the touch-plate manually, Machine Z = -45.9865
So my length difference = 20.7187mm

I *think* the tool table should show 20.7187 (positive because T1 length > Ref Tool)

BUT

What it's showing is 25.970250 - totally wrong and off by some 5mm.

Anyone care to whale in and offer some help here?
Macro for height setting is below.


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 and others on the Mach3 forum
' Machine Z should be set manually with 3d Height Probe first to top of touch-plate

Dim ZNew, ZMachineEnd
Dim ClearAllow, NewOffSet
Dim Response, Style

Style = 48
If GetOemLED(800) Then
  Response = MsgBox ("Mach In Reset, Enable And Start Again", Style, "Tool-Height Setting")
  End
End If

Style = 48
If GetOemDRO(42) > 0 Then
  Response = MsgBox ("Please Use A Zero Offset Length Tool For This Routine", Style, "Tool-Height Setting")
  End
End If

Style = 3 + 32 + 256
Response = MsgBox ("Reset Reference Tool Offset?", Style, "Tool-Height Setting")
If response = 6 Then 'user pressed yes
  SetVar(500, GetOEMDRO(85))   ' Get Current Z Machine Coordinate at first pass of routine - this was set manually with 3d-Taster
End If
If Response = 2 Then 'user pressed cancel
  End
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

Style = 64
Response = MsgBox ("Please Mount First Tool In Spindle", Style, "Tool-Height Setting")

'//////// 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
  Style = 48
  Response = MsgBox ("Please Change To Working Coordinates", Style, "Tool-Height Setting")
  Exit Sub ' Exit if in Machine Coordinates
End If

If GetOemLED(825)<>0 Then
  Style = 48
  Response = MsgBox ("Touch-Plate Is Grounded, Check Connection And Try Again)", Style, "Tool-Height Setting")
  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

Style = 64
Response = MsgBox ("Ensure Touch-plate Is In Position", Style, "Tool-Height Setting") ' 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 = ZMachineEnd - GetVar(500)'calculate the result

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

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

DoOemButton(121)  'show the tooltable


End Sub                

Offline Hood

*
  •  25,835 25,835
  • Carnoustie, Scotland
    • View Profile
Re: Tool Offset Macro...
« Reply #45 on: August 14, 2016, 10:39:11 AM »
Maybe there is a reason CS-Lab have given the option of M31 rather than G31.

Hood

Offline Davek0974

*
  •  2,606 2,606
    • View Profile
Re: Tool Offset Macro...
« Reply #46 on: August 14, 2016, 10:59:18 AM »
Just been looking at that, Does not make sense yet, seems the M32 part just gets some parameters which are passed to an internal plugin code, it does not say where or how the output is given? It says you can modify it but looks like only the parameter part is accessible?

I need to figure out whats going on in my G31 code i think.

From the CS-Labs site...

"As you all know Mach3 software has G31 function for probing. Using this function we can do precise tool length measurement or determine a location of an edge of our workpiece on a work table."

So it seems G31 should work ok.

Offline Hood

*
  •  25,835 25,835
  • Carnoustie, Scotland
    • View Profile
Re: Tool Offset Macro...
« Reply #47 on: August 14, 2016, 11:20:41 AM »
I think the M31 only writes to Vars or something and it is just a base file for you to add to.
I see they al;so have a Tool Length macro which uses G31, it is in this zip.
http://www.cs-lab.eu/en/upload/macra/macro.zip

Hood

Offline Davek0974

*
  •  2,606 2,606
    • View Profile
Re: Tool Offset Macro...
« Reply #48 on: August 14, 2016, 11:54:27 AM »
Been testing again, fixed one thing, found another :(

The error was caused by my pressing "Apply" when it shows the tool table, if you only press "OK" then it all works fine, no idea why, when it auto-loads the tool table the new value does not show either.

Anyways, after figuring that out I tried it again and this time it plunged the Z down again like it did when it crashed :( It seems it works then something gets upset and thats it - crash time.

It probes fine at rapid, then hits the plate, then plunges when it should lift and probe slowly. It only plunges at hyper speed for a short distance - about 10mm it appears then it slows to correct very slow speed.

So, as i cannot trust it now, that means i can't use probing to populate the tool table. :(

I guess I need a calculator and pencil and paper then - not impressed.

Offline Hood

*
  •  25,835 25,835
  • Carnoustie, Scotland
    • View Profile
Re: Tool Offset Macro...
« Reply #49 on: August 14, 2016, 12:58:53 PM »
Never used tool height setting via Mach so can't help much.
May be an idea to contact CS-Lab and attach the macro and see if they can help.
I did modify the M31 macro for the plasma and it seems to work ok but only done a small amount of testing as the plasma is not finished yet.
Hood