Hello Guest it is May 11, 2024, 12:08:23 AM

Author Topic: 24 Position Side Mount Tool Change Macro  (Read 3364 times)

0 Members and 1 Guest are viewing this topic.

24 Position Side Mount Tool Change Macro
« on: January 23, 2017, 12:02:11 PM »
We've got a Hurco with an arm tool changer.  I want to change the tool and put up the current tool in one operation, to do this we need to keep track of each tool's "carousel position"  

We're doing this on an Johnford VMC using Mach3, that M6 macro is very long and is running multiple tests; it has to go through each tool with an "if" statement to figure out which tool is requested so it will move to the correct carousel position; and then again to change the previous tool's carousel position to the current carousel position.  

I was curious to know if there was a way to shorten up this macro.  Attached is a crude version of my Mach4 Macro.  I'm going to attempt to use a PLC to run the tool change so it will send and receive registers via modbus to know which position to go to and, when finished, which position it is at to change the current tool's carousel position.  I'm using registers  to keep track of the Tool's Carousel Positions and the Current Carousel position.  

Any insight would be greatly appreciated!
Chad Byrd

Offline smurph

*
  • *
  •  1,548 1,548
  • "That there... that's an RV."
    • View Profile
Re: 24 Position Side Mount Tool Change Macro
« Reply #1 on: January 23, 2017, 03:20:32 PM »
For machines that don't have a 1:1 for tool number to pod, use the tool table's pocket feature.  

pocket , rc = mc.mcToolGetData(Inst, mc.MTOOL_MILL_POCKET, tool);

and

rc = mc.mcToolSetData(Inst, mc.MTOOL_MILL_POCKET, tool, pocket);

pseudo code:

RequestedTool, rc = mc.mcToolGetSelected(inst)
CurrentTool, rc = mc.mcToolGetCurrent(inst)
pocket , rc = mc.mcToolGetData(Inst, mc.MTOOL_MILL_POCKET, RequestedTool);
retrieve tool from pocket
rc = mc.mcToolSetData(Inst, mc.MTOOL_MILL_POCKET, RequestedTool , 0); -- tool is in spindle.
put current tool in the requested tool's old pocket
rc = mc.mcToolSetData(Inst, mc.MTOOL_MILL_POCKET, CurrentTool , pocket); -- old tool is in the new pocket.

Before the first run, make sure the tool table has the correct pocket numbers for eash tool.

Steve
 
Re: 24 Position Side Mount Tool Change Macro
« Reply #2 on: January 23, 2017, 03:44:50 PM »
Thanks Steve! I had no idea that was even an option in the Tool Table. 
I know this is probably bad programming, but I don't use the "rc" on anything.  Can you tell me what it is and what it is used for?  Or point me to a forum that talks about it?

This will make it much easier to code!! Thanks!
Chad Byrd

Offline smurph

*
  • *
  •  1,548 1,548
  • "That there... that's an RV."
    • View Profile
Re: 24 Position Side Mount Tool Change Macro
« Reply #3 on: January 23, 2017, 04:22:25 PM »
rc is the function return code.  Ideally, you should check the rc to determine success or failure of the API call instead of assuming that it worked.  You know what they say about assumptions.  :)  f an API function succeeds, it will return a rc of mc.MERROR_NOERROR.

For example:

RequestedTool, rc = mc.mcToolGetSelected(inst)
if (rc ~= mc.MERROR_NOERROR) then
    mc.mcCntlSetLastError(inst, "Error getting selected tool!")
end

Steve
Re: 24 Position Side Mount Tool Change Macro
« Reply #4 on: May 02, 2024, 03:58:14 PM »
I'm still on Mach3... and need to retrofit  milling machine with side mount 24 position tool changer with arm...
Is there something like this for Mach3 as well?
Thanks

Offline smurph

*
  • *
  •  1,548 1,548
  • "That there... that's an RV."
    • View Profile
Re: 24 Position Side Mount Tool Change Macro
« Reply #5 on: May 02, 2024, 06:35:55 PM »
I'm still on Mach3... and need to retrofit  milling machine with side mount 24 position tool changer with arm...
Is there something like this for Mach3 as well?
Thanks

I haven't messed with Mach3 in over 12 years, so I really can't say.  I do know that your options of preloading a tool will be reduced with Mach3.  Unfortunately, not many in this Mach4 forum are going to be able to provide much guidance on Mach3.  :(

Steve

Offline Bill_O

*
  •  565 565
    • View Profile
Re: 24 Position Side Mount Tool Change Macro
« Reply #6 on: May 03, 2024, 03:35:34 PM »
Steve,

Is the pocket available on Hobby or just Industrial?

Bill

Offline smurph

*
  • *
  •  1,548 1,548
  • "That there... that's an RV."
    • View Profile
Re: 24 Position Side Mount Tool Change Macro
« Reply #7 on: May 04, 2024, 01:58:21 AM »
Bill,

It will work in hobby.  Hobby just doesn't have tool life management.

Steve