private void 修正点ToolStripMenuItem_Click(object sender, EventArgs e)
 {
     try
     {
         if (product_num != 0)
         {
             return;
         }
         if (dataGridView1.CurrentRow == null)
         {
             return;
         }
         int     num   = dataGridView1.CurrentRow.Index;
         PointF4 point = new PointF4();
         point.X = DeviceRsDef.Axis_X.currPos;
         point.Y = DeviceRsDef.Axis_Y.currPos;
         point.Z = 1f;
         point.R = 0;
         if (MessageBox.Show("修改前,请确保定位到了需要校阵的点", "提示", MessageBoxButtons.OKCancel) == DialogResult.OK)
         {
             dataGridView1.Rows[dataGridView1.SelectedRows[0].Index].Cells[1].Value = point.X.ToString("f2");
             dataGridView1.Rows[dataGridView1.SelectedRows[0].Index].Cells[2].Value = point.Y.ToString("f2");
             dataGridView1.Rows[dataGridView1.SelectedRows[0].Index].Cells[3].Value = point.R.ToString("f2");
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
 public PolishPlatformPara()
 {
     machinePolish        = new PointF2();
     machinePolishcarmera = new PointF2();
     ResetPos             = new PointF4();
     EndPos = new PointF4();
 }
 public ReverseData()
 {
     ResetPos = new PointF4();
     EndPos   = new PointF4();
     WorkPos  = new PointF4();
     ReversZ  = 0;
 }
 public bool Start(PointF4 StickPos)
 {
     LG.Exe();
     Para.NuzzleSwitch = 1;
     Para.PointData    = StickPos;
     return(true);
 }
Example #5
0
 public TinCleanData()
 {
     CleanPos  = new PointF4();
     CleanTime = 100;
     PosLength = 10;
     PosSpeed  = 75;
     NegLength = 10;
     NegSpeed  = 75;
 }
Example #6
0
 public FeederParaDef()
 {
     TakePos    = new PointF4();
     EndTakePos = new PointF4();
     FeederMode = new List <bool>()
     {
         true, false
     };
 }
        /// <summary>
        /// 相机中心到焊锡头转换
        /// </summary>
        /// <param name="id">平台编号</param>
        /// <param name="SolderPos">相机给的打磨点数据</param>
        /// <returns></returns>
        public static PointF4 CameraToSolderPos(int id, PointF4 SolderPos)
        {
            PointF4 f4 = new PointF4();

            f4.X = SolderPos.X + ProjectData.Instance.SaveData.SolderPlatform[id].machineSoldercamera.X - ProjectData.Instance.SaveData.SolderPlatform[id].machineSolder.X;
            f4.Y = SolderPos.Y + ProjectData.Instance.SaveData.SolderPlatform[id].machineSoldercamera.Y - ProjectData.Instance.SaveData.SolderPlatform[id].machineSolder.Y;
            f4.Z = SolderPos.Z;
            f4.R = SolderPos.R;
            return(f4);
        }
        /// <summary>
        /// 相机中心转换到打磨头
        /// </summary>
        /// <param name="id">平台编号</param>
        /// <param name="PolishPos">拍照给的打磨点数据</param>
        /// <returns></returns>
        public static PointF4 CameraToPolisherPos(int id, PointF4 PolishPos)
        {
            PointF4 f4 = new PointF4();

            f4.X = PolishPos.X + ProjectData.Instance.SaveData.PolishPlatform[id].machinePolishcarmera.X - ProjectData.Instance.SaveData.PolishPlatform[id].machinePolish.X;
            f4.Y = PolishPos.Y + ProjectData.Instance.SaveData.PolishPlatform[id].machinePolishcarmera.Y - ProjectData.Instance.SaveData.PolishPlatform[id].machinePolish.Y;
            f4.Z = PolishPos.Z;
            f4.R = PolishPos.R;
            return(f4);
        }
 public SolderPlatformPara()
 {
     machineSolder       = new PointF2();
     machineSoldercamera = new PointF2();
     ResetPos            = new PointF4();
     EndPos          = new PointF4();
     teachingMechine = new TeachingMechinePra();
     UseR            = false;
     PerTimesClean   = 1;
 }
Example #10
0
 public PolishData()
 {
     TotalReimburse = 0;
     Interval       = 500;
     Reimburse      = 0.1f;
     TotalReimburse = 0;
     CTDelay        = 25;
     SafeZ          = 0;
     TimesTotal     = 500;
     EndPos         = new PointF4();
 }
Example #11
0
        private PointF4 StickPos(int Num)
        {
            PointF4 stickPosTerm = new PointF4();

            stickPosTerm.X = Product.Inst.ProcessData.NuzzlePara[Num].CCDPos.X + Product.Inst.ProcessData.CurrStickWhichPoint().X;
            stickPosTerm.Y = Product.Inst.ProcessData.NuzzlePara[Num].CCDPos.Y + Product.Inst.ProcessData.CurrStickWhichPoint().Y;
            stickPosTerm.Z = Product.Inst.ProcessData.CurrStickWhichPoint().Z;
            stickPosTerm.R = Product.Inst.ProcessData.CurrStickWhichPoint().R + Product.Inst.ProcessData.NuzzlePara[Num].CCDPos.R;
            stickPos       = Product.Inst.Stickdata.StickSysData.UpCCDToNuzzle(Num, stickPosTerm);
            return(stickPos);
        }
Example #12
0
 public PolishCleanData()
 {
     TimesSum    = 50;
     Mode        = 1;
     CleanTimes  = 1;
     range       = 0.5f;
     CleanTime   = 100;
     CleanPos    = new PointF4();
     CleanEndPos = new PointF4();
     CleanSpeed  = 100;
     interval    = 0.5f;
 }
        }                                                   // 在初始机械结构中,焊头在旋转中前状态时候的初始角度,
                                                            // 为了计算焊头的点转换成相机点的一种转换方式

        public TeachingMechinePra()
        {
            ZeroPostion             = new PointF2();
            ReversePostion          = new PointF2();
            RotatePostion           = new PointF2();
            RotatePstionCameraSize  = new PointF2();
            CameraRotatePostion     = new PointF2();
            HXT_OrgPostion          = new PointF4();
            RotatePstionHXT_Size    = new PointF2();
            RotatePostionStartAngle = 0;
            Radius = 0;
        }
Example #14
0
        private void SaveProductData(ProductDef product)
        {
            Mark1  = product.MarkPoint[0];
            Mark2  = product.MarkPoint[1];
            Code   = product.CodePoint2;
            BackCT = product.BackCT;

            Mark1.X  = (float)Convert.ToDouble(Mark1X.Text);
            Mark1.Y  = (float)Convert.ToDouble(Mark1Y.Text);
            Mark2.X  = (float)Convert.ToDouble(Mark2X.Text);
            Mark2.Y  = (float)Convert.ToDouble(Mark2Y.Text);
            BackCT.X = (float)Convert.ToDouble(BackCTX.Text);
            BackCT.Y = (float)Convert.ToDouble(BackCTY.Text);
            Code.X   = (float)Convert.ToDouble(CodeX.Text);
            Code.Y   = (float)Convert.ToDouble(CodeY.Text);
        }
Example #15
0
 public bool Start(PointF4 pos)
 {
     if (LG.execute == 0)
     {
         Para.PointData.X  = pos.X;
         Para.PointData.Y  = pos.Y;
         Para.PointData.Z  = pos.Z;
         Para.PointData.R  = pos.R;
         Para.NuzzleSwitch = 1;
         LG.Exe();
         return(true);
     }
     else
     {
         return(false);
     }
 }
Example #16
0
        public ProcessDataDef()
        {
            PlatformData = new List <PlatformData>();
            for (int i = 0; i < 8; i++)
            {
                PlatformData.Add(new PlatformData());
            }
            LocatedPointPos = new PointF4();

            Agingdataforpolish = new PolishDef();
            Agingdataforsolder = new SolderDef();

            LPolishModel = new List <PolishModel>();
            RPolishModel = new List <PolishModel>();
            LSolderModel = new List <SolderModel>();
            RSolderModel = new List <SolderModel>();
        }
Example #17
0
 /// <summary>
 /// 上相机坐标转换为吸嘴坐标
 /// </summary>
 /// <param name="whichNuzzle">哪个吸嘴</param>
 /// <param name="pos">相机中心位置</param>
 /// <returns></returns>
 public PointF4 UpCCDToNuzzle(int whichNuzzle, PointF4 pos)
 {
     if (whichNuzzle == 0)
     {
         PointF4 p = new PointF4();
         p.X = pos.X - (LiftCCDPos.X - LiftNuzzlePos.X);
         p.Y = pos.Y - (LiftCCDPos.Y - LiftNuzzlePos.Y);
         p.Z = pos.Z;
         p.R = pos.R;
         return(p);
     }
     else
     {
         PointF4 p = new PointF4();
         p.X = pos.X - (RightCCDPos.X - RightNuzzlePos.X);
         p.Y = pos.Y - (RightCCDPos.Y - RightNuzzlePos.Y);
         p.R = pos.R;
         p.Z = pos.Z;
         return(p);
     }
 }
Example #18
0
        private void RefreshTableList()
        {
            var Product = Database.Product.Inst.Stickdata.TrayData.ProductList[product_num];

            Mark1  = Product.MarkPoint[0];
            Mark2  = Product.MarkPoint[1];
            Code   = Product.CodePoint2;
            BackCT = Product.BackCT;


            Mark1X.Text  = Mark1.X.ToString();
            Mark1Y.Text  = Mark1.Y.ToString();
            Mark2X.Text  = Mark2.X.ToString();
            Mark2Y.Text  = Mark2.Y.ToString();
            BackCTX.Text = BackCT.X.ToString();
            BackCTY.Text = BackCT.Y.ToString();
            CodeX.Text   = Code.X.ToString();
            CodeY.Text   = Code.Y.ToString();

            dataGridView1.AutoGenerateColumns = false;
            BindingSource source = new BindingSource();

            source.DataSource        = Product.SiteList;
            dataGridView1.DataSource = source;
            dataGridView1.Columns[0].DataPropertyName           = "SitePoint_num";
            dataGridView1.Columns[0].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
            dataGridView1.Columns[0].DefaultCellStyle.Format    = "0";
            dataGridView1.Columns[1].DataPropertyName           = "X";
            dataGridView1.Columns[1].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
            dataGridView1.Columns[1].DefaultCellStyle.Format    = "00.000";
            dataGridView1.Columns[2].DataPropertyName           = "Y";
            dataGridView1.Columns[2].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
            dataGridView1.Columns[2].DefaultCellStyle.Format    = "00.000";
            dataGridView1.Columns[3].DataPropertyName           = "R";
            dataGridView1.Columns[3].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
            dataGridView1.Columns[3].DefaultCellStyle.Format    = "00.000";
            dataGridView1.Columns[4].DataPropertyName           = "Z";
            dataGridView1.Columns[4].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
            dataGridView1.Columns[4].DefaultCellStyle.Format    = "00.000";
        }
Example #19
0
 public PolishPosData()
 {
     Pos        = new PointF4();
     polishData = new PolishDef();
 }
Example #20
0
 public TakeLabelParaDef()
 {
     TakePos = new PointF4();
 }
Example #21
0
 public NuzzleParaDef()
 {
     CCDPos = new PointF4();
 }
Example #22
0
        private void button8_Click(object sender, EventArgs e)//定位
        {
            int          index = comboBox1.SelectedIndex;
            DialogResult data  = DialogResult.None;

            if (RowCount < 0)
            {
                return;
            }
            PointF4 f4 = new PointF4();

            float x  = 0;
            float y  = 0;
            float aa = 0;

            switch (_id)
            {
            case LEFT_SOLDER:
                f4.X = _SolderPos[index].pos[RowCount].pos.X + _SolderPos[index].Vpos.X;
                f4.Y = _SolderPos[index].pos[RowCount].pos.Y + _SolderPos[index].Vpos.Y;
                f4.Z = _SolderPos[index].pos[RowCount].pos.Z;
                f4.R = _SolderPos[index].pos[RowCount].pos.R;

                Tools.WriteLog.AddLog(DateTime.Now.ToString() + "焊锡左X;" + f4.X.ToString() + "Y:" + f4.Y.ToString() + "Z:" + f4.Z.ToString() + "R:" + f4.R.ToString() + "基点X:" + _SolderPos[index].Vpos.X.ToString() + "Y:" + _SolderPos[index].Vpos.Y.ToString());

                if (FormMain.RunProcess.LogicData.RunData.Rotate)
                {
                    FormMain.RunProcess.Transorm(Logic.UsingPlatformSelect.Left, _SolderPos[index].Vpos.X, _SolderPos[index].Vpos.Y,
                                                 f4.X, f4.Y, f4.R, this.ang, out x, out y);
                    aa = (float)(this.ang * 180 / Math.PI);

                    while (!FormMain.RunProcess.LogicAPI.PlatformMove[0].exe((int)AxisDef.AxX1, ((int)AxisDef.AxY1),
                                                                             (int)AxisDef.AxZ1, (int)AxisDef.AxR1, ((int)AxisDef.AxT1), x, y, FormMain.RunProcess.LogicData.slaverData.basics.Safe_ZL, f4.R + aa, 2, 0))
                    {
                        Thread.Sleep(1);
                    }
                }
                else
                {
                    while (!FormMain.RunProcess.LogicAPI.PlatformMove[0].exe((int)AxisDef.AxX1, ((int)AxisDef.AxY1),
                                                                             (int)AxisDef.AxZ1, (int)AxisDef.AxR1, ((int)AxisDef.AxT1), f4.X, f4.Y, FormMain.RunProcess.LogicData.slaverData.basics.Safe_ZL, f4.R, 2, 0))
                    {
                        Thread.Sleep(1);
                    }
                }


                Thread.Sleep(100);
                while (!(FormMain.RunProcess.LogicAPI.PlatformMove[0].sta() && FormMain.RunProcess.LogicAPI.PlatformMove[0].start != 1))
                {
                    Thread.Sleep(1);
                }

                if (MessageBox.Show("是否Z轴下降到焊点", "", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.Yes)
                {
                    FormMain.RunProcess.movedriverZm.MoveAbs((int)AxisDef.AxZ1, FormMain.RunProcess.LogicData.slaverData.basics.TeachSpeedL, f4.Z);
                }

                break;

            case RIGHT_SOLSER:
                f4.X = _SolderPos[index].pos[RowCount].pos.X + _SolderPos[index].Vpos.X;
                f4.Y = _SolderPos[index].pos[RowCount].pos.Y + _SolderPos[index].Vpos.Y;
                f4.Z = _SolderPos[index].pos[RowCount].pos.Z;
                f4.R = _SolderPos[index].pos[RowCount].pos.R;

                Tools.WriteLog.AddLog(DateTime.Now.ToString() + "焊锡右X;" + f4.X.ToString() + "Y:" + f4.Y.ToString() + "Z:" + f4.Z.ToString() + "R:" + f4.R.ToString() + "基点X:" + _SolderPos[index].Vpos.X.ToString() + "Y:" + _SolderPos[index].Vpos.Y.ToString());

                if (FormMain.RunProcess.LogicData.RunData.Rotate_r)
                {
                    FormMain.RunProcess.Transorm(Logic.UsingPlatformSelect.Right, _SolderPos[index].Vpos.X, _SolderPos[index].Vpos.Y,
                                                 f4.X, f4.Y, f4.R, this.ang, out x, out y);
                    aa = (float)(this.ang * 180 / Math.PI);

                    while (!FormMain.RunProcess.LogicAPI.PlatformMove[1].exe((int)AxisDef.AxX2, ((int)AxisDef.AxY2),
                                                                             (int)AxisDef.AxZ2, (int)AxisDef.AxR2, ((int)AxisDef.AxT2), x, y, /*f4.X, f4.Y,*/ FormMain.RunProcess.LogicData.slaverData.basics.Safe_ZR, f4.R + aa, 2, 0))
                    {
                        Thread.Sleep(1);
                    }
                }
                else
                {
                    while (!FormMain.RunProcess.LogicAPI.PlatformMove[1].exe((int)AxisDef.AxX2, ((int)AxisDef.AxY2),
                                                                             (int)AxisDef.AxZ2, (int)AxisDef.AxR2, ((int)AxisDef.AxT2), f4.X, f4.Y, FormMain.RunProcess.LogicData.slaverData.basics.Safe_ZR, f4.R, 2, 0))
                    {
                        Thread.Sleep(1);
                    }
                }
                Thread.Sleep(100);
                while (!(FormMain.RunProcess.LogicAPI.PlatformMove[1].sta() && FormMain.RunProcess.LogicAPI.PlatformMove[1].start != 1))
                {
                    Thread.Sleep(1);
                }

                if (MessageBox.Show("是否Z轴下降到焊点", "", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.Yes)
                {
                    FormMain.RunProcess.movedriverZm.MoveAbs((int)AxisDef.AxZ2, FormMain.RunProcess.LogicData.slaverData.basics.TeachSpeedR, f4.Z);
                }

                break;

            case LEFT_POLISH:
                f4.X = _polishPos[index].pos[RowCount].pos.X + _polishPos[index].Vpos.X;
                f4.Y = _polishPos[index].pos[RowCount].pos.Y + _polishPos[index].Vpos.Y;
                f4.Z = _polishPos[index].pos[RowCount].pos.Z;
                f4.R = _polishPos[index].pos[RowCount].pos.R;

                Tools.WriteLog.AddLog(DateTime.Now.ToString() + "打磨左X;" + f4.X.ToString() + "Y:" + f4.Y.ToString() + "Z:" + f4.Z.ToString() + "R:" + f4.R.ToString() + "基点X:" + _polishPos[index].Vpos.X.ToString() + "Y:" + _polishPos[index].Vpos.Y.ToString());

                while (!FormMain.RunProcess.LogicAPI.PlatformMove[0].exe((int)AxisDef.AxX3, ((int)AxisDef.AxY1),
                                                                         (int)AxisDef.AxZ3, (int)AxisDef.AxR3, ((int)AxisDef.AxT1), f4.X, f4.Y, FormMain.RunProcess.LogicData.slaverData.basics.Safe_Z, f4.R, 2, 0))
                {
                    Thread.Sleep(1);
                }
                Thread.Sleep(100);
                while (!(FormMain.RunProcess.LogicAPI.PlatformMove[0].sta() && FormMain.RunProcess.LogicAPI.PlatformMove[0].start != 1))
                {
                    Thread.Sleep(1);
                }

                if (MessageBox.Show("是否Z轴下降到磨点", "", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.Yes)
                {
                    FormMain.RunProcess.movedriverZm.MoveAbs((int)AxisDef.AxZ3, FormMain.RunProcess.LogicData.slaverData.basics.TeachSpeed, f4.Z);
                }

                break;

            case RIGHT_POLISH:
                f4.X = _polishPos[index].pos[RowCount].pos.X + _polishPos[index].Vpos.X;
                f4.Y = _polishPos[index].pos[RowCount].pos.Y + _polishPos[index].Vpos.Y;
                f4.Z = _polishPos[index].pos[RowCount].pos.Z;
                f4.R = _polishPos[index].pos[RowCount].pos.R;

                Tools.WriteLog.AddLog(DateTime.Now.ToString() + "打磨右X;" + f4.X.ToString() + "Y:" + f4.Y.ToString() + "Z:" + f4.Z.ToString() + "R:" + f4.R.ToString() + "基点X:" + _polishPos[index].Vpos.X.ToString() + "Y:" + _polishPos[index].Vpos.Y.ToString());

                while (!FormMain.RunProcess.LogicAPI.PlatformMove[1].exe((int)AxisDef.AxX3, ((int)AxisDef.AxY2),
                                                                         (int)AxisDef.AxZ3, (int)AxisDef.AxR3, ((int)AxisDef.AxT2), f4.X, f4.Y, FormMain.RunProcess.LogicData.slaverData.basics.Safe_Z, f4.R, 2, 0))
                {
                    Thread.Sleep(1);
                }
                Thread.Sleep(100);
                while (!(FormMain.RunProcess.LogicAPI.PlatformMove[1].sta() && FormMain.RunProcess.LogicAPI.PlatformMove[1].start != 1))
                {
                    Thread.Sleep(1);
                }

                if (MessageBox.Show("是否Z轴下降到磨点", "", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.Yes)
                {
                    FormMain.RunProcess.movedriverZm.MoveAbs((int)AxisDef.AxZ3, FormMain.RunProcess.LogicData.slaverData.basics.TeachSpeed, f4.Z);
                }

                break;
            }
        }
Example #23
0
        private void button7_Click(object sender, EventArgs e)
        {
            button2_Click(null, null);
            Thread.Sleep(200);
            PointF4 f4    = new PointF4();
            PointF? point = null;

            switch (_id)
            {
            case LEFT_SOLDER:
                //VisionProject.Instance.LocateSolderLeftShape();
                f4.X = FormMain.RunProcess.movedriverZm.CurrentPos.FloatValue[(int)AxisDef.AxX1];
                f4.Y = FormMain.RunProcess.movedriverZm.CurrentPos.FloatValue[(int)AxisDef.AxY1];

                point = VisionProject.Instance.LocateSolderLeftShape(hImage.Clone(), OperShapeIndex, this.hWndCtrller, out this.ang);

                Thread.Sleep(100);
                if (point != null)
                {
                    _SolderPos[OperShapeIndex].Vpos.X = f4.X + point.Value.X;
                    _SolderPos[OperShapeIndex].Vpos.Y = f4.Y + point.Value.Y;

                    Tools.WriteLog.AddLog(DateTime.Now.ToString() + "拍照识别偏差 X;" + point.Value.X.ToString() + "Y;" + point.Value.Y.ToString()
                                          + "基点坐标X:" + _SolderPos[OperShapeIndex].Vpos.X.ToString() + "Y:" + _SolderPos[OperShapeIndex].Vpos.Y.ToString());


                    string info = "X偏移" + point.Value.X.ToString("f2") + ",Y偏移" + point.Value.Y.ToString("f2") + ",是否移动到中心点?";
                    if (MessageBox.Show(info, "", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.Yes)
                    {
                        while (!FormMain.RunProcess.LogicAPI.PlatformMove[0].exe((int)AxisDef.AxX1, ((int)AxisDef.AxY1), (int)AxisDef.AxZ1, (int)AxisDef.AxR1, ((int)AxisDef.AxT1), _SolderPos[OperShapeIndex].Vpos.X, _SolderPos[OperShapeIndex].Vpos.Y, FormMain.RunProcess.LogicData.slaverData.basics.Safe_ZL, 0, 2, 0))
                        {
                            Thread.Sleep(1);
                        }
                        Thread.Sleep(100);
                        while (!(FormMain.RunProcess.LogicAPI.PlatformMove[0].sta() && FormMain.RunProcess.LogicAPI.PlatformMove[0].start != 1))
                        {
                            Thread.Sleep(1);
                        }
                    }
                    button5.Enabled = button9.Enabled = button8.Enabled = true;
                }
                else
                {
                    MessageBox.Show("基准点设置失败");
                    button5.Enabled = button9.Enabled = button8.Enabled = false;
                }
                break;

            case RIGHT_SOLSER:
                //VisionProject.Instance.LocateSolderRightShape();
                f4.X  = FormMain.RunProcess.movedriverZm.CurrentPos.FloatValue[(int)AxisDef.AxX2];
                f4.Y  = FormMain.RunProcess.movedriverZm.CurrentPos.FloatValue[(int)AxisDef.AxY2];
                point = VisionProject.Instance.LocateSolderRightShape(hImage.Clone(), OperShapeIndex, this.hWndCtrller, out this.ang);
                Thread.Sleep(100);
                if (point != null)
                {
                    _SolderPos[OperShapeIndex].Vpos.X = f4.X + point.Value.X;
                    _SolderPos[OperShapeIndex].Vpos.Y = f4.Y + point.Value.Y;
                    Tools.WriteLog.AddLog(DateTime.Now.ToString() + "拍照识别偏差 X;" + point.Value.X.ToString() + "Y;" + point.Value.Y.ToString()
                                          + "基点坐标X:" + _SolderPos[OperShapeIndex].Vpos.X.ToString() + "Y:" + _SolderPos[OperShapeIndex].Vpos.Y.ToString());

                    string info = "X偏移" + point.Value.X.ToString("f2") + ",Y偏移" + point.Value.Y.ToString("f2") + ",是否移动到中心点?";
                    if (MessageBox.Show(info, "", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.Yes)
                    {
                        while (!FormMain.RunProcess.LogicAPI.PlatformMove[1].exe((int)AxisDef.AxX2, ((int)AxisDef.AxY2), (int)AxisDef.AxZ2, (int)AxisDef.AxR2, ((int)AxisDef.AxT2), _SolderPos[OperShapeIndex].Vpos.X, _SolderPos[OperShapeIndex].Vpos.Y, FormMain.RunProcess.LogicData.slaverData.basics.Safe_ZL, 0, 2, 0))
                        {
                            Thread.Sleep(1);
                        }
                        Thread.Sleep(100);
                        while (!(FormMain.RunProcess.LogicAPI.PlatformMove[1].sta() && FormMain.RunProcess.LogicAPI.PlatformMove[1].start != 1))
                        {
                            Thread.Sleep(1);
                        }
                        Thread.Sleep(100);
                        while (!(FormMain.RunProcess.LogicAPI.PlatformMove[0].sta() && FormMain.RunProcess.LogicAPI.PlatformMove[0].start != 1))
                        {
                            Thread.Sleep(1);
                        }
                    }
                    button5.Enabled = button9.Enabled = button8.Enabled = true;
                }
                else
                {
                    MessageBox.Show("基准点设置失败");
                    button5.Enabled = button9.Enabled = button8.Enabled = false;
                }
                break;

            case LEFT_POLISH:
                //VisionProject.Instance.LocatePolishLeftShape();
                f4.X  = FormMain.RunProcess.movedriverZm.CurrentPos.FloatValue[(int)AxisDef.AxX3];
                f4.Y  = FormMain.RunProcess.movedriverZm.CurrentPos.FloatValue[(int)AxisDef.AxY1];
                point = VisionProject.Instance.LocatePolishLeftShape(hImage.Clone(), OperShapeIndex, this.hWndCtrller);
                Thread.Sleep(100);
                if (point != null)
                {
                    _polishPos[OperShapeIndex].Vpos.X = f4.X + point.Value.X;
                    _polishPos[OperShapeIndex].Vpos.Y = f4.Y + point.Value.Y;

                    Tools.WriteLog.AddLog(DateTime.Now.ToString() + "拍照识别偏差 X;" + point.Value.X.ToString() + "Y;" + point.Value.Y.ToString()
                                          + "基点坐标X:" + _polishPos[OperShapeIndex].Vpos.X.ToString() + "Y:" + _polishPos[OperShapeIndex].Vpos.Y.ToString());

                    string info = "X偏移" + point.Value.X.ToString("f2") + ",Y偏移" + point.Value.Y.ToString("f2") + ",是否移动到中心点?";
                    if (MessageBox.Show(info, "", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.Yes)
                    {
                        while (!FormMain.RunProcess.LogicAPI.PlatformMove[0].exe((int)AxisDef.AxX3, ((int)AxisDef.AxY1), (int)AxisDef.AxZ3, (int)AxisDef.AxR3, ((int)AxisDef.AxT1), _polishPos[OperShapeIndex].Vpos.X, _polishPos[OperShapeIndex].Vpos.Y, FormMain.RunProcess.LogicData.slaverData.basics.Safe_ZL, 0, 2, 0))
                        {
                            Thread.Sleep(1);
                        }
                        Thread.Sleep(100);
                        while (!(FormMain.RunProcess.LogicAPI.PlatformMove[0].sta() && FormMain.RunProcess.LogicAPI.PlatformMove[0].start != 1))
                        {
                            Thread.Sleep(1);
                        }
                    }
                    button5.Enabled = button9.Enabled = button8.Enabled = true;
                }
                else
                {
                    MessageBox.Show("基准点设置失败");
                    button5.Enabled = button9.Enabled = button8.Enabled = false;
                }
                break;

            case RIGHT_POLISH:
                //VisionProject.Instance.LocatePolishRightShape();
                f4.X  = FormMain.RunProcess.movedriverZm.CurrentPos.FloatValue[(int)AxisDef.AxX3];
                f4.Y  = FormMain.RunProcess.movedriverZm.CurrentPos.FloatValue[(int)AxisDef.AxY2];
                point = VisionProject.Instance.LocatePolishRightShape(hImage.Clone(), OperShapeIndex, this.hWndCtrller);
                Thread.Sleep(100);
                if (point != null)
                {
                    _polishPos[OperShapeIndex].Vpos.X = f4.X + point.Value.X;
                    _polishPos[OperShapeIndex].Vpos.Y = f4.Y + point.Value.Y;
                    Tools.WriteLog.AddLog(DateTime.Now.ToString() + "拍照识别偏差 X;" + point.Value.X.ToString() + "Y;" + point.Value.Y.ToString()
                                          + "基点坐标X:" + _polishPos[OperShapeIndex].Vpos.X.ToString() + "Y:" + _polishPos[OperShapeIndex].Vpos.Y.ToString());

                    string info = "X偏移" + point.Value.X.ToString("f2") + ",Y偏移" + point.Value.Y.ToString("f2") + ",是否移动到中心点?";
                    if (MessageBox.Show(info, "", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.Yes)
                    {
                        while (!FormMain.RunProcess.LogicAPI.PlatformMove[1].exe((int)AxisDef.AxX3, ((int)AxisDef.AxY2), (int)AxisDef.AxZ3, (int)AxisDef.AxR3, (int)AxisDef.AxT2, _polishPos[OperShapeIndex].Vpos.X, _polishPos[OperShapeIndex].Vpos.Y, FormMain.RunProcess.LogicData.slaverData.basics.Safe_ZL, 0, 2, 0))
                        {
                            Thread.Sleep(1);
                        }
                        Thread.Sleep(100);
                        while (!(FormMain.RunProcess.LogicAPI.PlatformMove[1].sta() && FormMain.RunProcess.LogicAPI.PlatformMove[1].start != 1))
                        {
                            Thread.Sleep(1);
                        }
                    }
                    button5.Enabled = button9.Enabled = button8.Enabled = true;
                }
                else
                {
                    MessageBox.Show("基准点设置失败");
                    button5.Enabled = button9.Enabled = button8.Enabled = false;
                }
                break;
            }
            Repaint();
        }
Example #24
0
        private void 添加点ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            int type = 0;

            if (Database.Product.Inst.Stickdata.TrayData.ProductList.Count < 1)
            {
                ProductDef product = new ProductDef();
                Database.Product.Inst.Stickdata.TrayData.ProductList.Add(product);
                product_num = 0;
                RefreshTreeView();
            }

            PointF4 point = new PointF4();
            HTuple  X     = new HTuple();
            HTuple  Y     = new HTuple();

            if (TaskMain.sticklogic.markscan.GetDone &&
                TaskMain.sticklogic.markscan.MarkResult.Count > 0 &&
                TaskMain.sticklogic.markscan.MarkResult.Count >= (product_num * 2 + 1))
            {
                //VisionProject.Instance.SetBenchmark1(Database.Product.Inst.Stickdata.TrayData.ProductList[product_num].MarkPoint[0].X,
                //    Database.Product.Inst.Stickdata.TrayData.ProductList[product_num].MarkPoint[0].Y,
                //    Database.Product.Inst.Stickdata.TrayData.ProductList[product_num].MarkPoint[0].R,
                //    0, Database.Product.Inst.Stickdata.TrayData.MarkMode == 0 ? false : true);

                //VisionProject.Instance.SetBenchmark1(Database.Product.Inst.Stickdata.TrayData.ProductList[product_num].MarkPoint[1].X,
                //    Database.Product.Inst.Stickdata.TrayData.ProductList[product_num].MarkPoint[1].Y,
                //    Database.Product.Inst.Stickdata.TrayData.ProductList[product_num].MarkPoint[1].R,
                //    1, Database.Product.Inst.Stickdata.TrayData.MarkMode == 0 ? false : true);


                //VisionProject.Instance.SetBenchmark2(TaskMain.sticklogic.markscan.MarkResult[product_num * 2].X,
                //TaskMain.sticklogic.markscan.MarkResult[product_num * 2].Y,
                //    TaskMain.sticklogic.markscan.MarkResult[product_num * 2].R,
                //    0, Database.Product.Inst.Stickdata.TrayData.MarkMode == 0 ? false : true);

                //VisionProject.Instance.SetBenchmark2(TaskMain.sticklogic.markscan.MarkResult[product_num * 2 + 1].X,
                //    TaskMain.sticklogic.markscan.MarkResult[product_num * 2 + 1].Y,
                //    TaskMain.sticklogic.markscan.MarkResult[product_num * 2 + 1].R,
                //    1, Database.Product.Inst.Stickdata.TrayData.MarkMode == 0 ? false : true);

                //VisionProject.Instance.ReverseTransPoint2d(DeviceRsDef.Axis_X.currPos, DeviceRsDef.Axis_Y.currPos,
                //    out X, out Y, Database.Product.Inst.Stickdata.TrayData.MarkMode == 0 ? false : true);
            }
            else
            {
                MessageBox.Show("先扫描mark点");
                return;
            }

            SitePoint site = new SitePoint();

            site.X             = X[0].F;
            site.Y             = Y[0].F;
            site.Z             = 1f;
            site.R             = 0;
            site.LableType     = type;
            site.Product_num   = product_num;
            site.SitePoint_num = Database.Product.Inst.Stickdata.TrayData.ProductList[product_num].SiteList.Count;

            Database.Product.Inst.Stickdata.TrayData.ProductList[product_num].SiteList.Add(site);
            RefreshTableList();
        }
Example #25
0
 public PolishPosdata()
 {
     pos       = new PointF4();
     polishDef = new PolishDef();
 }
Example #26
0
        private PointF4 TakePos(int Num)
        {
            PointF4 pos = Product.Inst.Stickdata.StickSysData.UpCCDToNuzzle(Num, Product.Inst.Stickdata.FeederPara.TakePos);

            return(pos);
        }
Example #27
0
 public SolderData()
 {
     TinEndPos = new PointF4();
     SafeZ     = 0;
     CTDelay   = 25;
 }
        private void buttonArr_Click(object sender, EventArgs e)
        {
            if ((!radioButton1.Checked) && (!radioButton2.Checked))
            {
                MessageBox.Show("请选择方向并确认");
                return;
            }

            int Num = Convert.ToInt32(numericUpDown10.Value);

            int dripDirection = radioButton1.Checked ? 0 : 1;//点胶方式

            pLeftUp.X = Convert.ToSingle(numericUpDown1.Value);
            pLeftUp.Y = Convert.ToSingle(numericUpDown2.Value);
            pLeftUp.Z = Convert.ToSingle(numericUpDown3.Value);


            pRightUp.X = Convert.ToSingle(numericUpDown4.Value);
            pRightUp.Y = Convert.ToSingle(numericUpDown5.Value);
            pRightUp.Z = Convert.ToSingle(numericUpDown6.Value);

            pRightDwon.X = Convert.ToSingle(numericUpDown7.Value);
            pRightDwon.Y = Convert.ToSingle(numericUpDown8.Value);
            pRightDwon.Z = Convert.ToSingle(numericUpDown9.Value);

            List <PointF3> List;

            if (dripDirection == 0)
            {
                List = PointArray.MatrixArrayList(pLeftUp, pRightUp, pRightDwon, Num, 2, dripDirection);
            }
            else
            {
                List = PointArray.MatrixArrayList(pLeftUp, pRightUp, pRightDwon, 2, Num, dripDirection);
            }

            if (List.Count < 2)
            {
                return;
            }

            //DripLine = new List<DripLineDef>();

            for (int i = 1; i < List.Count; i++)
            {
                //DripLineDef def = new DripLineDef();
                PointF4 f4 = new PointF4();

                f4.X = List[i - 1].X;
                f4.Y = List[i - 1].Y;
                f4.Z = List[i - 1].Z;

                //def.Point.Add(f4);

                PointF4 point = new PointF4();

                point.X = List[i].X;
                point.Y = List[i].Y;
                point.Z = List[i].Z;

                //def.Point.Add(point);

                //DripLine.Add(def);
            }
        }
Example #29
0
 public SolderPosdata()
 {
     pos       = new PointF4();
     solderDef = new SolderDef();
     rinse     = new bool();
 }
Example #30
0
 public SolderPosData()
 {
     Pos        = new PointF4();
     SolderData = new SolderDef();
     Rinse      = new bool();
 }