Hello Guest it is July 13, 2024, 10:42:39 AM

Author Topic: Mach4 Mill Var 2032 always reads zero / set z not working with hight offset  (Read 8852 times)

0 Members and 1 Guest are viewing this topic.

Hi,

I'm running Mach4 mill without any modifications with the csmio plugin.

When i have an active g43 hight offset, the set z on the offset page is not working correctly. It will not compensate for the hight offset.
Otherwise the hight offset is working fine.

I did some debugging and noticed that all of the variables from #2000 to 2040 are reading 0. Without these variables the set z script can not compensate for the tool hight.

Any idea why the variables all read 0?
I did some more testing and did not get the variables 2000 to 2040 to read any other value than 0. I tried a fresh profile, a new installation on a different PC, i used the simulator instead of the CS Labs controller. This seems to be just broken (for me?).

To get the set z button (and the touch module) to work with hight offsets, is used a workaround. In the scripts i used the currently active tool and tool length from the tool table instead of the active hight offset. This works as long as the currently selected tool is the same as the active hight offset, so this is not perfekt.

To geht the current tool and its length i used this code in the scripts:

local CurTool = mc.mcToolGetCurrent(inst) --Current Tool Num
local CurToolHight = mc.mcToolGetData(inst, mc.MTOOL_MILL_HEIGHT, CurTool) -- Length of the current Tool (from the Tooltable)

So for the set z button, the calculation of the hight offset looks like this:

local OffsetVal = ZPos - GageBlock - CurToolHight

If anyone can have a look at the variable 2032 at their system with a active g43 hight offset, it would be helpful to know if its just me who has this problem.
It looks like #2032 and #2035 is now #1232 and #1235.

Instead of using the values 1232 and 1235 you can use the following instead

mc.mcCntlGetPoundVar(inst, mc.SV_CUR_LENGTH_INDEX) --Current Selected H Offset
mc.mcCntlGetPoundVar(inst, mc.SV_CUR_TOOL_ZLENGTH_REGISTER) --Value of Current H Offset
Thanks a lot! I can confirme, this works.

It would be very nice if the original version of the script, that comes with Mach4 would use the ENUMs. Then they could change the variables however they like without breaking stuff.  ;)