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