As a heads up to all:
Noticed that the machine units DRO display in the setup units only.
I had set up Mach4 in inch and MDI changed using g21 (metric) to run a test program. Found that I needed to create a new popup Wizzard that displays the Fixture & Machine DRO's in the units I am running in. As a side note also found that using the Jog Step feature increments to the setup units, so I guess I will have to address that by using a scaling function.
Scott suggested I compute to a more accurate value then the standard 25.4 (thou my wood don't seem to care
)
local metricval = 25.4000508001016
if (defaultunits == 200 and currentunits1 == 210) then
WriteReg("iRegs0/XMachineValue", XMachineVal*metricval); --convert to metric
WriteReg("iRegs0/YMachineValue", YMachineVal*metricval);
WriteReg("iRegs0/ZMachineValue", ZMachineVal*metricval);
WriteReg("iRegs0/Xvalue", Xval*metricval);
WriteReg("iRegs0/Yvalue", Yval*metricval);
WriteReg("iRegs0/Zvalue", Zval*metricval);
elseif (defaultunits == 210 and currentunits1 == 200) then
WriteReg("iRegs0/XMachineValue", XMachineVal/metricval); --convert to inch
WriteReg("iRegs0/YMachineValue", YMachineVal/metricval);
WriteReg("iRegs0/ZMachineValue", ZMachineVal/metricval);
WriteReg("iRegs0/Xvalue", Xval/metricval);
WriteReg("iRegs0/Yvalue", Yval/metricval);
WriteReg("iRegs0/Zvalue", Zval/metricval);
else
WriteReg("iRegs0/XMachineValue", XMachineVal);
WriteReg("iRegs0/YMachineValue", YMachineVal);
WriteReg("iRegs0/ZMachineValue", ZMachineVal);
WriteReg("iRegs0/Xvalue", Xval);
WriteReg("iRegs0/Yvalue", Yval);
WriteReg("iRegs0/Zvalue", Zval);
end
This had a fixture offset of x=1" y=1" just to check values