I needed to create a pause in a macro to test that a plug was receiving a flag that indicated spindle mode. Basically at the start of the tool change macro M6Start, a flag is lowered to signal that the spindle drive should switch to tool change mode. After all the tool change stuff takes place the flag is raised to signal run mode. I just needed a way to add a delay between the flag states to test that the plug-in was handling the flags properly. I searched for a pause command but did not find anything so I whipped up the following and thought it might be helpful to others. Please note having a pause in a macro like this, while useful for testing, is a bad idea in production code.
DeActivateSignal(17)
tool = GetSelectedTool()
SetCurrentTool( tool )
Dim TS As Single ' Start time
Dim ET As Single ' Elapsed time
Dim waiting As Boolean ' loop flag
TS = Timer ' current time in seconds
waiting = true ' we start out waiting
While waiting
ET = Timer
If ET > TS + 30 Then ' the "30" is the # seconds delay
waiting = false
End If
Wend
ActivateSignal(17)