示例#1
0
    def test_add(self):
        th.msleep(500)
        # self.assertTrue(self.win.isVisible())
        # add点击手动按钮
        button_list = self.win.buttons
        th.msleep(500)
        for i in ["0.01", "0.1", "1"]:
            th.clickButton(self.win, i)
            th.msleep(500)
            for btn in button_list:
                if btn == 0:
                    continue
                else:
                    th.click(widget=btn)
                    th.msleep(1000)
                    _logger.warning(
                        str(
                            tuple(
                                round(R[341 + x] * BLU, 3)
                                for x in range(basic.axisCount()))))
                    th.msleep(500)

        # 自定义模式点击手动按钮
        th.clickButton(ManualOpDialog, "自定义")
        th.msleep(500)
        lineEdit = self.win.ui.customstep
        th.lineEditTypewrite(
            str(random.randint(1, 20) + round(random.uniform(0.001, 1), 3)),
            lineEdit)
        th.msleep(500)
        for btn in button_list:
            th.click(widget=btn)
            th.msleep(1000)
            _logger.warning(
                str(
                    tuple(
                        round(R[341 + x] * BLU, 3)
                        for x in range(basic.axisCount()))))
            th.msleep(500)

        # 连续模式点击手动按钮
        th.clickButton(ManualOpDialog, "连续")
        for btn in button_list:
            if btn == 0:
                continue
            else:
                th.click(widget=btn)
                th.msleep(1000)

        # 开启快动按钮点击手动按钮
        for btn in button_list:
            th.click(widget=btn)
            th.msleep(1000)
            _logger.warning(
                str(
                    tuple(
                        round(R[341 + x] * BLU, 3)
                        for x in range(basic.axisCount()))))
            th.msleep(500)
示例#2
0
    def tearDown(self):
        # 恢复快速定位速度初始值
        P[770] = self.quick_speed

        # 恢复固定点位置初始值
        for i in range(basic.axisCount()):
            P[1601 + i] = self.fixed_point[i]
示例#3
0
 def test_AfterProcess(self):
     # 加工结束后回固定点
     P[4001] = 0
     th.msleep(500)
     th.assertActiveWindow(basic.mainWindow)
     th.clickButton(basic.mainWindow, "F11开始")
     th.msleep(35000)
     # 判断机床坐标等于固定点参数值
     for i in range(basic.axisCount()):
         assert (round(R[101 + i] * BLU) == P[1601 + i] * mm)
     th.msleep(500)
     # 加工结束后回工件原点
     P[4001] = 1
     th.msleep(500)
     th.assertActiveWindow(basic.mainWindow)
     th.clickButton(basic.mainWindow, "F11开始")
     th.msleep(35000)
     # 判断X,Y工件坐标等于0,Z轴机床坐标等于固定点参数值
     assert (R[121] == R[122] == 0)
     for a in range(basic.spindleCount()):
         assert round(R[103 + a] * BLU) == P[1603 + a] * mm
     # 加工结束后无附件动作
     P[4001] = 2
     th.msleep(500)
     th.assertActiveWindow(basic.mainWindow)
     th.clickButton(basic.mainWindow, "F11开始")
     th.msleep(35000)
     # 判断X,Y,Z工件坐标等于NC程序最后的X,Y,Z走的值
     assert round(R[121] * BLU) == 0 * mm and round(R[122] * BLU, 3) == -62.375 * mm
     for b in range(basic.spindleCount()):
         assert round(R[123 + b] * BLU) == 5 * mm
示例#4
0
 def setUp(self):
     th.msleep(1000)
     # 获取寻原点方向初始值
     self.origin_dir = []
     for i in range(basic.axisCount()):
         self.origin_dir.append(P[1701 + i])
     # 打开Home对话框
     th.msleep(1000)
     th.assertActiveWindow(basic.mainWindow)
     th.clickButton(basic.mainWindow, "Home")
     th.msleep(1000)
     # 判断当前窗口是否为Home对话框
     self.homewindow = th.assertActiveWindow(basic.HomeDialog)
示例#5
0
 def setUp(self):
     th.msleep(1000)
     th.assertActiveWindow(basic.mainWindow)
     # 获取快速定位速度
     self.quick_speed = P[770]
     # 修改快速定位速度,降低BackWPHome速度
     P[770] = 2000 * (mm / minute)
     # 创建空的固定点位置列表
     self.fixed_point = []
     for i in range(basic.axisCount()):
         # 获取固定点位置初始值
         self.fixed_point.append(P[1601 + i])
         # 设置固定点位置
         P[1601 + i] = -0.001 * mm
示例#6
0
    def test_MainUI(self):
        for i in range(basic.axisCount()):
            R[641 + i] = 1
        from plugins.mainui.mainwindow import _mainWindowContent
        _mainWindowContent.ui.F1.animateClick()
        th.msleep(3000)
        _mainWindowContent.ui.F2.animateClick()
        th.msleep(3000)

        # print(_mainWindowContent.ui.frame_2.findChildren(PyPushButton))
        ls = _mainWindowContent.ui.frame_2.findChildren(PyPushButton)
        autotool = _mainWindowContent.ui.frame_2.findChild(
            PyPushButton, 'PushButton_7')
        for i in range(len(ls)):
            if ls[i] == autotool:
                continue
                th.msleep(2000)
            else:
                th.msleep(1000)
                ls[i].animateClick()
                th.msleep(500)
                ls[i].animateClick()
示例#7
0
    def test_Manul_Home(self):
        # 获取键盘
        F[400] = True
        # 将X寻原点方向设为1,YZ寻原点方向设为0
        P[1701] = 1
        for i in range(basic.axisCount() - 1):
            P[1702 + i] = 0

        if P[4138] == 0:
            # 点击所有轴Home按钮
            th.clickButton(self.homewindow, "所有轴Home")
            th.msleep(1000)
            # 判断是否是Z轴先Home
            assert R[41] == 1 and R[42] == 1
            for i in range(basic.spindleCount()):
                R[43 + i] == 0
            self.push_key()
            # 判断是否ZHome完成后,xy开始Home
            assert R[41] == 0 and R[42] == 0
            for i in range(basic.spindleCount()):
                R[43 + i] == 1
            self.push_key()
            # 判断xyZ是否都Home成功
            assert R[41] == 1 and R[42] == 1
            for i in range(basic.spindleCount()):
                R[43 + i] == 1

            # 单轴Home
            # X轴Home
            th.clickButton(self.homewindow, "X 轴Home")
            th.msleep(1000)
            # 判断X轴Home方向
            th.msleep(200)
            v1 = R[101]
            th.msleep(500)
            v2 = R[101]
            assert v1 > v2
            th.msleep(500)
            F[588] = True
            th.msleep(500)
            F[588] = False
            # 判断粗定位完成后,X轴Home方向
            th.msleep(200)
            v3 = R[101]
            th.msleep(200)
            v4 = R[101]
            assert v3 < v4
            th.msleep(500)
            F[590] = True
            th.msleep(500)
            F[590] = False
            th.msleep(500)
            F[590] = True
            th.msleep(500)
            F[590] = False
            th.msleep(500)

            # Y轴Home
            th.clickButton(self.homewindow, "Y 轴Home")
            th.msleep(1000)
            # 判断Y轴Home方向
            th.msleep(200)
            v1 = R[102]
            th.msleep(500)
            v2 = R[102]
            assert v1 < v2
            th.msleep(500)
            F[588] = True
            th.msleep(500)
            F[588] = False
            # 判断粗定位完成后,Y轴Home方向
            th.msleep(200)
            v3 = R[102]
            th.msleep(200)
            v4 = R[102]
            assert v3 > v4
            th.msleep(500)
            F[590] = True
            th.msleep(500)
            F[590] = False
            th.msleep(500)
            F[590] = True
            th.msleep(500)
            F[590] = False
            th.msleep(500)

            # Z轴Home
            i = random.randint(1, basic.spindleCount())
            th.clickButton(self.homewindow, "Z{} 轴Home".format(i))
            th.msleep(1000)
            # 判断Z轴Home方向
            th.msleep(200)
            v1 = R[102 + i]
            th.msleep(500)
            v2 = R[102 + i]
            assert v1 < v2
            th.msleep(500)
            F[588] = True
            th.msleep(500)
            F[588] = False
            # 判断粗定位完成后,Z轴Home方向
            th.msleep(200)
            v3 = R[102 + i]
            th.msleep(200)
            v4 = R[102 + i]
            assert v3 > v4
            th.msleep(500)
            F[590] = True
            th.msleep(500)
            F[590] = False
            th.msleep(500)
            F[590] = True
            th.msleep(500)
            F[590] = False
            th.msleep(500)

            # 选择任意一个Z轴Home
            th.msleep(1000)
            th.clickButton(
                self.homewindow,
                "Z{} 轴Home".format(random.randint(1, basic.spindleCount())))
            th.msleep(500)
            # 停止Home
            th.clickButton(basic.mainWindow, "F12 停止")

            # Z轴未Home的情况下,XHome
            th.msleep(500)
            th.clickButton(self.homewindow, "X 轴Home")
            th.msleep(500)
            msg = th.assertActiveWindow(QtWidgets.QMessageBox)
            th.clickButton(msg, "是(&Y)")
            self.push_key()
            # Z轴未Home的情况下,点击YHome并取消YHome
            th.msleep(500)
            th.clickButton(self.homewindow, "Y 轴Home")
            th.msleep(500)
            msg = th.assertActiveWindow(QtWidgets.QMessageBox)
            th.clickButton(msg, "否(&N)")

            # 勾选重启软件自动Home
            P[4138] = 1
示例#8
0
 def tearDown(self):
     th.close(self.homewindow)
     # 恢复XYZ寻原点方向初始值
     for i in range(basic.axisCount()):
         P[1701 + i] = self.origin_dir[i]
示例#9
0
 def setUp(self):
     for a in range(basic.axisCount()):
         R[641 + a] = 1
     basic.Set_Auth_Level(0)