That is a good notebook! The only think I would comment on is that it is MUCH better to get or change the data that drives a DRO or LED than getting/setting the value with scr.Get/SetProperty(). One of your examples was getting the current Y position:
local StartPos = scr.GetProperty (‘dro Current Pos Y’, ‘Value’)
The better solution is to use the main API:
local StartPos, rc = mcAxisGetPos(<instance>, mc.Y_AXIS)
if (rc == mc.MERROR_NOERROR) then
--We successfully got the Y axis position.
end
Why is this better? Well... Because the screen controls are updated on an interval. This is called the screen refresh interval. It may not be the MOST current value of the data. The system may have a value of 3.401" for the Y axis but the DRO may have not been updated to that value because the screen has not refreshed yet when the code was run. Also, the main API functions return defined error codes that can be checked for success or fail after calling the API function. Checking the the API return codes is VERY important for developing robust processes. I like to say "If you check the return codes, there will be no mysteries."
As mentioned in another post, this is why the scr.* functions are not documented. Because there is a better (and documented) ways to do most things.
But that is a fine collection of useful information!
Steve