26
« on: July 03, 2015, 03:41:48 PM »
maybe try [ if boardZero == 0 then scr.SetProperty ('name of your DRO', 'Value', '0.0000') end ] in the PLC?
wait a sec...I had trouble using a macro call to change a global variable value and then have the PLC scan and execute a function based on that global variable's value. For me, I couldn't get the PLC to recognize the macro's global variable value change. I know I might of just confused you but I think I know what you are talking about...I don't think the above example would work but you can try. Hmmm, this is a puzzle. Because when you call the macro and start movement you will have to wait until the movement is complete until resetting the DRO to zero. If not, lua will reset the DRO to zero before the movement is complete if you use the scr.SetProperty call in the macro at the end. A possible solution would be to time your movement (say it takes 90 seconds to do what you want).
so, your macro would start by declaring the function, execute gCode, wx.wxSleep(90), scr.SetProperty ('name of your DRO', 'Value', '0.0000') end. This would put lua into a sleep state until the movement is complete (based on timing) then reset your DRO. All within your macro and proceed to execute the next block. Try that technique.