M6 Tool-Change Macro

This is where you talk about Macros, show examples of your macro scripting and SHARE handy segments of script code as examples.

M6 Tool-Change Macro

Postby krsykes23 » Sun May 15, 2022 6:55 pm

I hope someone can help with this. I have an 8 position tool-rack and ATC, which I'm pleased to have now sorted out the majority of the issues I was having.

I have edited the //Example linear tool-changer code M6 macro and got it almost working but I need a small adjustment. I have tried a few times but can't seem to find the the right place in the macro to add the lines!

I edited and tested the M6 macro without any tool-holders in the spindle or the rack, to ensure no collisions. When doing a tool-change, it moves in the X and Y axis together, and therefore hits a tool in the rack. This seems more noticeable when a tool-change is required and the machine is at Home. This is only required when doing 'Manual' tool-changes by pressing one of the T1-T8 buttons, as when code is running, the X and Y axis will be away from the Home position

As I mentioned, I have edited the macro and got it almost working. I have added lines to try and move the X axis back to G53 X60 but only at SafeZ (-5), to prevent a tool in the spindle hitting any others in the rack.

It almost works but needs some tweaking. If someone could assist, and add //comments where the changes or additions have been made, that would be appreciated.
Attachments
8_Station_Tool_Rack.jpg
M6.txt
(3.86 KiB) Downloaded 182 times
krsykes23
 
Posts: 39
Joined: Wed Apr 27, 2022 9:29 am

Re: M6 Tool-Change Macro

Postby ger21 » Mon May 16, 2022 4:58 pm

Can you explain EXACTLY what you need it to do?
Gerry
UCCNC 2022 Screenset - http://www.thecncwoodworker.com/2022.html
ger21
 
Posts: 2671
Joined: Sat Sep 03, 2016 2:17 am

Re: M6 Tool-Change Macro

Postby krsykes23 » Mon May 16, 2022 7:46 pm

ger21 wrote:Can you explain EXACTLY what you need it to do?


Hi Gerry,

Basically, every time it tool-changes, at SafeZ it needs to move to G53 X60 (without a Y movement), as it's not a 'slide-in' tool holder but a 'drop-in'. This is worse when at Home/Ref, as the X axis is at M/C X0 and a collision will happen when a New Tool is picked up. That said (it's difficult to describe), when a current tool is dropped and it moves up to SafeZ, it can move to the New Tool position in the Y axis, as the spindle will be empty. But as soon as a New Tool is in the spindle, it needs to move to G53 X60 after a SafeZX.

The M6 macro.txt that I attached has been edited by me! I think I have too many G53 X60 movements but when at Home it would still collide with another tool. I can do a video if that helps.
krsykes23
 
Posts: 39
Joined: Wed Apr 27, 2022 9:29 am

Re: M6 Tool-Change Macro

Postby krsykes23 » Tue May 17, 2022 4:55 am

Here is an image of the tool positions and required T/C movements
Attachments
KRS-CNC-Layout1.jpg
krsykes23
 
Posts: 39
Joined: Wed Apr 27, 2022 9:29 am

Re: M6 Tool-Change Macro

Postby DanStory » Tue May 17, 2022 5:24 pm

Maybe try
Code: Select all
while (exec.IsMoving()) { }
// check if has tool and machine position is to far left
if(exec.Getcurrenttool() > 0 && exec.GetXmachpos() < 60D){
  // move to the right to clear tool rack
  exec.Code("G00 G53 X60.0");
  while (exec.IsMoving()) { }
}
DanStory
 
Posts: 22
Joined: Tue Nov 30, 2021 12:29 am

Re: M6 Tool-Change Macro

Postby krsykes23 » Tue May 17, 2022 6:26 pm

Hi Dan,

Thanks for the help. Stupid question, but where in the macro do I add that code snippet?
krsykes23
 
Posts: 39
Joined: Wed Apr 27, 2022 9:29 am

Re: M6 Tool-Change Macro

Postby krsykes23 » Wed May 18, 2022 5:13 pm

I added the code snippet where I thought it should be placed in the M6 macro but it doesn't work.

From a startup of UCCNC, I Ref/Home All. For example, I have T8 in the spindle, as this was the tool used in the last session of UCCNC, I then enter 8 in the Active Tool Number field (897), as UCCNC doesn't hold the last-used tool on startup. When doing a 'manual' tool change (not from a loaded G-Code program but by clicking one of the T1-T8 buttons on the screenset), the machine moves from Home (M/C 0,0,0) to X2.8 but it needs to move to X60, as the inserted tool would collide with T1 in the rack.
I made sure I had my hand on the E-Stop!!

I guess I have placed the code in the wrong location?

With Mach3 I was able to edit Ref/Home, so that after a Ref/Home All, the X axis moved to G53 X60, but I cannot do that with UCCNC
krsykes23
 
Posts: 39
Joined: Wed Apr 27, 2022 9:29 am


Return to Macros

Who is online

Users browsing this forum: No registered users and 6 guests