Esempio n. 1
0
        public NozzleCheck(NozzleCheckCmd nozzleCheckCmd, CoordinateCorrector coordinateCorrector)
        {
            this.NozzleCheckCmd = nozzleCheckCmd;
            Log.Dprint("nozzle check dot position : " + nozzleCheckCmd.Position + ", real : " + position);
            this.position = coordinateCorrector.Correct(nozzleCheckCmd.RunnableModule,
                                                        nozzleCheckCmd.Position, Executor.Instance.Program.ExecutantOriginOffset);
            this.ModelFindPrm    = nozzleCheckCmd.ModelFindPrm;
            this.GrayCheckPrm    = nozzleCheckCmd.GrayCheckPrm;
            this.CheckThm        = nozzleCheckCmd.CheckThm;
            this.IsOkAlarm       = nozzleCheckCmd.IsOkAlarm;
            this.param           = nozzleCheckCmd.RunnableModule.CommandsModule.Program.ProgramSettings.GetDotParam(nozzleCheckCmd.DotStyle);
            this.isWeightControl = nozzleCheckCmd.IsWeightControl;
            this.weight          = nozzleCheckCmd.Weight;
            this.isGlobal        = nozzleCheckCmd.isGlobal;
            this.nozzleStyle     = nozzleCheckCmd.NozzleStyle;
            this.RunnableModule  = nozzleCheckCmd.RunnableModule;
            Program = nozzleCheckCmd.RunnableModule.CommandsModule.Program;

            if (nozzleCheckCmd.AssociatedMeasureHeightCmd != null)
            {
                curMeasureHeightValue = nozzleCheckCmd.AssociatedMeasureHeightCmd.RealHtValue;
            }
            else
            {
                curMeasureHeightValue = this.RunnableModule.MeasuredHt;
            }
        }
Esempio n. 2
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;
            }
        }
Esempio n. 3
0
 public Dot(DotCmd dotCmd, CoordinateCorrector coordinateCorrector)
 {
     //this.Valve = dotCmd.Valve;
     this.RunnableModule = dotCmd.RunnableModule;
     if (this.RunnableModule.Mode == ModuleMode.AssignMode1 || this.RunnableModule.Mode == ModuleMode.MainMode)
     {
         this.Valve = ValveType.Valve1;
     }
     else if (this.RunnableModule.Mode == ModuleMode.DualFallow)
     {
         this.Valve = ValveType.Both;
     }
     else
     {
         this.Valve = ValveType.Valve2;
     }
     position = coordinateCorrector.Correct(dotCmd.RunnableModule, dotCmd.Position, Executor.Instance.Program.ExecutantOriginOffset);
     Log.Dprint("Dot position : " + dotCmd.Position + ", real : " + position);
     param           = dotCmd.RunnableModule.CommandsModule.Program.ProgramSettings.GetDotParam(dotCmd.DotStyle);
     isWeightControl = dotCmd.IsWeightControl;
     weight          = dotCmd.Weight;
     this.isAssign   = dotCmd.IsAssign;
     this.numShots   = dotCmd.NumShots;
     Program         = dotCmd.RunnableModule.CommandsModule.Program;
     if (dotCmd.AssociatedMeasureHeightCmd != null)
     {
         curMeasureHeightValue = dotCmd.AssociatedMeasureHeightCmd.RealHtValue;
     }
     else
     {
         curMeasureHeightValue = this.RunnableModule.MeasuredHt;
     }
     this.Tilt = dotCmd.Tilt;
 }
Esempio n. 4
0
 public Dot(DotCmd dotCmd)
 {
     //this.Valve = dotCmd.Valve;
     this.RunnableModule = dotCmd.RunnableModule;
     if (this.RunnableModule.Mode == ModuleMode.AssignMode1 || this.RunnableModule.Mode == ModuleMode.MainMode)
     {
         this.Valve = ValveType.Valve1;
     }
     else if (this.RunnableModule.Mode == ModuleMode.DualFallow)
     {
         this.Valve = ValveType.Both;
     }
     else
     {
         this.Valve = ValveType.Valve2;
     }
     position        = dotCmd.Position;
     param           = dotCmd.RunnableModule.CommandsModule.Program.ProgramSettings.GetDotParam(dotCmd.DotStyle);
     isWeightControl = dotCmd.IsWeightControl;
     weight          = dotCmd.Weight;
     this.isAssign   = dotCmd.IsAssign;
     this.numShots   = dotCmd.NumShots;
     Program         = dotCmd.RunnableModule.CommandsModule.Program;
     if (dotCmd.AssociatedMeasureHeightCmd != null)
     {
         curMeasureHeightValue = dotCmd.AssociatedMeasureHeightCmd.RealHtValue;
     }
     else
     {
         curMeasureHeightValue = this.RunnableModule.MeasuredHt;
     }
 }
Esempio n. 5
0
        public CalculateTheNeedleXYOffset(int valveNo)
        {
            this.valveNo = valveNo;
            InitializeComponent();
            this.valveControl1.Setup(valveNo);
            if (this.valveNo == 1)
            {
                this.picDiagram.Image = Properties.Resources.CalculateTheNeedleXYOffset;
            }
            else
            {
                this.picDiagram.Image = Properties.Resources.CalculateTheNeedle2XYOffset;
            }

            UpdateByFlag();

            for (int i = 0; i < 10; i++)
            {
                cbxDotStyle.Items.Add("Type " + (i + 1));
            }
            cbxDotStyle.SelectedIndex = 9;
            dotParam = FluidProgram.CurrentOrDefault().ProgramSettings.GetDotParam(dotStyle);
            this.ReadLanguageResources();
            this.FormClosed += CalculateTheNeedleXYOffset_FormClosed;
        }
Esempio n. 6
0
 public void Setup(object[] objs)
 {
     dotParam               = FluidProgram.CurrentOrDefault().ProgramSettings.GetDotParam(dotStyle);
     this.tileType          = (TiltType)objs[0];
     this.valveAngle        = (double)objs[1];
     this.valveCameraOffset = (PointD)objs[2];
     this.standardZ         = (double)objs[3];
 }
Esempio n. 7
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;
                }));
            }));
        }
Esempio n. 8
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;
            }
        }
Esempio 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;
            }
        }
Esempio n. 10
0
        private void btnAutoDispense_Click(object sender, EventArgs e)
        {
            Machine.Instance.Light.None();
            PointD p = this.pattern.SystemRel(tbLocationX.Value, tbLocationY.Value);

            Machine.Instance.Robot.MoveSafeZAndReply();
            PointD   pos   = (pattern.GetOriginSys() + p).ToMachine();
            DotParam param = FluidProgram.Current.ProgramSettings.DotParamList[comboBoxDotType.SelectedIndex];
            Result   ret   = Result.OK;
            double   targZ;

            if (Machine.Instance.Laser.Laserable.Vendor == Drive.Sensors.HeightMeasure.Laser.Vendor.Disable)
            {
                targZ = FluidProgram.Current.RuntimeSettings.BoardZValue + param.DispenseGap;
            }
            else
            {
                double curMeasureHeightValue = 0;
                //到对应点位测高
                //ret = Machine.Instance.Robot.MovePosXYAndReply(pos.ToLaser());
                ret = Machine.Instance.Robot.ManualMovePosXYAndReply(pos.ToLaser());
                if (!ret.IsOk)
                {
                    return;
                }
                //if (Machine.Instance.Setting.MachineSelect == MachineSelection.RTV)
                //{
                //    DoType.测高阀.Set(true);
                //}
                Machine.Instance.MeasureHeightBefore();
                ////激光尺读数
                Machine.Instance.Laser.Laserable.ReadValue(new TimeSpan(0, 0, 2), out curMeasureHeightValue);
                //if (Machine.Instance.Setting.MachineSelect == MachineSelection.RTV)
                //{
                //    DoType.测高阀.Set(false);
                //}
                //Result res = Machine.Instance.MeasureHeight(out curMeasureHeightValue);
                Machine.Instance.MeasureHeightAfter();

                if (curMeasureHeightValue == 0)
                {
                    return;
                }
                targZ = Converter.NeedleBoard2Z(param.DispenseGap, curMeasureHeightValue);
            }

            // 喷嘴移动到指定位置
            //ret = Machine.Instance.Robot.MovePosXYAndReply(pos.ToNeedle(Drive.ValveSystem.ValveType.Valve1));
            ret = Machine.Instance.Robot.ManualMovePosXYAndReply(pos.ToNeedle(Drive.ValveSystem.ValveType.Valve1));
            if (!ret.IsOk)
            {
                return;
            }
            // 下降z轴
            ret = Machine.Instance.Robot.MovePosZByToleranceAndReply(targZ, param.DownSpeed, param.DownAccel);
            if (!ret.IsOk)
            {
                return;
            }
            // 开胶
            Machine.Instance.Valve1.SprayOneAndWait((int)this.nudSprayTime.Value);
            //回到安全高度
            Machine.Instance.Robot.MoveSafeZAndReply();
            if (!ret.IsOk)
            {
                return;
            }
            //相机到点胶位置
            //ret = Machine.Instance.Robot.MovePosXYAndReply(pos);
            ret = Machine.Instance.Robot.ManualMovePosXYAndReply(pos);
            if (!ret.IsOk)
            {
                return;
            }
            Machine.Instance.Light.ResetToLast();
        }