Exemplo n.º 1
0
        private void Init()
        {
            this.valveControl1.Setup(2);
            for (int i = 0; i < 10; i++)
            {
                this.cbxDotStyle.Items.Add("Type " + (i + 1));
            }
            this.cbxDotStyle.SelectedIndex = 0;
            this.dotStyle = DotStyle.TYPE_1;
            this.dotParam = FluidProgram.CurrentOrDefault().ProgramSettings.GetDotParam(this.dotStyle);

            if (DataSetting.Default.selectDispenseMode)
            {
                this.rdoDispenseMode.Checked = true;
            }
            else
            {
                this.rdoPlasticineMode.Checked = true;
            }
            switch (DataSetting.Default.selectCorrectionAxis)
            {
            case CorrectionAxis.A轴校正:
                this.rdoAxisA.Checked = true;
                break;

            case CorrectionAxis.B轴校正:
                this.rdoAxisB.Checked = true;
                break;

            case CorrectionAxis.A轴和B轴同时校正:
                this.rdoAxisAandB.Checked = true;
                break;
            }
        }
Exemplo n.º 2
0
        public DotCmd(RunnableModule runnableModule, DotCmdLine dotCmdLine, MeasureHeightCmd mhCmd)
            : base(runnableModule, dotCmdLine)
        {
            this.Valve = dotCmdLine.Valve;
            var structure = runnableModule.CommandsModule.program.ModuleStructure;

            position        = structure.ToMachine(runnableModule, dotCmdLine.Position);
            DotStyle        = dotCmdLine.DotStyle;
            IsWeightControl = dotCmdLine.IsWeightControl;
            Weight          = dotCmdLine.Weight;
            this.NumShots   = dotCmdLine.NumShots;
            this.IsAssign   = dotCmdLine.IsAssign;
            this.associatedMeasureHeightCmd = mhCmd;
        }
Exemplo n.º 3
0
        public NozzleCheckCmd(RunnableModule runnableModule, NozzleCheckCmdLine nozzleCheckCmdLine, MeasureHeightCmd mhCmd) : base(runnableModule, nozzleCheckCmdLine)
        {
            // 转换成机械坐标
            var structure = runnableModule.CommandsModule.program.ModuleStructure;

            position     = structure.ToMachine(runnableModule, nozzleCheckCmdLine.Position);
            DotStyle     = nozzleCheckCmdLine.DotStyle;
            modelFindPrm = nozzleCheckCmdLine.ModelFindPrm;
            GrayCheckPrm = nozzleCheckCmdLine.GrayCheckPrm;
            CheckThm     = nozzleCheckCmdLine.CheckThm;
            IsOkAlarm    = nozzleCheckCmdLine.IsOkAlarm;
            this.associatedMeasureHeightCmd = mhCmd;
            IsWeightControl  = nozzleCheckCmdLine.IsWeightControl;
            Weight           = nozzleCheckCmdLine.Weight;
            this.nozzleStyle = nozzleCheckCmdLine.NozzleStyle;
            this.isGlobal    = nozzleCheckCmdLine.isGlobal;
        }
Exemplo n.º 4
0
        public void DrawPoint(uint xStart, uint yStart, Color Color, uint dotSize, DotStyle dotStyle)
        {
            if (xStart > Width)
            {
                throw new ArgumentOutOfRangeException(nameof(xStart), $"{nameof(xStart)} cannot be bigger than {nameof(Width)}");
            }
            if (yStart > Height)
            {
                throw new ArgumentOutOfRangeException(nameof(yStart), $"{nameof(yStart)} cannot be bigger than {nameof(Height)}");
            }

            if (dotSize <= 0 || dotSize >= 8)
            {
                throw new ArgumentOutOfRangeException(nameof(dotSize), $"{nameof(yStart)} cannot be less than 0 and bigger than 8");
            }

            if (dotStyle == DotStyle.DOT_FILL_AROUND)
            {
                for (uint xDir = 0; xDir < 2 * dotSize - 1; xDir++)
                {
                    for (uint yDir = 0; yDir < 2 * dotSize - 1; yDir++)
                    {
                        if (xStart + xDir - dotSize < 0 || yStart + yDir - dotSize < 0)
                        {
                            break;
                        }
                        SetPixel(xStart + xDir - dotSize, yStart + yDir - dotSize, Color);
                    }
                }
            }
            else
            {
                for (uint xDir = 0; xDir < dotSize; xDir++)
                {
                    for (uint yDir = 0; yDir < dotSize; yDir++)
                    {
                        SetPixel(xStart + xDir - 1, yStart + yDir - 1, Color);
                    }
                }
            }
        }
Exemplo n.º 5
0
        private void DispensingPot()
        {
            this.btnPrev.Enabled       = false;
            this.btnNext.Enabled       = false;
            this.grpVavelParam.Enabled = false;

            this.lblTitle.Text = this.lblTip[3];

            this.dotStyle = (DotStyle)this.cbxDotStyle.SelectedIndex;
            this.dotParam = FluidProgram.CurrentOrDefault().ProgramSettings.GetDotParam(this.dotStyle);

            Task.Factory.StartNew(new Action(() =>
            {
                Machine.Instance.Robot.MoveSafeZAndReply();

                Result result;

                double dot1Z;//, dot2Z, dot3Z;
                result = this.HeightMeasure(out dot1Z);
                if (!result.IsOk)
                {
                    this.btnPrev.Enabled = true;
                    return;
                }

                result = Machine.Instance.Valve2.DoPurgeAndPrime();
                if (!result.IsOk)
                {
                    this.btnPrev.Enabled = true;
                    return;
                }

                this.ContinueDot(dot1Z);

                this.BeginInvoke(new Action(() =>
                {
                    this.btnPrev.Enabled = true;
                    this.btnNext.Enabled = true;
                }));
            }));
        }
Exemplo n.º 6
0
        private void UpdateByIndex()
        {
            switch (index)
            {
            case 0:
                this.txtMsg.Text     = "用相机寻找到打胶中心,按 [下一步],将会在距离寻找到的中心半径5mm的四个方向打胶";
                this.btnNext.Enabled = true;
                break;

            case 1:
                this.dispensePos = Machine.Instance.Robot.PosXY;
                this.dotStyle    = (DotStyle)this.cbxDotStyle.SelectedIndex;
                this.dotParam    = FluidProgram.CurrentOrDefault().ProgramSettings.GetDotParam(dotStyle);
                this.gap         = this.dotParam.DispenseGap;
                Task.Factory.StartNew(new Action(() =>
                {
                    bool b = this.MeasureHeightAndDot();
                    this.BeginInvoke(new Action(() =>
                    {
                        if (b)
                        {
                            this.txtMsg.Text = "点胶结束,按 [下一步],将会移动到第一个点胶位置";
                        }
                        else
                        {
                            this.txtMsg.Text     = "点胶失败";
                            this.btnNext.Enabled = false;
                        }
                    }));
                }));
                break;

            case 2:
                this.txtMsg.Text = "找到第一个胶点的中心位置,按 [下一步]";
                Machine.Instance.Robot.MoveSafeZAndReply();
                //移动到点1附近
                PointD p1 = new PointD(this.dispensePos.X - 5, this.dispensePos.Y + 5);
                Machine.Instance.Robot.ManualMovePosXY(p1);

                this.txtDot2Offset.BackColor = Color.White;
                this.txtDot3Offset.BackColor = Color.White;
                this.txtDot4Offset.BackColor = Color.White;
                break;

            case 3:
                //计算实际点胶中心和胶阀中心的差值
                this.dotValveOffset = new PointD(Machine.Instance.Robot.PosX - (this.dispensePos.X - 5), Machine.Instance.Robot.PosY - (this.dispensePos.Y + 5));
                this.txtMsg.Text    = "找到第二个胶点的中心位置,按 [下一步]";
                PointD p2 = new PointD(this.dispensePos.X + 5, this.dispensePos.Y + 5);
                Machine.Instance.Robot.ManualMovePosXY(p2);
                break;

            case 4:
                //计算修正后,在点2时实际点胶中心和胶阀中心的差值
                PointD dot2Offset = new PointD();
                dot2Offset.X            = Machine.Instance.Robot.PosX - (this.dispensePos.X + 5 + this.dotValveOffset.X);
                dot2Offset.Y            = Machine.Instance.Robot.PosY - (this.dispensePos.Y + 5 + this.dotValveOffset.Y);
                this.dot2TotalOffset    = Math.Sqrt(Math.Pow(dot2Offset.X, 2) + Math.Pow(dot2Offset.Y, 2));
                this.txtDot2Offset.Text = dot2TotalOffset.ToString();

                this.txtMsg.Text = "找到第三个胶点的中心位置,按 [下一步]";
                Machine.Instance.Robot.MoveSafeZAndReply();
                PointD p3 = new PointD(this.dispensePos.X - 5, this.dispensePos.Y - 5);
                Machine.Instance.Robot.ManualMovePosXY(p3);
                break;

            case 5:
                //计算修正后,在点2时实际点胶中心和胶阀中心的差值
                PointD dot3Offset = new PointD();
                dot3Offset.X            = Machine.Instance.Robot.PosX - (this.dispensePos.X - 5 + this.dotValveOffset.X);
                dot3Offset.Y            = Machine.Instance.Robot.PosY - (this.dispensePos.Y - 5 + this.dotValveOffset.Y);
                this.dot3TotalOffset    = Math.Sqrt(Math.Pow(dot3Offset.X, 2) + Math.Pow(dot3Offset.Y, 2));
                this.txtDot3Offset.Text = dot3TotalOffset.ToString();

                this.txtMsg.Text = "找到第四个胶点的中心位置,按 [下一步]";
                Machine.Instance.Robot.MoveSafeZAndReply();
                PointD p4 = new PointD(this.dispensePos.X + 5, this.dispensePos.Y - 5);
                Machine.Instance.Robot.ManualMovePosXY(p4);
                break;

            case 6:
                //计算修正后,在点2时实际点胶中心和胶阀中心的差值
                PointD dot4Offset = new PointD();
                dot4Offset.X            = Machine.Instance.Robot.PosX - (this.dispensePos.X + 5 + this.dotValveOffset.X);
                dot4Offset.Y            = Machine.Instance.Robot.PosY - (this.dispensePos.Y - 5 + this.dotValveOffset.Y);
                this.dot4TotalOffset    = Math.Sqrt(Math.Pow(dot4Offset.X, 2) + Math.Pow(dot4Offset.Y, 2));
                this.txtDot4Offset.Text = dot4TotalOffset.ToString();

                if (this.dot2TotalOffset > Convert.ToDouble(this.txtTolerance.Text))
                {
                    this.rdoFail.Checked         = true;
                    this.rdoFail.Enabled         = true;
                    this.txtDot2Offset.BackColor = Color.DarkRed;
                }
                if (dot3TotalOffset > Convert.ToDouble(this.txtTolerance.Text))
                {
                    this.rdoFail.Checked         = true;
                    this.rdoFail.Enabled         = true;
                    this.txtDot3Offset.BackColor = Color.DarkRed;
                }
                if (dot4TotalOffset > Convert.ToDouble(this.txtTolerance.Text))
                {
                    this.rdoFail.Checked         = true;
                    this.rdoFail.Enabled         = true;
                    this.txtDot4Offset.BackColor = Color.DarkRed;
                }
                if ((dot2TotalOffset <= Convert.ToDouble(this.txtTolerance.Text)) &&
                    (dot3TotalOffset <= Convert.ToDouble(this.txtTolerance.Text)) &&
                    (dot4TotalOffset <= Convert.ToDouble(this.txtTolerance.Text)))
                {
                    this.rdoOK.Checked           = true;
                    this.rdoOK.Enabled           = true;
                    this.txtDot2Offset.BackColor = Color.White;
                    this.txtDot3Offset.BackColor = Color.White;
                    this.txtDot4Offset.BackColor = Color.White;
                }

                this.txtMsg.Text = "四点校正完成";
                break;
            }
        }
Exemplo n.º 7
0
        /// <summary>
        /// Wird bei Tastendruck ausgelöst
        /// </summary>
        /// <param name="e"></param>
        public override void KeyPressed(KeyEventArgs e)
        {
            //M swich Dotmode
            if (e.KeyCode == Keys.M)
            { Dots = (DotStyle)(((int)Dots + 1) % 3); } // % 4 für Kugeln aber sehr langsam

            //F7 Pointfield grow on/off
            if (e.KeyCode == Keys.F7)
            { reverse = !reverse; }

            //F8 shrink/grow Punktfeld
            if (e.KeyCode == Keys.F8)
            { shrink = !shrink; }

            //F9 Simulationsart switch
            if (e.KeyCode == Keys.F9)
            { form = (ParticleForms)(((int)form + 1) % 4); }

            if (e.KeyCode == Keys.D1)
            { f1 = !f1; }
            if (e.KeyCode == Keys.D2)
            { f2 = !f2; }
            if (e.KeyCode == Keys.D3)
            { f3 = !f3; }
            if (e.KeyCode == Keys.D4)
            { f4 = !f4; }
            if (e.KeyCode == Keys.D5)
            { f5 = !f5; }
            if (e.KeyCode == Keys.D6)
            { f6 = !f6; }

            //L Pointfield Flat
            if (e.KeyCode == Keys.L)
            {
                forms = initForms.flat;
                InitPoints();
            }

            //B Pointfield Würfel
            if (e.KeyCode == Keys.B)
            {
                forms = initForms.cube;
                InitPoints();
            }

            ////U Pointfields Universe
            //if (e.KeyCode == Keys.U)
            //{
            //    forms = initForms.universe;
            //    InitPoints();
            //}
        }
Exemplo n.º 8
0
        /// <summary>
        /// Wird bei Tastendruck ausgelöst
        /// </summary>
        /// <param name="e"></param>
        public override void KeyPressed(KeyEventArgs e)
        {
            //M swich Dotmode
            if (e.KeyCode == Keys.M)
            {
                Dots = (DotStyle)(((int)Dots + 1) % 3);
            }                                           // % 4 für Kugeln aber sehr langsam

            //F7 Pointfield grow on/off
            if (e.KeyCode == Keys.F7)
            {
                reverse = !reverse;
            }

            //F8 shrink/grow Punktfeld
            if (e.KeyCode == Keys.F8)
            {
                shrink = !shrink;
            }

            //F9 Simulationsart switch
            if (e.KeyCode == Keys.F9)
            {
                form = (ParticleForms)(((int)form + 1) % 4);
            }


            if (e.KeyCode == Keys.D1)
            {
                f1 = !f1;
            }
            if (e.KeyCode == Keys.D2)
            {
                f2 = !f2;
            }
            if (e.KeyCode == Keys.D3)
            {
                f3 = !f3;
            }
            if (e.KeyCode == Keys.D4)
            {
                f4 = !f4;
            }
            if (e.KeyCode == Keys.D5)
            {
                f5 = !f5;
            }
            if (e.KeyCode == Keys.D6)
            {
                f6 = !f6;
            }

            //L Pointfield Flat
            if (e.KeyCode == Keys.L)
            {
                forms = initForms.flat;
                InitPoints();
            }

            //B Pointfield Würfel
            if (e.KeyCode == Keys.B)
            {
                forms = initForms.cube;
                InitPoints();
            }

            ////U Pointfields Universe
            //if (e.KeyCode == Keys.U)
            //{
            //    forms = initForms.universe;
            //    InitPoints();
            //}
        }
Exemplo n.º 9
0
        private void UpdateByFlag()
        {
            switch (flag)
            {
            case 0:
                this.pnlDisplay.Controls.Clear();
                this.pnlDisplay.Controls.Add(this.picDiagram);
                this.picDiagram.Show();

                this.btnPrev.Enabled  = false;
                this.btnNext.Enabled  = true;
                this.btnTeach.Enabled = false;
                this.btnDone.Enabled  = false;
                this.lblTitle.Text    = this.lblTip[0];
                break;

            case 1:
                Task.Factory.StartNew(new Action(() =>
                {
                    //抬起到SafeZ
                    Machine.Instance.Robot.MoveSafeZAndReply();
                    //移动到默认平台中心点
                    Machine.Instance.Robot.ManualMovePosXYAndReply(DataSetting.Default.SubstrateCenter);

                    if (Machine.Instance.Laser.Laserable.Vendor == Laser.Vendor.Disable)
                    {
                        Machine.Instance.Robot.MovePosZAndReply(DataSetting.Default.NeedleJetZ);
                        MessageBox.Show("此时的Z轴高度为打胶时的参考高度");
                    }
                }));

                case2IsDone = false;
                //
                this.pnlDisplay.Controls.Clear();
                this.pnlDisplay.Controls.Add(this.cameraControl);
                this.cameraControl.Dock = DockStyle.Fill;
                this.cameraControl.Show();


                this.btnPrev.Enabled  = true;
                this.btnNext.Enabled  = false;
                this.btnTeach.Enabled = true;
                this.btnDone.Enabled  = false;
                this.lblTitle.Text    = this.lblTip[1];
                break;

            case 2:
                if (case2IsDone == false)
                {
                    //重新赋值平台中心点
                    DataSetting.Default.SubstrateCenter = new PointD(Machine.Instance.Robot.PosX, Machine.Instance.Robot.PosY);

                    if (Machine.Instance.Laser.Laserable.Vendor == Laser.Vendor.Disable)
                    {
                        DataSetting.Default.NeedleJetZ = Machine.Instance.Robot.PosZ;
                    }
                }
                else
                {
                }
                this.btnPrev.Enabled     = false;
                this.btnNext.Enabled     = false;
                this.btnTeach.Enabled    = false;
                this.btnDone.Enabled     = false;
                this.btnEditDot.Enabled  = false;
                this.cbxDotStyle.Enabled = false;

                this.dotStyle = (DotStyle)this.cbxDotStyle.SelectedIndex;
                this.dotParam = FluidProgram.CurrentOrDefault().ProgramSettings.GetDotParam(dotStyle);

                Task.Factory.StartNew(() =>
                {
                    double z1 = 0;
                    double z2 = 0;
                    double z3 = 0;
                    double z4 = 0;
                    if (Machine.Instance.Laser.Laserable.Vendor != Laser.Vendor.Disable)
                    {
                        int rst;
                        //关闭光源
                        Machine.Instance.Light.None();

                        Machine.Instance.MeasureHeightBefore();

                        //去点1处测高
                        Machine.Instance.Robot.ManualMovePosXYAndReply(
                            DataSetting.Default.SubstrateCenter.X - 5 + Machine.Instance.Robot.CalibPrm.HeightCamera.X,
                            DataSetting.Default.SubstrateCenter.Y + 5 + Machine.Instance.Robot.CalibPrm.HeightCamera.Y);
                        double height1;
                        rst = Machine.Instance.Laser.Laserable.ReadValue(new TimeSpan(0, 0, 1), out height1);
                        if (rst != 0)
                        {
                            MessageBox.Show(this.lblTip[2]);
                            return;
                        }
                        z1 = Machine.Instance.Robot.CalibPrm.StandardZ + (height1 - Machine.Instance.Robot.CalibPrm.StandardHeight);

                        //去点2处测高
                        Machine.Instance.Robot.ManualMovePosXYAndReply(
                            DataSetting.Default.SubstrateCenter.X + 5 + Machine.Instance.Robot.CalibPrm.HeightCamera.X,
                            DataSetting.Default.SubstrateCenter.Y + 5 + Machine.Instance.Robot.CalibPrm.HeightCamera.Y);
                        double height2;
                        rst = Machine.Instance.Laser.Laserable.ReadValue(new TimeSpan(0, 0, 1), out height2);

                        if (rst != 0)
                        {
                            MessageBox.Show(this.lblTip[2]);
                            return;
                        }
                        z2 = Machine.Instance.Robot.CalibPrm.StandardZ + (height2 - Machine.Instance.Robot.CalibPrm.StandardHeight);

                        //去点3处测高
                        Machine.Instance.Robot.ManualMovePosXYAndReply(
                            DataSetting.Default.SubstrateCenter.X + 5 + Machine.Instance.Robot.CalibPrm.HeightCamera.X,
                            DataSetting.Default.SubstrateCenter.Y - 5 + Machine.Instance.Robot.CalibPrm.HeightCamera.Y);
                        double height3;
                        rst = Machine.Instance.Laser.Laserable.ReadValue(new TimeSpan(0, 0, 1), out height3);
                        if (rst != 0)
                        {
                            MessageBox.Show(this.lblTip[2]);
                            return;
                        }
                        z3 = Machine.Instance.Robot.CalibPrm.StandardZ + (height3 - Machine.Instance.Robot.CalibPrm.StandardHeight);

                        //去点4处测高
                        Machine.Instance.Robot.ManualMovePosXYAndReply(
                            DataSetting.Default.SubstrateCenter.X - 5 + Machine.Instance.Robot.CalibPrm.HeightCamera.X,
                            DataSetting.Default.SubstrateCenter.Y - 5 + Machine.Instance.Robot.CalibPrm.HeightCamera.Y);
                        double height4;
                        rst = Machine.Instance.Laser.Laserable.ReadValue(new TimeSpan(0, 0, 1), out height4);

                        if (rst != 0)
                        {
                            MessageBox.Show(this.lblTip[2]);
                            return;
                        }
                        z4 = Machine.Instance.Robot.CalibPrm.StandardZ + (height4 - Machine.Instance.Robot.CalibPrm.StandardHeight);

                        //打开光源
                        Machine.Instance.Light.ResetToLast();
                        Machine.Instance.MeasureHeightAfter();
                    }
                    else
                    {
                        z1 = DataSetting.Default.NeedleJetZ;
                    }

                    //去清洗位置洗喷嘴
                    Result result;

                    Machine.Instance.Robot.MoveSafeZAndReply();
                    if (this.valveNo == 1)
                    {
                        result = Machine.Instance.Valve1.DoPurgeAndPrime();
                    }
                    else
                    {
                        result = Machine.Instance.Valve2.DoPurgeAndPrime();
                    }
                    if (!result.IsOk)
                    {
                        MessageBox.Show(lblTip[13]);
                        return;
                    }
                    this.BeginInvoke(new Action(() =>
                    {
                        //到点胶位置1点胶
                        this.lblTitle.Text = this.lblTip[3];
                    }));
                    //抬起到SafeZ
                    Machine.Instance.Robot.MoveSafeZAndReply();
                    if (this.valveNo == 1)
                    {
                        //移动到点胶位置1
                        PointD p1 = (DataSetting.Default.SubstrateCenter + new PointD(-5, 5)).ByNeedleCamera(ValveType.Valve1);
                        Machine.Instance.Robot.ManualMovePosXYAndReply(p1);
                        //点胶
                        this.DotByParam(1, z1);
                    }
                    else
                    {
                        //移动到点胶位置1
                        Machine.Instance.Robot.ManualMovePosXYAndReply(
                            DataSetting.Default.SubstrateCenter.X - 5 + Machine.Instance.Robot.CalibPrm.NeedleCamera2.X,
                            DataSetting.Default.SubstrateCenter.Y + 5 + Machine.Instance.Robot.CalibPrm.NeedleCamera2.Y);
                        //点胶
                        this.DotByParam(2, z1);
                    }


                    //到点胶位置2点胶
                    this.BeginInvoke(new Action(() =>
                    {
                        this.lblTitle.Text = this.lblTip[4];
                    }));
                    //抬起到SafeZ
                    Machine.Instance.Robot.MoveSafeZAndReply();
                    if (this.valveNo == 1)
                    {
                        //移动到点胶位置2
                        PointD p2 = (DataSetting.Default.SubstrateCenter + new PointD(5, 5)).ByNeedleCamera(Drive.ValveSystem.ValveType.Valve1);
                        Machine.Instance.Robot.ManualMovePosXYAndReply(p2);
                        //点胶
                        this.DotByParam(1, z1);
                    }
                    else
                    {
                        //移动到点胶位置2
                        Machine.Instance.Robot.ManualMovePosXYAndReply(
                            DataSetting.Default.SubstrateCenter.X + 5 + Machine.Instance.Robot.CalibPrm.NeedleCamera2.X,
                            DataSetting.Default.SubstrateCenter.Y + 5 + Machine.Instance.Robot.CalibPrm.NeedleCamera2.Y);
                        //点胶
                        this.DotByParam(2, z1);
                    }

                    //到点胶位置3点胶
                    this.BeginInvoke(new Action(() =>
                    {
                        this.lblTitle.Text = this.lblTip[5];
                    }));
                    //抬起到SafeZ
                    Machine.Instance.Robot.MoveSafeZAndReply();
                    if (this.valveNo == 1)
                    {
                        //移动到点胶位置3
                        PointD p3 = (DataSetting.Default.SubstrateCenter + new PointD(-5, -5)).ByNeedleCamera(Drive.ValveSystem.ValveType.Valve1);
                        Machine.Instance.Robot.ManualMovePosXYAndReply(p3);
                        //点胶
                        this.DotByParam(1, z1);
                    }
                    else
                    {
                        //移动到点胶位置3
                        Machine.Instance.Robot.ManualMovePosXYAndReply(
                            DataSetting.Default.SubstrateCenter.X - 5 + Machine.Instance.Robot.CalibPrm.NeedleCamera2.X,
                            DataSetting.Default.SubstrateCenter.Y - 5 + Machine.Instance.Robot.CalibPrm.NeedleCamera2.Y);
                        //点胶
                        this.DotByParam(2, z1);
                    }


                    //到点胶位置4点胶
                    this.BeginInvoke(new Action(() =>
                    {
                        this.lblTitle.Text = this.lblTip[6];
                    }));
                    //抬起到SafeZ
                    Machine.Instance.Robot.MoveSafeZAndReply();
                    if (this.valveNo == 1)
                    {
                        //移动到点胶位置4
                        PointD p4 = (DataSetting.Default.SubstrateCenter + new PointD(5, -5)).ByNeedleCamera(Drive.ValveSystem.ValveType.Valve1);
                        Machine.Instance.Robot.ManualMovePosXYAndReply(p4);
                        //点胶
                        this.DotByParam(1, z1);
                    }
                    else
                    {
                        //移动到点胶位置4
                        Machine.Instance.Robot.ManualMovePosXYAndReply(
                            DataSetting.Default.SubstrateCenter.X + 5 + Machine.Instance.Robot.CalibPrm.NeedleCamera2.X,
                            DataSetting.Default.SubstrateCenter.Y - 5 + Machine.Instance.Robot.CalibPrm.NeedleCamera2.Y);
                        //点胶
                        this.DotByParam(2, z1);
                    }


                    //四点点胶完成
                    this.BeginInvoke(new Action(() =>
                    {
                        this.lblTitle.Text       = this.lblTip[7];
                        this.btnPrev.Enabled     = true;
                        this.btnNext.Enabled     = true;
                        this.btnTeach.Enabled    = false;
                        this.btnDone.Enabled     = false;
                        this.btnEditDot.Enabled  = true;
                        this.cbxDotStyle.Enabled = true;
                    }));
                });
                break;

            case 3:
                case2IsDone = true;
                //抬起到SafeZ
                Machine.Instance.Robot.MoveSafeZAndReply();
                //移动到点1附近
                PointD p = (DataSetting.Default.SubstrateCenter + new PointD(-5, 5)).ByNeedleJet(Drive.ValveSystem.ValveType.Valve1);
                Machine.Instance.Robot.ManualMovePosXY(p);

                this.lblTitle.Text           = this.lblTip[8];
                this.btnPrev.Enabled         = true;
                this.btnNext.Enabled         = false;
                this.btnTeach.Enabled        = true;
                this.btnDone.Enabled         = false;
                this.txtDot2Offset.BackColor = Color.White;
                this.txtDot3Offset.BackColor = Color.White;
                this.txtDot4Offset.BackColor = Color.White;

                break;

            case 4:
                //计算点胶阀中心和真实点胶中心的差值
                if (this.valveNo == 1)
                {
                    Machine.Instance.Robot.CalibPrm.NeedleJet1 =
                        (Machine.Instance.Robot.PosXY.ToSystem() - (DataSetting.Default.SubstrateCenter + new PointD(-5, 5)).ToSystem()).ToPoint();
                }
                else
                {
                    Machine.Instance.Robot.CalibPrm.NeedleJet2 = new PointD(
                        Machine.Instance.Robot.PosX - (DataSetting.Default.SubstrateCenter.X - 5),
                        Machine.Instance.Robot.PosY - (DataSetting.Default.SubstrateCenter.Y + 5));
                }

                //抬起到SafeZ
                Machine.Instance.Robot.MoveSafeZAndReply();
                //移动到点2附近
                p = (DataSetting.Default.SubstrateCenter + new PointD(5, 5)).ByNeedleJet(Drive.ValveSystem.ValveType.Valve1);
                Machine.Instance.Robot.ManualMovePosXY(p);

                this.lblTitle.Text    = this.lblTip[9];
                this.btnPrev.Enabled  = true;
                this.btnNext.Enabled  = false;
                this.btnTeach.Enabled = true;
                this.btnDone.Enabled  = false;
                break;

            case 5:
                //计算修正后,在点2时点胶阀中心和实际点胶中心的差值
                PointD dot2Offset = new PointD();
                if (this.valveNo == 1)
                {
                    dot2Offset = (Machine.Instance.Robot.PosXY.ToSystem() - ((DataSetting.Default.SubstrateCenter + new PointD(5, 5)).ToSystem() + Machine.Instance.Robot.CalibPrm.NeedleJet1)).ToPoint();
                }
                else
                {
                    dot2Offset.X = Machine.Instance.Robot.PosX - (DataSetting.Default.SubstrateCenter.X + 5 + Machine.Instance.Robot.CalibPrm.NeedleJet2.X);
                    dot2Offset.Y = Machine.Instance.Robot.PosY - (DataSetting.Default.SubstrateCenter.Y + 5 + Machine.Instance.Robot.CalibPrm.NeedleJet2.Y);
                }
                dot2TotalOffset         = Math.Sqrt(Math.Pow(dot2Offset.X, 2) + Math.Pow(dot2Offset.Y, 2));
                this.txtDot2Offset.Text = dot2TotalOffset.ToString();

                //抬起到SafeZ
                Machine.Instance.Robot.MoveSafeZAndReply();
                //移动到点3附近
                p = (DataSetting.Default.SubstrateCenter + new PointD(-5, -5)).ByNeedleJet(Drive.ValveSystem.ValveType.Valve1);
                Machine.Instance.Robot.ManualMovePosXY(p);

                this.lblTitle.Text    = this.lblTip[10];
                this.btnPrev.Enabled  = true;
                this.btnNext.Enabled  = false;
                this.btnTeach.Enabled = true;
                this.btnDone.Enabled  = false;
                break;

            case 6:
                //计算修正后,在点3时点胶阀中心和实际点胶中心的差值
                PointD dot3Offset = new PointD();
                if (this.valveNo == 1)
                {
                    dot3Offset = (Machine.Instance.Robot.PosXY.ToSystem() - ((DataSetting.Default.SubstrateCenter + new PointD(-5, -5)).ToSystem() + Machine.Instance.Robot.CalibPrm.NeedleJet1)).ToPoint();
                }
                else
                {
                    dot3Offset.X = Machine.Instance.Robot.PosX - (DataSetting.Default.SubstrateCenter.X - 5 + Machine.Instance.Robot.CalibPrm.NeedleJet2.X);
                    dot3Offset.Y = Machine.Instance.Robot.PosY - (DataSetting.Default.SubstrateCenter.Y - 5 + Machine.Instance.Robot.CalibPrm.NeedleJet2.Y);
                }
                dot3TotalOffset         = Math.Pow((Math.Pow(dot3Offset.X, 2) + Math.Pow(dot3Offset.Y, 2)), 0.5);
                this.txtDot3Offset.Text = dot3TotalOffset.ToString();

                //抬起到SafeZ
                Machine.Instance.Robot.MoveSafeZAndReply();
                //移动到点4附近
                p = (DataSetting.Default.SubstrateCenter + new PointD(5, -5)).ByNeedleJet(Drive.ValveSystem.ValveType.Valve1);
                Machine.Instance.Robot.ManualMovePosXY(p);

                this.lblTitle.Text    = this.lblTip[11];
                this.btnPrev.Enabled  = true;
                this.btnNext.Enabled  = false;
                this.btnTeach.Enabled = true;
                this.btnDone.Enabled  = false;
                this.rdoOK.Checked    = false;
                this.rdoFail.Checked  = false;
                this.rdoOK.Enabled    = false;
                this.rdoFail.Enabled  = false;
                break;

            case 7:
                //抬起到SafeZ
                Machine.Instance.Robot.MoveSafeZAndReply();

                //计算修正后,在点4时点胶阀中心和实际点胶中心的差值
                PointD dot4Offset = new PointD();
                if (this.valveNo == 1)
                {
                    dot4Offset = (Machine.Instance.Robot.PosXY.ToSystem() - ((DataSetting.Default.SubstrateCenter + new PointD(5, -5)).ToSystem() + Machine.Instance.Robot.CalibPrm.NeedleJet1)).ToPoint();
                }
                else
                {
                    dot4Offset.X = Machine.Instance.Robot.PosX - (DataSetting.Default.SubstrateCenter.X + 5 + Machine.Instance.Robot.CalibPrm.NeedleJet2.X);
                    dot4Offset.Y = Machine.Instance.Robot.PosY - (DataSetting.Default.SubstrateCenter.Y - 5 + Machine.Instance.Robot.CalibPrm.NeedleJet2.Y);
                }
                dot4TotalOffset         = Math.Pow((Math.Pow(dot4Offset.X, 2) + Math.Pow(dot4Offset.Y, 2)), 0.5);
                this.txtDot4Offset.Text = dot4TotalOffset.ToString();

                if (dot2TotalOffset > Convert.ToDouble(this.txtTolerance.Text))
                {
                    this.rdoFail.Checked         = true;
                    this.rdoFail.Enabled         = true;
                    this.txtDot2Offset.BackColor = Color.DarkRed;
                }
                if (dot3TotalOffset > Convert.ToDouble(this.txtTolerance.Text))
                {
                    this.rdoFail.Checked         = true;
                    this.rdoFail.Enabled         = true;
                    this.txtDot3Offset.BackColor = Color.DarkRed;
                }
                if (dot4TotalOffset > Convert.ToDouble(this.txtTolerance.Text))
                {
                    this.rdoFail.Checked         = true;
                    this.rdoFail.Enabled         = true;
                    this.txtDot4Offset.BackColor = Color.DarkRed;
                }
                if ((dot2TotalOffset <= Convert.ToDouble(this.txtTolerance.Text)) &&
                    (dot3TotalOffset <= Convert.ToDouble(this.txtTolerance.Text)) &&
                    (dot4TotalOffset <= Convert.ToDouble(this.txtTolerance.Text)))
                {
                    this.rdoOK.Checked           = true;
                    this.rdoOK.Enabled           = true;
                    this.txtDot2Offset.BackColor = Color.White;
                    this.txtDot3Offset.BackColor = Color.White;
                    this.txtDot4Offset.BackColor = Color.White;
                }
                this.lblTitle.Text    = this.lblTip[12];
                this.btnPrev.Enabled  = true;
                this.btnNext.Enabled  = false;
                this.btnTeach.Enabled = false;
                this.btnDone.Enabled  = true;
                break;
            }
        }
Exemplo n.º 10
0
 /// <summary>
 /// 获取点参数
 /// </summary>
 /// <param name="dotStyle"></param>
 /// <returns></returns>
 public DotParam GetDotParam(DotStyle dotStyle)
 {
     return(dotParamList[((int)dotStyle)]);
 }