1
Mach4 General Discussion / mcAxisGetMachinePos is unreliable. How do I reliably get machine coordinates?
« on: March 31, 2024, 02:10:50 PM »
In my tool changer script I need to make sure that the bottom of the spindle is above the top of the tool holders before moving to load a tool. I don't want to raise to machine coords z=0 (Z axis highest position) each time I change tools since it is 3.5" above the top of the tool holders, and this up and down movement wastes a lot of time. Most of the time this is not an issue since I will move to a safe height after dropping off a tool but there are a few situations where I manually unload the spindle and I want to ensure it's at a safe height. So I added some code to check, if it's below safe height, it should raise to a safe height.
so I use the following line to get the current position in machine coordinates:
but about 75% of the time this call returns 0, while the dro (set to machine coords) displays a non zero number, and the dro is always correct. I can't read the DRO because most of the time it will be displaying work coords.
So is there a reliable way to read machine coordinates?
so I use the following line to get the current position in machine coordinates:
Code: [Select]
local currentZ = mc.mcAxisGetMachinePos(inst, mc.Z_AXIS)
but about 75% of the time this call returns 0, while the dro (set to machine coords) displays a non zero number, and the dro is always correct. I can't read the DRO because most of the time it will be displaying work coords.
So is there a reliable way to read machine coordinates?