Example #1
0
        /// <summary>
        /// Z轴终点再现
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnAxisZGoTo2_Click(object sender, EventArgs e)
        {
            Result res = Result.OK;

            //res = Machine.Instance.Robot.MovePosXYAndReply(double.Parse(this.txtZPosX.Text), double.Parse(this.txtZPosY.Text));
            res = Machine.Instance.Robot.ManualMovePosXYAndReply(double.Parse(this.txtZPosX.Text), double.Parse(this.txtZPosY.Text));
            if (res != Result.OK)
            {
                return;
            }
            AxisZCPK cpk = CPKMgr.Instance.FindByName(typeof(AxisZCPK).Name) as AxisZCPK;

            if (cpk != null)
            {
                double z = cpk.calPoint();
                res = CpkMove.MoveZHigh(z);
                if (!res.IsOk)
                {
                    return;
                }
                res = CpkMove.MoveZSlowly(double.Parse(this.txtZEnd.Text));
                if (!res.IsOk)
                {
                    return;
                }
            }
            //this.move4CpkZ(double.Parse(this.txtZPosX.Text), double.Parse(this.txtZPosY.Text), double.Parse(this.txtZEnd.Text));
        }
Example #2
0
        /// <summary>
        /// Y轴终点再现
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnAxisYGoTo2_Click(object sender, EventArgs e)
        {
            double diff = double.Parse(this.txtYEndX.Text) - double.Parse(this.txtYStartX.Text);

            if (Math.Abs(diff) > 5)
            {
                MessageBox.Show("示教时请确保设备X轴固定", "", MessageBoxButtons.OKCancel);
                return;
            }
            Result res = Result.OK;

            res = Machine.Instance.Robot.MovePosZAndReply(double.Parse(this.txtPosZ2.Text));
            if (!res.IsOk)
            {
                return;
            }
            AxisYCPK cpk = CPKMgr.Instance.FindByName(typeof(AxisYCPK).Name) as AxisYCPK;

            if (cpk != null)
            {
                PointD p = cpk.calPoint();
                res = CpkMove.MoveToPosHigh(p.X, p.Y);
                if (!res.IsOk)
                {
                    return;
                }
                res = CpkMove.MoveToPosSlowly(double.Parse(this.txtYEndX.Text), double.Parse(this.txtYEndY.Text));
                if (!res.IsOk)
                {
                    return;
                }
            }
            //CpkMove.moveToPosDown(double.Parse(this.txtYEndX.Text), double.Parse(this.txtYEndY.Text), double.Parse(this.txtPosZ2.Text));
        }
Example #3
0
        private void DoAxisYCPK()
        {
            if (!this.cbUseASV.Checked)
            {
                this.checkGage();
            }
            Result res = Result.OK;

            res = Machine.Instance.Robot.MovePosZAndReply(double.Parse(this.txtPosZ2.Text));
            if (!res.IsOk)
            {
                return;
            }

            res = CpkMove.MoveToPosHigh(double.Parse(this.txtYStartX.Text), double.Parse(this.txtYStartY.Text));
            if (!res.IsOk)
            {
                return;
            }

            double diff = double.Parse(this.txtYEndX.Text) - double.Parse(this.txtYStartX.Text);

            if (Math.Abs(diff) > 5)
            {
                MessageBox.Show("示教时请确保设备X轴固定", "", MessageBoxButtons.OKCancel);
                return;
            }
            CPKMgr.Instance.ExecuteOne(typeof(AxisYCPK).Name);
        }
Example #4
0
        private void moveAndRead()
        {
            Result res = Result.OK;
            double height;

            this.isStop = false;
            dataInput.Clear();
            for (int i = 0; i < this.CpkPrm.YPointsNum; i++)
            {
                res = CpkMove.MoveToPosHigh(Start.X, Start.Y);
                if (!res.IsOk)
                {
                    return;
                }
                if (this.isStop)
                {
                    this.isStop = false;
                    break;
                }

                if (this.CpkMeasureType == 1) // 相机定位
                {
                    res = CpkMove.MoveToPosSlowly(End.X, End.Y);
                    if (!res.IsOk)
                    {
                        return;
                    }
                    double posInCamera;
                    bool   result = this.CaptruePos(out posInCamera);
                    if (!result)
                    {
                        return;
                    }
                    height = height = Machine.Instance.Robot.PosY + posInCamera;
                }
                else // 通信千分表
                {
                    res = CpkMove.MoveToPosHigh(pointTrans.X, pointTrans.Y);
                    if (!res.IsOk)
                    {
                        return;
                    }
                    res = CpkMove.MoveToPosSlowly(End.X, End.Y);
                    if (!res.IsOk)
                    {
                        return;
                    }
                    Thread.Sleep(3000);
                    //读取高度
                    int retCode = Machine.Instance.DigitalGage.DigitalGagable.ReadHeight(out height);
                    if (retCode != 0)
                    {
                        return;
                    }
                }
                dataInput.Add(height);
            }
        }
Example #5
0
        private void moveAndRead()
        {
            Result res = Result.OK;
            double height;

            this.isStop = false;
            dataInput.Clear();
            for (int i = 0; i < this.CpkPrm.ZPointsNum; i++)
            {
                res = CpkMove.MoveZHigh(ZStart);
                if (res != Result.OK)
                {
                    return;
                }
                if (this.isStop)
                {
                    this.isStop = false;
                    break;
                }
                res = CpkMove.MoveZHigh(pointTrans);
                if (!res.IsOk)
                {
                    return;
                }
                res = CpkMove.MoveZSlowly(ZEnd);
                if (!res.IsOk)
                {
                    return;
                }
                Thread.Sleep(3000);
                if (this.CpkMeasureType == 1)
                {
                    //读取高度
                    Result result = Machine.Instance.MeasureHeight(out height);
                    if (!result.IsOk)
                    {
                        return;
                    }
                }
                else
                {
                    //读取高度
                    int retCode = Machine.Instance.DigitalGage.DigitalGagable.ReadHeight(out height);
                    if (retCode != 0)
                    {
                        return;
                    }
                }
                dataInput.Add(height);
            }
        }
Example #6
0
        private void DoAxisXYCPK()
        {
            Result res = Result.OK;

            res = Machine.Instance.Robot.MovePosZAndReply(double.Parse(this.txtPosZ3.Text));
            if (!res.IsOk)
            {
                return;
            }

            res = CpkMove.MoveToPosHigh(double.Parse(this.txtXYStartX.Text), double.Parse(this.txtXYStartY.Text));
            if (!res.IsOk)
            {
                return;
            }
            CPKMgr.Instance.ExecuteOne(typeof(AxisXYCPK).Name);
        }
Example #7
0
        /// <summary>
        /// Z轴起点再现
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnAxisZGoTo1_Click(object sender, EventArgs e)
        {
            Result res = Result.OK;

            //res = Machine.Instance.Robot.MovePosXYAndReply(double.Parse(this.txtZPosX.Text), double.Parse(this.txtZPosY.Text));
            res = Machine.Instance.Robot.ManualMovePosXYAndReply(double.Parse(this.txtZPosX.Text), double.Parse(this.txtZPosY.Text));
            if (res != Result.OK)
            {
                return;
            }
            res = CpkMove.MoveZHigh(double.Parse(this.txtZStart.Text));
            if (res != Result.OK)
            {
                return;
            }

            //this.move4CpkZ(double.Parse(this.txtZPosX.Text), double.Parse(this.txtZPosY.Text), double.Parse(this.txtZStart.Text));
        }
Example #8
0
        private void btnAxisXYGoTo2_Click(object sender, EventArgs e)
        {
            Result res = Result.OK;

            res = Machine.Instance.Robot.MovePosZAndReply(double.Parse(this.txtPosZ3.Text));
            if (!res.IsOk)
            {
                return;
            }
            AxisXYCPK cpk = CPKMgr.Instance.FindByName(typeof(AxisXYCPK).Name) as AxisXYCPK;

            if (cpk != null)
            {
                res = CpkMove.MoveToPosSlowly(double.Parse(this.txtXYEndX.Text), double.Parse(this.txtXYEndY.Text));
                if (!res.IsOk)
                {
                    return;
                }
            }
        }
Example #9
0
        private void DoAxisZCPK()
        {
            if (!this.cbUseLaser.Checked)
            {
                this.checkGage();
            }
            Result res = Result.OK;

            res = CpkMove.MoveZHigh(double.Parse(this.txtZStart.Text));
            if (res != Result.OK)
            {
                return;
            }
            res = CpkMove.MoveZHigh(double.Parse(this.txtZStart.Text));
            if (res != Result.OK)
            {
                return;
            }
            CPKMgr.Instance.ExecuteOne(typeof(AxisZCPK).Name);
        }
Example #10
0
        /// <summary>
        /// Y轴起点再现
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnAxisYGoTo1_Click(object sender, EventArgs e)
        {
            Result res = Result.OK;

            res = Machine.Instance.Robot.MovePosZAndReply(double.Parse(this.txtPosZ2.Text));
            if (!res.IsOk)
            {
                return;
            }
            AxisYCPK cpk = CPKMgr.Instance.FindByName(typeof(AxisYCPK).Name) as AxisYCPK;

            if (cpk != null)
            {
                res = CpkMove.MoveToPosHigh(double.Parse(this.txtYStartX.Text), double.Parse(this.txtYStartY.Text));
                if (!res.IsOk)
                {
                    return;
                }
            }
            //CpkMove.moveToPos(double.Parse(this.txtYStartX.Text), double.Parse(this.txtYStartY.Text), double.Parse(this.txtPosZ2.Text));
        }
Example #11
0
        private void moveAndRead()
        {
            Result res = Result.OK;
            double height, height2;

            dataInput.Clear();
            dataInput2.Clear();
            this.isStop = false;
            for (int i = 0; i < this.CpkPrm.XYPointsNum; i++)
            {
                res = CpkMove.MoveToPosHigh(Start.X, Start.Y);
                if (!res.IsOk)
                {
                    return;
                }
                if (this.isStop)
                {
                    this.isStop = false;
                    break;
                }
                res = CpkMove.MoveToPosSlowly(End.X, End.Y);
                if (!res.IsOk)
                {
                    return;
                }
                double posInCameraX, posInCameraY;
                bool   result = this.CaptruePos(out posInCameraX, out posInCameraY);
                if (!result)
                {
                    return;
                }
                height  = Machine.Instance.Robot.PosX + posInCameraX;
                height2 = Machine.Instance.Robot.PosY + posInCameraY;
                dataInput.Add(height);
                dataInput2.Add(height2);
            }
        }