Hi,
I used scr.SetProperty("droCurrentX","Value",regval) to set the dro but as soon as I move the axis it reverts back to the original position before I changed it.
What command should I use to do this?
That is incorrect. The numeric value displayed in a DRO is just the visual artefact that results from displaying the true internal value. For instance lets assume the X axis
position is x=123.456. You come along blithely and set the DRO to 654.321, but the true and underlying value remains 123.456, and therefore at the next screen re-draw
the DRO again displays that true and underlying value.
The machine coordinates of the current location of the machine are determined by the distance from the Home point or Reference point and the machine position.
The only way to change the machine coordinates to some other value is to shift the machine......end of story. Work coordinates can be changed however.
The commonly displayed axis position is = machine coordinate (of that axis) - WorkOffset (of that axis). You can change the WorkOffset with Gcodes or with a script.
This concept is hard for most people to grasp......you cannot set a machine coordinates at will. The only way to set a machine coordinate is by using one of the Homing procedures.
There is s trick means of doing so by using the HomeInPLace function......but its confusing....and ultimately counterproductive. I tried using it years ago...and it worked
but actually caused me more grief than it was supposed to solve.
By the way, this API works by changing the WorkOffset....not as most people assume by changing the machine coordinate:
LUA Syntax:
rc = mc.mcAxisSetPos(
number mInst,
number axisId,
number val);
Description:
Set the Position of an axis by changing the fixture offset.
Craig