Hello Guest it is March 29, 2024, 05:37:36 AM

Author Topic: Manual tool change w/ Settings from Mach3 : Code review needed  (Read 14472 times)

0 Members and 1 Guest are viewing this topic.

Offline Haik

*
  •  71 71
  • MachUser
    • View Profile
Manual tool change w/ Settings from Mach3 : Code review needed
« on: February 14, 2007, 04:31:05 PM »
I'm a little new to Mach3 and though I searched profusely I could not find code that supported the native "Tool Change Location" feature that's in Mach3's "Settings" area.

I just need to do simple manual tool changing without loosing coords and ruining my stock.
Will my code below do the trick?

Thanks in advance!

-Hbaba


':::::::::::::::::::
'::: M6Start.m1s ::: Allows use of Mach3's "Settings"|"Tool Change Information" to
'::::::::::::::::::: assist manual tool changes and return to tool coords to continue machining.

 toolChangeX = GetOEMDRO(1200)
 toolChangeY = GetOEMDRO(1201)
 toolChangeZ = GetOEMDRO(1202)

 currX = GetOEMDRO(83)
 currY = GetOEMDRO(84)
 currZ = GetOEMDRO(85)

 currTool = GetOEMDRO(824) 'Tool Information:Tool# in Mach3 from GCode

 Declare Sub Sleep Lib "Kernel32" (ByVal dwMilliseconds As Long)

 '::: Move up (from stock) then over to Tool Change Location
 Code "G0Z" & toolChangeZ
 Code "G0X" & toolChangeX & "Y" & toolChangeY

 '::: While the machine is in motion lets slow our app down to conserve CPU cycles
 While IsMoving()
  Sleep(10)
 Wend

 '::: Stop process, alert operator, provide next tool #, allow operator to continue
 MsgBox("   Change current tool to new tool #" & GetOEMDRO(824) & Chr(13) & Chr(10) & Chr(13) & Chr(10) & "Click ""OK"" after tool change is complete" & "   ")

 '::: Move back (to stock) and then down to work coordinance
 Code "G0X" & currX & "Y" & currY
 Code "G0Z" & currZ

 '::: While the machine is in motion lets slow our app down to conserve CPU cycles
 While IsMoving()
  Sleep(10)
 Wend


'::: DEBUG and reference...

'::: Show Tool Change Location>
' MsgBox("Tool Change Location ::: GetOEMDRO(n)" & Chr(13) & Chr(10) & Chr(13) & Chr(10) & _
'    "X  n=1200:  " & GetOEMDRO(1200) & _
'   Chr(13) & Chr(10) & _
'   "Y  n=1201:  " & GetOEMDRO(1201) & _
'   Chr(13) & Chr(10) & _
'   "Z  n=1202:  " & GetOEMDRO(1202))

':::Show Current DRO values
' MsgBox("Current DROs {Machine Coords} ::: GetOEMDRO(n)" & Chr(13) & Chr(10) & Chr(13) & Chr(10) & _
'    "X  n=83:  " & GetOEMDRO(83) & _
'   Chr(13) & Chr(10) & _
'   "Y  n=84:  " & GetOEMDRO(84) & _
'   Chr(13) & Chr(10) & _
'   "Z  n=85:  " & GetOEMDRO(85) & _
'   Chr(13) & Chr(10) & _
'   "A  n=86:  " & GetOEMDRO(86) & _
'   Chr(13) & Chr(10) & _
'   "B  n=87:  " & GetOEMDRO(87) & _
'   Chr(13) & Chr(10) & _
'   "C  n=88:  " & GetOEMDRO(88))

Offline Graham Waterworth

*
  • *
  •  2,668 2,668
  • Yorkshire Dales, England
    • View Profile
Re: Manual tool change w/ Settings from Mach3 : Code review needed
« Reply #1 on: February 14, 2007, 06:25:16 PM »
The only problem I can see with what you are doing is that you are not talking into account the tool length offsets.

If the tools are set to exactly the same length then you can go back to the same place.  If the second tool is longer then there is going to be a big bang.

The other thing is you don't need to do all this to change tools manually.

If you set up your tools in the tool offset table you can run some thing like this:-

G21 G40 G00 G99 G17

N1 (TOOL 1)
T1 M6
S1000 M3
G00 G43 X0 Y0 Z25.
Z1.
G01 Z-1. F50.
G00 Z100.
M0

N2 (T00L 2)
T2 M6
S750 M3
G00 G43 X0 Y0 Z25.
Z1.
G01 Z-1. F25.
G00 Z100.
M0

N3 (TOOL 3)
T3 M6
Etc....

Graham.
Without engineers the world stops

Offline Haik

*
  •  71 71
  • MachUser
    • View Profile
Re: Manual tool change w/ Settings from Mach3 : Code review needed
« Reply #2 on: February 16, 2007, 02:44:47 AM »
Got it, though I do need to learn more about the "Offsets" page, I am trying to keep the end-to-end process automated and at some point I will have auto tool changing.
I use CAD and then CAM. My CAM exports to GCode that has complete tool info and changes within.

Is there a use for the "Settings|Tool Change Location" feature or is that just a legacy item?

Thank so much for the detailed reply!

-Haik

Offline Graham Waterworth

*
  • *
  •  2,668 2,668
  • Yorkshire Dales, England
    • View Profile
Re: Manual tool change w/ Settings from Mach3 : Code review needed
« Reply #3 on: February 16, 2007, 04:15:37 AM »
Hi Haik,

The tool offsets are quite easy to understand. They are the difference in length from tool 1

If you always use tool one as the datum tool, i.e. you touch this on the top of the work piece and set your Z zero at this point.

Then move your Z up out of the way and load tool 2.

Wind tool 2 down until it touches the top of the work.

The reading in the Z dro is the offset for tool 2

This figure you enter in to tool 2 offset for length.

Just keep repeating this for the rest of your tools entering the value into there tool offset.

The only time you need to change the offset table is if you use a different tool 1 or you need to change a cutting tool

If like me you make tool 1 a touch probe life gets even easier as tool one never changes.

Graham.
 
Without engineers the world stops

Offline Graham Waterworth

*
  • *
  •  2,668 2,668
  • Yorkshire Dales, England
    • View Profile
Re: Manual tool change w/ Settings from Mach3 : Code review needed
« Reply #4 on: February 16, 2007, 04:23:59 AM »
The tool change location is for when you have an auto changer.

Graham.
Without engineers the world stops

Offline Sabre

*
  •  11 11
    • View Profile
Re: Manual tool change w/ Settings from Mach3 : Code review needed
« Reply #5 on: January 22, 2016, 08:54:02 AM »
Thanks for this information Graham . I was reading and had a Noob question I hope someone can answer.

How do you make sure that your tool shaft is manually inserted at the same height / spindle location each time so the offsets that you enter the first time stay the same going forward?

Thanks





Hi Haik,

The tool offsets are quite easy to understand. They are the difference in length from tool 1

If you always use tool one as the datum tool, i.e. you touch this on the top of the work piece and set your Z zero at this point.

Then move your Z up out of the way and load tool 2.

Wind tool 2 down until it touches the top of the work.

The reading in the Z dro is the offset for tool 2

This figure you enter in to tool 2 offset for length.

Just keep repeating this for the rest of your tools entering the value into there tool offset.

The only time you need to change the offset table is if you use a different tool 1 or you need to change a cutting tool

If like me you make tool 1 a touch probe life gets even easier as tool one never changes.

Graham.