开云体育

ctrl + shift + ? for shortcuts
© 2025 开云体育

Tool change macro


barker806
 

Here is the macro that I have made and it seems to work very well.
What it will do is retract the spindle to Z-.1 (mach) You change the
tool and move it where ever you like. Than it will rappid back to the
XYpos and do the height offset for the tool you loaded.

I hope you like it
Brian

M6start


tool = GetSelectedTool()
x = GetToolChangeStart( 0 )
y = GetToolChangeStart( 1 )
z = GetToolChangeStart( 2 )
a = GetToolChangeStart( 3 )
b = GetToolChangeStart( 4 )
c = GetToolChangeStart( 5 )

code "G00 G53 Z-.1"


SetCurrentTool( tool )

M6END

tool = GetSelectedTool()
x = GetToolChangeStart( 0 )
y = GetToolChangeStart( 1 )
z = GetToolChangeStart( 2 )
a = GetToolChangeStart( 3 )
b = GetToolChangeStart( 4 )
c = GetToolChangeStart( 5 )


code ("G43 Z-.1 H" & tool)
code ("G00 X" &x & "Y" &y & "A" &a)


Art
 

Brian:

code ("G00 X" &x & "Y" &y & "A" &a)
Wow, string formatting within a macro.. Great Work!!!

Art
www.artofcnc.ca


Lee Studley
 

Very Cool, this is exactly the type of example I was seeking.
Thanks,
-Lee



--- In mach1mach2cnc@..., "barker806" <barker1@m...>
wrote:
Here is the macro that I have made and it seems to work very well.
What it will do is retract the spindle to Z-.1 (mach) You change
the
tool and move it where ever you like. Than it will rappid back to
the
XYpos and do the height offset for the tool you loaded.

I hope you like it
Brian

M6start


tool = GetSelectedTool()
x = GetToolChangeStart( 0 )
y = GetToolChangeStart( 1 )
z = GetToolChangeStart( 2 )
a = GetToolChangeStart( 3 )
b = GetToolChangeStart( 4 )
c = GetToolChangeStart( 5 )

code "G00 G53 Z-.1"


SetCurrentTool( tool )

M6END

tool = GetSelectedTool()
x = GetToolChangeStart( 0 )
y = GetToolChangeStart( 1 )
z = GetToolChangeStart( 2 )
a = GetToolChangeStart( 3 )
b = GetToolChangeStart( 4 )
c = GetToolChangeStart( 5 )


code ("G43 Z-.1 H" & tool)
code ("G00 X" &x & "Y" &y & "A" &a)