def work(): dType.SetQueuedCmdClear(api) init() offset=0;offset1=0 print(waittime2) for i in range(0, 10): print(i) if i % 4 == 0: offset = 0;offset1=-50 elif i % 4 == 1: offset = 0;offset1=0 elif i % 4 == 2: offset = 20;offset1=0 elif i % 4 == 3: offset = 0;offset1=0 lastIndex = dType.SetPTPCmd(api, dType.PTPMode.PTPMOVLXYZMode,postion[0]+offset1,postion[1],postion[2]-offset,postion[3])[0] # 移动 dType.SetWAITCmd(api, waittime2) dType.SetQueuedCmdStartExec(api) # Wait for Executing Last Command while lastIndex > dType.GetQueuedCmdCurrentIndex(api)[0]: dType.dSleep(200) #Stop to Execute Command Queued dType.SetQueuedCmdStopExec(api) dType.SetQueuedCmdClear(api)
def press_screen(press_time): dType.SetQueuedCmdClear(api) init() if press_time > 450 else init(coordinate=9000) waiting_time = press_time * 0.001 for i in range(0, 2): offset = 20 if i % 2 == 0 else 0 last_index = dType.SetPTPCmd(api, dType.PTPMode.PTPMOVLXYZMode, postion[0], postion[1], postion[2] - offset, postion[3])[0] dType.SetWAITCmd(api, waiting_time) dType.SetQueuedCmdStartExec(api) while last_index > dType.GetQueuedCmdCurrentIndex(api)[0]: dType.dSleep(0) dType.SetQueuedCmdStopExec(api) dType.SetQueuedCmdClear(api)