def _run(self): self._check_Robot_Job() if self._motion_timer > 0: self._motion_timer -= 1 leftCnt = len(self.ur_Locations) if self.ur_Locations and self._motion_timer == 0: self.instance.setMover(self.ur_Locations.pop(),self.ur_Rotations.pop()) if self.widgets_panel.RobotConCHK.is_checked == True: bpy.context.view_layer.update() try: pop_Move_Time = self.ur_Move_Times.pop() pop_Move_Radius = self.ur_Move_Radius.pop() pop_Gripper_Motion = self.ur_Gripper_Motions.pop() except Exception as e: print(e) pop_Move_Time = 0 pop_Move_Radius = 0 pop_Gripper_Motion = 0 URxMoveToPoseOperator(1, pop_Move_Time, pop_Move_Radius, pop_Gripper_Motion) else: print("Check Robot conn") if len(self.ur_Locations) == 0 and len(self.ur_Gripper_Motions) == 0: URxStateCheck(0) self.stateUrRun = False Bl_Ui_Draw_Pose_Operator(0) if self.widgets_panel.RobotConCHK.is_checked == True: URxMoveToPoseOperator(0) if leftCnt > 0: self._motion_timer = int(self._delay_time * self.widgets_panel.SpeedUD.get_value())
def bcall_Save_Pose_Lists(self, widget): print("Button '{0}' is pressed".format(widget.text)) try: bof.FLAG_IK_MOVE_DRAG = False bod.data_Set_Save_To_Mem() Bl_Ui_Draw_Pose_Operator(0) bpy.ops.object.dialog_operator('INVOKE_DEFAULT') except Exception as e: print(e)
def modal(self, context, event): if event.type == 'ESC': if self.widgets_panel.RobotConCHK.is_checked == False: self.ur_Locations = [] self.ur_Rotations = [] self.ur_Move_Times = [] self.ur_Move_Radius = [] self.ur_Gripper_Motions = [] URxMoveToPoseOperator(6) Bl_Ui_Draw_Pose_Operator(0) self.stateUrRun = False bof.FLAG_OP_SHUTDOWN = True self._run() # buca.draw_Curr_Ur_FK() # Use UR5 in simulator if bof.FLAG_OP_SHUTDOWN: self._cancel(context) self.unregister_handlers(context) cleanup_and_quit() return {'CANCELLED'} elif event.type == 'TIMER': self._modal_action() for widget in self.widgets: rtn = widget.handle_event(event) for widget in self.widgets2: rtn = widget.handle_event(event) if self.instance is not None: self.instance.set_event(event, context) if self.sensor_cam is not None and self.sensor_cam_mode: self.sensor_cam.processing() if "ROBOT" in bod.data_Tcp_Clinet_List: self.widgets_panel.RobotConCHK.is_checked = True else: self.widgets_panel.RobotConCHK.is_checked = False bpy.context.view_layer.update() if rtn: print('redraw') return {'RUNNING_MODAL'}
def bcall_Draw_Del_Pose(self, widget): print("Button '{0}' is pressed".format(widget.text)) Bl_Ui_Draw_Pose_Operator(0)