Beispiel #1
0
        /// <summary>
        /// 移动到X轴终点
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnAxisXGoTo2_Click(object sender, EventArgs e)
        {
            double diff = double.Parse(this.txtXEndY.Text) - double.Parse(this.txtXStartY.Text);

            if (Math.Abs(diff) > 5)
            {
                MessageBox.Show("示教时请确保设备Y轴固定", "", MessageBoxButtons.OKCancel);
                return;
            }
            Task.Factory.StartNew(() => {
                Result res = Result.OK;
                res        = Machine.Instance.Robot.MovePosZAndReply(double.Parse(this.txtPosZ1.Text));
                if (!res.IsOk)
                {
                    return;
                }
                AxisXCPK cpk = CPKMgr.Instance.FindByName(typeof(AxisXCPK).Name) as AxisXCPK;
                if (cpk != null)
                {
                    PointD p = cpk.calPoint();
                    res      = CpkMove.MoveToPosHigh(p.X, p.Y);
                    if (!res.IsOk)
                    {
                        return;
                    }
                    res = CpkMove.MoveToPosSlowly(double.Parse(this.txtXEndX.Text), double.Parse(this.txtXEndY.Text));
                    if (!res.IsOk)
                    {
                        return;
                    }
                }
            });
        }
Beispiel #2
0
        public void Initial()
        {
            WorkBook workBook = new  WorkBook();

            workBook.AddSheet(SheetName.Valve1Weight.ToString());
            workBook.AddSheet(SheetName.Valve2Weight.ToString());
            workBook.AddSheet(SheetName.X轴.ToString());
            workBook.AddSheet(SheetName.Y轴.ToString());
            workBook.AddSheet(SheetName.XY轴联动.ToString());
            workBook.AddSheet(SheetName.Z轴.ToString());

            ICPKable cpk;

            cpk = new Valve1WeightCPK(workBook.FindSheetByName(SheetName.Valve1Weight.ToString()), this.Prm);
            this.cpkDicAdd(typeof(Valve1WeightCPK).Name, cpk);

            cpk = new Valve2WeightCPK(workBook.FindSheetByName(SheetName.Valve2Weight.ToString()), this.Prm);
            this.cpkDicAdd(typeof(Valve2WeightCPK).Name, cpk);

            cpk = new AxisXCPK(workBook.FindSheetByName(SheetName.X轴.ToString()), this.Prm);
            this.cpkDicAdd(typeof(AxisXCPK).Name, cpk);

            cpk = new AxisYCPK(workBook.FindSheetByName(SheetName.Y轴.ToString()), this.Prm);
            this.cpkDicAdd(typeof(AxisYCPK).Name, cpk);

            cpk = new AxisXYCPK(workBook.FindSheetByName(SheetName.XY轴联动.ToString()), this.Prm);
            this.cpkDicAdd(typeof(AxisXYCPK).Name, cpk);

            cpk = new AxisZCPK(workBook.FindSheetByName(SheetName.Z轴.ToString()), this.Prm);
            this.cpkDicAdd(typeof(AxisZCPK).Name, cpk);
        }
Beispiel #3
0
        /// <summary>
        /// X轴起点示教
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnAxisXTeach1_Click(object sender, EventArgs e)
        {
            this.txtXStartX.Text = Machine.Instance.Robot.PosX.ToString("F3");
            this.txtXStartY.Text = Machine.Instance.Robot.PosY.ToString("F3");
            AxisXCPK cpk = CPKMgr.Instance.FindByName(typeof(AxisXCPK).Name) as AxisXCPK;

            if (cpk != null)
            {
                cpk.Start = new PointD(double.Parse(this.txtXStartX.Text), double.Parse(this.txtXStartY.Text));
            }
        }
Beispiel #4
0
 /// <summary>
 /// 移动到X轴起点
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btnAxisXGoTo1_Click(object sender, EventArgs e)
 {
     Task.Factory.StartNew(() =>
     {
         Result res = Result.OK;
         res        = Machine.Instance.Robot.MovePosZAndReply(double.Parse(this.txtPosZ1.Text));
         if (!res.IsOk)
         {
             return;
         }
         AxisXCPK cpk = CPKMgr.Instance.FindByName(typeof(AxisXCPK).Name) as AxisXCPK;
         if (cpk != null)
         {
             res = CpkMove.MoveToPosHigh(double.Parse(this.txtXStartX.Text), double.Parse(this.txtXStartY.Text));
             if (!res.IsOk)
             {
                 return;
             }
         }
     });
 }