private void roundButton_ReadImg_Click(object sender, EventArgs e)
        {
            for (int i = 0; i < comboBox_SelCam.Items.Count; i++)
            {
                CameraMgr.GetInstance().SetTriggerSoftMode(comboBox_SelCam.Items[i].ToString());
            }
            using (OpenFileDialog openFileDialog = new OpenFileDialog())
            {
                // openFileDialog.InitialDirectory = AppDomain.CurrentDomain.BaseDirectory;//注意这里写路径时要用c:\\而不是c:\
                openFileDialog.Filter           = "图片|*.jpg;*.png;*.gif;*.jpeg;*.bmp";
                openFileDialog.RestoreDirectory = true;
                openFileDialog.FilterIndex      = 1;
                openFileDialog.Multiselect      = false;
                openFileDialog.Title            = "打开图片";

                if (openFileDialog.ShowDialog() == DialogResult.OK)
                {
                    //string  fName = openFileDialog.FileName;
                    string  strPath = openFileDialog.FileName;
                    HObject img     = null;
                    HOperatorSet.ReadImage(out img, strPath);
                    visionControl1.DispImageFull(img);
                }
            }
        }
Example #2
0
        private void roundButton_VisionPrTest_Click(object sender, EventArgs e)
        {
            if (comboBox_SelVisionPR.SelectedIndex == -1)
            {
                return;
            }
            string strVisionPrName = comboBox_SelVisionPR.Items[comboBox_SelVisionPR.SelectedIndex].ToString();

            roundButton_VisionPrTest.Enabled = false;
            Action action = new Action(() =>
            {
                string camname = VisionMgr.GetInstance().GetCamName(strVisionPrName);
                double?Expouse = VisionMgr.GetInstance().GetExpourseTime(strVisionPrName);
                double?Gain    = VisionMgr.GetInstance().GetGain(strVisionPrName);

                CameraMgr.GetInstance().SetCamExposure(camname, (double)Expouse);
                CameraMgr.GetInstance().SetCamGain(camname, (double)Gain);
                CameraMgr.GetInstance().BindWindow(camname, visionControl1);
                CameraMgr.GetInstance().ClaerPr(camname);
                CameraMgr.GetInstance().GetCamera(camname).SetTriggerMode(CameraModeType.Software);
            }
                                       );

            action.BeginInvoke((ar) =>
            {
                roundButton_VisionPrTest.Invoke((MethodInvoker)(() => { roundButton_VisionPrTest.Enabled = true; }), null);
            }, null);
        }
Example #3
0
 private void button1_Click_1(object sender, EventArgs e)
 {
     #region 读图
     //HObject img;
     //HOperatorSet.ReadImage(out img, "d:\\1.jpg");
     ////hWindowControl1.SetFullImagePart((HImage)(object)img);
     //HOperatorSet.DispObj(img, hWindowControl1.HalconID);
     #endregion
     #region 软触发
     //CameraMgr.GetInstance().GetCamera("CHP").SetTriggerMode("SoftWare");
     //uint nFrameNum =CameraMgr.GetInstance().GetCamera("CHP").FrameCount;
     //CameraMgr.GetInstance().GetCamera("CHP").GarbBySoftTrigger();
     //CameraMgr.GetInstance().GetCamera("CHP");
     //Task s = new Task((icount) =>
     //{
     //    uint frameCount =CameraMgr.GetInstance().GetCamera("CHP").FrameCount;
     //    while (frameCount <= nFrameNum)
     //    {
     //        frameCount = CameraMgr.GetInstance().GetCamera("CHP").FrameCount;
     //        Thread.Sleep(1);
     //    }
     //    HObject img = CameraMgr.GetInstance().GetCamera("CHP").GetImage();
     //    HOperatorSet.DispObj(img, (HTuple)CameraMgr.GetInstance().GetCamera("CHP").wnd);
     //},nFrameNum) ;
     //s.Start();
     #endregion
     string PagesItemName = this.Parent.Name;
     //  CameraMgr.GetInstance().GetCamera(PagesItemName).wnd = hWindowControl1.HalconID;
     CameraMgr.GetInstance().GetCamera(PagesItemName).StartGrab();
 }
Example #4
0
 public static void CloseHardWork()
 {
     CameraMgr.GetInstance().Close();
     TcpMgr.GetInstance().CloseAllEth();
     MotionMgr.GetInstace().Close();
     IOMgr.GetInstace().Close();
 }
Example #5
0
        private void Form_CameraDebug_Load(object sender, EventArgs e)
        {
            visionControl1.InitWindow();
            HOperatorSet.SetDraw(visionControl1.GetHalconWindow(), "margin");
            Thread.Sleep(10);
            List <string> camname = CameraMgr.GetInstance().GetCameraNameArr();

            foreach (var temp in camname)
            {
                this.Sel.Items.Add(temp.ToString());
                comboBox_SelCam.Items.Add(temp.ToString());
                CameraMgr.GetInstance().ClaerPr(temp.ToString());
            }
            if (camname.Count > 0)
            {
                comboBox_SelCam.SelectedIndex = 0;
            }

            textBox_exposureTimeVal.Text = CameraMgr.GetInstance().GetCamExposure(comboBox_SelCam.Text).ToString();
            textBox_GainVal.Text         = CameraMgr.GetInstance().GetCamGain(comboBox_SelCam.Text).ToString();
            CameraMgr.GetInstance().BindWindow(comboBox_SelCam.Text, visionControl1);
            CameraMgr.GetInstance().SetAcquisitionMode(comboBox_SelCam.Text);
            UpdataVisionItems();
            ParamSetMgr.GetInstance().m_eventLoadProductFileUpadata += UpdataVisionItems;
        }
Example #6
0
        private void Form_Manual_Load(object sender, EventArgs e)
        {
            visionControl1.InitWindow();
            Thread.Sleep(10);
            List <string> camname = CameraMgr.GetInstance().GetCameraNameArr();

            foreach (var temp in camname)
            {
                comboBox_SelCamera.Items.Add(temp.ToString());
            }
            if (camname != null && camname.Count > 0)
            {
                comboBox_SelCamera.Visible       = true;
                comboBox_SelCamera.SelectedIndex = 0;
            }
            else
            {
                visionControl1.Visible        = false;
                button_ContinuousSnap.Visible = false;
                button2.Visible = false;
                comboBox_SelVisionPR.Visible     = false;
                roundButton_VisionPrTest.Visible = false;
            }
            VisionMgr.GetInstance().PrItemChangedEvent += ChagedPrItem;
            ChagedPrItem("");
        }
Example #7
0
        private void roundButton_AddItem_Click(object sender, EventArgs e)
        {
            ItemAdd itemAdd = null;

            if (CameraMgr.GetInstance().GetCameraNameArr() != null && CameraMgr.GetInstance().GetCameraNameArr().Count > 0)
            {
                itemAdd = new ItemAdd(CameraMgr.GetInstance().GetCameraNameArr().ToArray());
            }
            else
            {
                itemAdd = new ItemAdd(null);
            }
            DialogResult dialogResult = itemAdd.ShowDialog();

            if (dialogResult == DialogResult.Yes)
            {
                if (VisionMgr.GetInstance().GetItemNamesAndTypes().ContainsKey(itemAdd.ItemName))
                {
                    MessageBox.Show("视觉处理:名称重复", "Err", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
                else
                {
                    int index = dataGridViewProcessItem.Rows.Count;
                    CreateAndSaveItem(itemAdd.ItemName, itemAdd.VisionProcssName, itemAdd.CamName,
                                      itemAdd.Exposure, itemAdd.Gain);
                }
                dataGridViewProcessItem.Rows.Add("False", itemAdd.ItemName,
                                                 itemAdd.VisionProcssName, itemAdd.CamName,
                                                 itemAdd.Exposure.ToString(), itemAdd.Gain.ToString());
            }
        }
Example #8
0
 private void comboBox_SelCamera_SelectedIndexChanged(object sender, EventArgs e)
 {
     for (int i = 0; i < comboBox_SelCamera.Items.Count; i++)
     {
         CameraMgr.GetInstance().SetTriggerSoftMode(comboBox_SelCamera.Items[i].ToString());
     }
     CameraMgr.GetInstance().BindWindow(comboBox_SelCamera.Text, visionControl1);
     CameraMgr.GetInstance().SetAcquisitionMode(comboBox_SelCamera.Text);
 }
        private void OnShowChanged(object sender, EventArgs e)
        {
            List <string> camname = CameraMgr.GetInstance().GetCameraNameArr();

            foreach (var tem in camname)
            {
                CameraMgr.GetInstance().ClaerPr(tem);
            }
        }
Example #10
0
        private void BtnSanp_Click(object sender, EventArgs e)
        {
            string     strCamName = "Top";
            CameraBase cameraBase = CameraMgr.GetInstance().GetCamera(strCamName);

            cameraBase.StopGrap();
            cameraBase.BindWindow(visionControl1);
            cameraBase.SetTriggerMode(CameraModeType.Software);
            CameraMgr.GetInstance().GetCamera(strCamName).StartGrab();
            CameraMgr.GetInstance().GetCamera(strCamName).GarbBySoftTrigger();
        }
 private void comboBox_SelCam_SelectedIndexChanged(object sender, EventArgs e)
 {
     for (int i = 0; i < comboBox_SelCam.Items.Count; i++)
     {
         CameraMgr.GetInstance().SetTriggerSoftMode(comboBox_SelCam.Items[i].ToString());
     }
     textBox_exposureTimeVal.Text = CameraMgr.GetInstance().GetCamExposure(comboBox_SelCam.Text).ToString();
     textBox_GainVal.Text         = CameraMgr.GetInstance().GetCamGain(comboBox_SelCam.Text).ToString();
     CameraMgr.GetInstance().BindWindow(comboBox_SelCam.Text, visionControl1);
     CameraMgr.GetInstance().SetAcquisitionMode(comboBox_SelCam.Text);
 }
        private void roundButton_ContinuousSnap_Click(object sender, EventArgs e)
        {
            for (int i = 0; i < comboBox_SelCam.Items.Count; i++)
            {
                CameraMgr.GetInstance().SetTriggerSoftMode(comboBox_SelCam.Items[i].ToString());
            }

            CameraMgr.GetInstance().BindWindow(comboBox_SelCam.Text, visionControl1);
            CameraMgr.GetInstance().SetAcquisitionMode(comboBox_SelCam.Text);
            CameraMgr.GetInstance().GetCamera(comboBox_SelCam.Text).StartGrab();
            // textBox_exposureTimeVal.Text = CameraMgr.GetInstance().GetCamExposure(comboBox_SelCam.Text).ToString();
            //  textBox_GainVal.Text = CameraMgr.GetInstance().GetCamGain(comboBox_SelCam.Text).ToString();
            CameraMgr.GetInstance().SetCamExposure(comboBox_SelCam.Text, textBox_exposureTimeVal.Text.ToDouble());
            CameraMgr.GetInstance().SetCamGain(comboBox_SelCam.Text, textBox_GainVal.Text.ToDouble());
        }
Example #13
0
        private void ContinuousSnap_Click(object sender, EventArgs e)
        {
            string     strCamName = "Top";
            CameraBase cameraBase = CameraMgr.GetInstance().GetCamera(strCamName);

            cameraBase.StopGrap();
            cameraBase.SetTriggerMode(CameraModeType.Software);

            double valexposure = cameraBase.GetExposureTime();
            double valgain     = cameraBase.GetGain();

            cameraBase.BindWindow(visionControl1);
            cameraBase.SetAcquisitionMode();
            cameraBase.StartGrab();
        }
Example #14
0
        private void button_ContinuousSnap_Click(object sender, EventArgs e)
        {
            if (comboBox_SelCamera.SelectedItem == null)
            {
                return;
            }
            CameraMgr.GetInstance().BindWindow(comboBox_SelCamera.Text, visionControl1);
            CameraBase pCamer = CameraMgr.GetInstance().GetCamera(comboBox_SelCamera.SelectedItem.ToString());

            pCamer.SetTriggerMode(CameraModeType.Software);
            Thread.Sleep(100);
            CameraMgr.GetInstance().GetCamera(comboBox_SelCamera.SelectedItem.ToString()).SetAcquisitionMode();
            // CameraMgr.GetInstance().GetCamera(comboBox_SelCamera.SelectedItem.ToString()).wnd = hWindowControl1.HalconID;
            CameraMgr.GetInstance().GetCamera(comboBox_SelCamera.SelectedItem.ToString()).StartGrab();
        }
Example #15
0
        public static void InitCam(Form_Auto formauto)
        {
            List <CameraBase> cameraBases = new List <CameraBase>();

            //默认添加的是海康相机 如果换相机 填上对应的类
            CameraMgr.GetInstance().EnumDevices(new HikVisionCamera(""), out cameraBases);
            foreach (var temp in cameraBases)
            {
                temp.Open();
                temp.SetExposureTime(1000);
                temp.SetGain(1);
                temp.RegisterCallBack();
                temp.SetAcquisitionMode();

                temp.StartGrab();
            }
        }
Example #16
0
 private void button2_Click(object sender, EventArgs e)
 {
     if (comboBox_SelCamera.SelectedItem == null)
     {
         return;
     }
     for (int i = 0; i < comboBox_SelCamera.Items.Count; i++)
     {
         CameraMgr.GetInstance().ClaerPr(comboBox_SelCamera.Items[i].ToString());
         CameraMgr.GetInstance().SetTriggerSoftMode(comboBox_SelCamera.Items[i].ToString());
     }
     CameraMgr.GetInstance().BindWindow(comboBox_SelCamera.Text, visionControl1);
     CameraMgr.GetInstance().GetCamera(comboBox_SelCamera.SelectedItem.ToString()).SetTriggerMode(CameraModeType.Software);
     Thread.Sleep(100);
     //CameraMgr.GetInstance().GetCamera(comboBox_SelCamera.SelectedItem.ToString()).wnd = hWindowControl1.HalconID;
     CameraMgr.GetInstance().GetCamera(comboBox_SelCamera.SelectedItem.ToString()).StartGrab();
     CameraMgr.GetInstance().GetCamera(comboBox_SelCamera.SelectedItem.ToString()).GarbBySoftTrigger();
 }
Example #17
0
 public static void CloseHardWork()
 {
     //for (int i = 0; i < 6; i++)
     //    LightControl.GetInstance().CloseLight(i);
     ResetIO();
     AlarmMgr.GetIntance().StopAlarmBeet();
     CameraMgr.GetInstance().Close();
     TcpMgr.GetInstance().CloseAllEth();
     MotionMgr.GetInstace().Close();
     IOMgr.GetInstace().Close();
     if (ParamSetMgr.GetInstance().GetBoolParam("是否选择程控电源"))
     {
         OtherDevices.ckPower.SetVoltage(1, 0);
         OtherDevices.ckPower.SetVoltage(2, 0);
     }
     //  LightControl.GetInstance().Close();
     //  Weighing.GetInstance().Close();
 }
        private void Form_CameraDebug_Load(object sender, EventArgs e)
        {
            visionControl1.InitWindow();
            HOperatorSet.SetDraw(visionControl1.GetHalconWindow(), "margin");

            Thread.Sleep(10);
            List <string> camname = CameraMgr.GetInstance().GetCameraNameArr();

            foreach (var temp in camname)
            {
                this.Sel.Items.Add(temp.ToString());
                comboBox_SelCam.Items.Add(temp.ToString());
                CameraMgr.GetInstance().ClaerPr(temp.ToString());
            }
            if (camname.Count > 0)
            {
                comboBox_SelCam.SelectedIndex = 0;
            }
            DataGridViewComboBoxColumn sd = (DataGridViewComboBoxColumn)dataGridViewProcessItem.Columns[2];

            sd.Items.Clear();

            TypeLists = AssemblyOperate.GetAllSubClassTypeOnRunDir(typeof(VisionSetpBase));
            foreach (var temp in TypeLists)
            {
                string DescriptionName = AssemblyOperate.GetDescription(temp);
                if (DescriptionName != "NoDescription")
                {
                    sd.Items.Add(DescriptionName);
                }
            }
            dataGridViewProcessItem.Columns[1].ReadOnly = true;
            dataGridViewProcessItem.Columns[2].ReadOnly = true;
            dataGridViewProcessItem.Columns[3].ReadOnly = true;
            textBox_exposureTimeVal.Text = CameraMgr.GetInstance().GetCamExposure(comboBox_SelCam.Text).ToString();
            textBox_GainVal.Text         = CameraMgr.GetInstance().GetCamGain(comboBox_SelCam.Text).ToString();
            CameraMgr.GetInstance().BindWindow(comboBox_SelCam.Text, visionControl1);
            CameraMgr.GetInstance().SetAcquisitionMode(comboBox_SelCam.Text);
            UpdataVisionItems();
            ParamSetMgr.GetInstance().m_eventLoadProductFileUpadata += UpdataVisionItems;
        }
        private void roundButton_AddItem_Click(object sender, EventArgs e)
        {
            ItemAdd itemAdd = null;

            if (CameraMgr.GetInstance().GetCameraNameArr() != null && CameraMgr.GetInstance().GetCameraNameArr().Count > 0)
            {
                itemAdd = new ItemAdd(CameraMgr.GetInstance().GetCameraNameArr().ToArray());
            }
            else
            {
                itemAdd = new ItemAdd(null);
            }
            DialogResult dialogResult = itemAdd.ShowDialog();

            if (dialogResult == DialogResult.Yes)
            {
                dataGridViewProcessItem.Rows.Add("False", itemAdd.ItemName,
                                                 itemAdd.VisionProcssName, itemAdd.CamName,
                                                 itemAdd.Exposure.ToString(), itemAdd.Gain.ToString(), itemAdd.nLightVal.ToString());
            }
        }
Example #20
0
        public StationStep StepGoSnap(VisionControl visionControl, bool bmanual = false)
        {
            StationStep step = StationStep.Step_Stop;

            //拍照识别是否有料,计算偏差(6月后做)
            ParamSetMgr.GetInstance().SetBoolParam("启动点胶", true);
            //开始点胶(优先实现画轨迹)
            //获取当前夹取位置是A工位还是B工位
            int StationIndex = TableData.GetInstance().GetSocketNum(1, 0.5) - 1;

            PathHelper.Disp_ID = StationIndex;
            string stationAAName = StationIndex == 0 ? "A" : "B";

            ParamSetMgr.GetInstance().SetBoolParam($"{stationAAName}工位点胶", true);
            double     CenterX      = ParamSetMgr.GetInstance().GetDoubleParam("产品点胶X轴半径");
            double     CenterY      = ParamSetMgr.GetInstance().GetDoubleParam("产品点胶Y轴半径");
            double     DelZ         = ParamSetMgr.GetInstance().GetDoubleParam("点胶Z轴上升高度偏差");
            int        DispDelay    = ParamSetMgr.GetInstance().GetIntParam("出胶延迟");
            double     DispRunAngle = ParamSetMgr.GetInstance().GetDoubleParam("画胶角度");
            double     DispEndAngle = ParamSetMgr.GetInstance().GetDoubleParam("收胶角度");
            bool       DispEnable   = ParamSetMgr.GetInstance().GetBoolParam("屏蔽点胶");
            bool       DispPhoto    = ParamSetMgr.GetInstance().GetBoolParam("点胶相机拍照定位");
            double     SafeZ        = GetStationPointDic()[$"安全位置"].pointZ;
            double     X            = 0;
            double     Y            = 0;
            double     DispPhotoX   = GetStationPointDic()[$"{stationAAName}工位拍照位"].pointX;
            double     DispPhotoY   = GetStationPointDic()[$"{stationAAName}工位拍照位"].pointY;
            double     DispPhotoZ   = GetStationPointDic()[$"{stationAAName}工位拍照位"].pointZ;
            double     DispPosX     = GetStationPointDic()[$"{stationAAName}工位点胶位"].pointX;
            double     DispPosY     = GetStationPointDic()[$"{stationAAName}工位点胶位"].pointY;
            double     DispPosZ     = GetStationPointDic()[$"{stationAAName}工位点胶位"].pointZ;
            double     x1           = GetStationPointDic()["安全位置"].pointX;
            CameraBase cam          = null;

            if (!ParamSetMgr.GetInstance().GetBoolParam("屏蔽上相机"))
            {
                cam = CameraMgr.GetInstance().GetCamera("Top");
                cam.BindWindow(visionControl);
                Task.Run(() =>
                {
                    cam.StopGrap();
                    cam.SetTriggerMode(CameraModeType.Software);
                    cam.SetGain(ParamSetMgr.GetInstance().GetIntParam("点胶相机增益"));
                    cam.SetExposureTime(ParamSetMgr.GetInstance().GetIntParam("点胶相机曝光"));
                    cam.StartGrab();
                });
            }
            IOMgr.GetInstace().WriteIoBit($"相机光源", true);
retry_uplens:
            IOMgr.GetInstace().WriteIoBit($"{stationAAName}Lens升降气缸", true);
            WaranResult waranResult1 = CheckIobyName($"{stationAAName}Lens上升到位", true, $"{stationAAName}Lens上升到位", bmanual);

            if (waranResult1 == WaranResult.Retry)
            {
                goto retry_uplens;
            }
            MoveSigleAxisPosWaitInpos(AxisZ, SafeZ, (double)SpeedType.High, 0.005, bmanual, this);
            MoveY(DispPhotoY, SpeedType.High);

            MoveMulitAxisPosWaitInpos(new int[] { AxisX, AxisZ }, new double[] { DispPhotoX, DispPhotoZ }, new double[] { (double)SpeedType.High, (double)SpeedType.High }, 0.005, bmanual, this);
            HObject img = null;



            if (!ParamSetMgr.GetInstance().GetBoolParam("屏蔽上相机"))
            {
                img = cam.GetImage();
                if (img == null || !img.IsInitialized())
                {
                    img = cam.GetImage();
                }
                else
                {
                    ImageHelper.Instance.SaveImage($"{PathHelper.ImagePathDisp}{DateTime.Now.ToString("HHmmssfff")}.bmp", "bmp", img.Clone());
                }
            }


            IOMgr.GetInstace().WriteIoBit($"相机光源", false);
            //去画胶
            Task.Run(() =>
            {
                if (ParamSetMgr.GetInstance().GetBoolParam("是否选择程控电源"))
                {
                    double valueVoltage = ParamSetMgr.GetInstance().GetDoubleParam("程控电源电压");
                    OtherDevices.ckPower.SetVoltage(StationIndex + 1, valueVoltage);
                    double valueCurrent = ParamSetMgr.GetInstance().GetDoubleParam("程控电源电流");
                    OtherDevices.ckPower.SetCurrent(StationIndex + 1, valueCurrent);
                }
                IOMgr.GetInstace().WriteIoBit($"{stationAAName}模组上电", true);
                IOMgr.GetInstace().WriteIoBit($"12V开启", ParamSetMgr.GetInstance().GetBoolParam("是否开启非程控12V"));
            });
            if (DispEnable)
            {
                step = StationStep.Step_CheckIpos;
                MoveSigleAxisPosWaitInpos(AxisZ, SafeZ, (double)SpeedType.High, 0.005, bmanual, this);
                TableData.GetInstance().SetStationResult("A_UnLoadLoad", true);
                TableData.GetInstance().SetStationResult("B_UnLoadLoad", true);
                return(step);
            }
            if (DispPhoto)
            {
                ////MoveY(DispPhotoY, SpeedType.High);
                ////MoveMulitAxisPosWaitInpos(new int[] { AxisX, AxisZ }, new double[] { DispPhotoX, DispPhotoZ }, new double[] { (double)SpeedType.High, (double)SpeedType.High }, 0.005, bmanual, this);

                //拍照计算 +半径
                double CenterdelX = 0;
                double CenterdelY = 0;
                X        = CenterX + CenterdelX;
                Y        = CenterdelY;
                DispPosX = DispPhotoX - X;
                DispPosY = DispPhotoY + CenterdelY;
            }
            else
            {
                X = CenterX;
                Y = 0;
            }
            //  IOMgr.GetInstace().WriteIoBit("点胶机", false);
            bool brtnExc = true;

            MotionMgr.GetInstace().AddAxisToGroup("点胶群组", 2, new int[] { AxisX, AxisY });

            MoveY(DispPosY, SpeedType.High);
            MoveMulitAxisPosWaitInpos(new int[] { AxisX, AxisZ }, new double[] { DispPosX, DispPosZ + DelZ + 10 }, new double[] { (double)SpeedType.High, (double)SpeedType.High }, 0.005, bmanual, this);

            //    MoveMulitAxisPosWaitInpos(new int[] { AxisX }, new double[] { DispPosX }, new double[] { (double)SpeedType.High }, 0.005, bmanual, this);
            IOMgr.GetInstace().WriteIoBit("点胶机", false);
            MoveMulitAxisPosWaitInpos(new int[] { AxisZ }, new double[] { DispPosZ + DelZ }, new double[] { (double)SpeedType.High }, 0.005, bmanual, this);
            if (ParamSetMgr.GetInstance().GetStringParam("点胶轨迹") == "Circle")
            {
                DateTime dateTime = DateTime.Now;
                if (DispDelay >= 0)
                {
                    IOMgr.GetInstace().WriteIoBit("点胶机", true);
                    Thread.Sleep(DispDelay);
                }
                else
                {
                    Task.Run(() =>
                    {
                        while (true)
                        {
                            if ((DateTime.Now - dateTime).TotalSeconds > Math.Abs(DispDelay) / 1000.0)
                            {
                                IOMgr.GetInstace().WriteIoBit("点胶机", true);
                                break;
                            }
                            Thread.Sleep(10);
                        }
                    });
                }



                //走

                brtnExc &= MotionMgr.GetInstace().ClearBufMove("点胶群组");
                brtnExc &= MotionMgr.GetInstace().RestGpErr("点胶群组");
                //  GpState gps = MotionMgr.GetInstace().GetGpState("点胶群组");
                brtnExc &= MotionMgr.GetInstace().AddBufMove("点胶群组", BufMotionType.buf_Arc2dAbsAngleCW, 1, 2, (double)SpeedType.Mid, (double)SpeedType.Mid, new double[2] {
                    X, Y
                }, new double[2] {
                    DispPosZ, 0
                });
                brtnExc &= MotionMgr.GetInstace().BufTrans("点胶群组");//M314没有buf运动,所以放在这里star
                brtnExc &= MotionMgr.GetInstace().BufStart("点胶群组");
                Thread.Sleep(400);
                if (!WaitXY(DispPosX, DispPosY))
                {
                    IOMgr.GetInstace().WriteIoBit("点胶机", false);
                    return(step);
                }
                IOMgr.GetInstace().WriteIoBit("点胶机", false);
            }
            else
            {
                IOMgr.GetInstace().WriteIoBit("点胶机", true);
                Thread.Sleep(DispDelay);
                MoveY(DispPosY + CenterY * 10, SpeedType.Mid);
                MoveMulitAxisPosWaitInpos(new int[] { AxisX }, new double[] { DispPosX + CenterX * 2 }, new double[] { (double)SpeedType.Mid }, 0.005, bmanual, this);
                MoveY(DispPosY - CenterY * 10, SpeedType.Mid);
                MoveMulitAxisPosWaitInpos(new int[] { AxisX }, new double[] { DispPosX }, new double[] { (double)SpeedType.Mid }, 0.005, bmanual, this);
                MoveY(DispPosY, SpeedType.Mid);
                IOMgr.GetInstace().WriteIoBit("点胶机", false);
            }
            IOMgr.GetInstace().WriteIoBit($"相机光源", true);

            MoveMulitAxisPosWaitInpos(new int[] { AxisZ }, new double[] { DispPosZ + 3 }, new double[] { (double)SpeedType.Mid }, 0.005, bmanual, this);

            MoveMulitAxisPosWaitInpos(new int[] { AxisZ }, new double[] { DispPosZ + 10 }, new double[] { (double)SpeedType.High }, 0.005, bmanual, this);
            if (!ParamSetMgr.GetInstance().GetBoolParam("屏蔽上相机"))
            {
                MoveMulitAxisPosWaitInpos(new int[] { AxisX, AxisZ }, new double[] { DispPhotoX, DispPhotoZ }, new double[] { (double)SpeedType.High, (double)SpeedType.High }, 0.005, bmanual, this);
                // MoveSigleAxisPosWaitInpos(AxisX, DispPhotoX, (double)SpeedType.High, 0.005, bmanual, this);
                MoveY(DispPhotoY, SpeedType.High);
                HObject img2 = cam.GetImage();
                if (img2 == null || !img2.IsInitialized())
                {
                    img2 = cam.GetImage();
                }
                else
                {
                    ImageHelper.Instance.SaveImage($"{PathHelper.ImagePathDisp}{DateTime.Now.ToString("HHmmssfff")}.bmp", "bmp", img2.Clone());
                }
            }
            IOMgr.GetInstace().WriteIoBit($"相机光源", false);

            MoveMulitAxisPosWaitInpos(new int[] { AxisZ }, new double[] { SafeZ }, new double[] { (double)SpeedType.High }, 0.005, bmanual, this);
            MoveSigleAxisPosWaitInpos(AxisX, x1, (double)SpeedType.High, 0.005, bmanual, this);
            step = StationStep.Step_CheckIpos;
            //if (DialogResult.OK!= MessageBox.Show("请确定点胶效果是否OK,OK按确定", "Info", MessageBoxButtons.OKCancel, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1, MessageBoxOptions.DefaultDesktopOnly))
            //{
            //    ParamSetMgr.GetInstance().SetBoolParam("重新上料", true);
            //    return step;
            //}
            ParamSetMgr.GetInstance().SetBoolParam("重新上料", false);
            SocketMgr.GetInstance().SetSocketState(SocketNumOfUnloadLoad, SocketState.Have);
            TableData.GetInstance().SetStationResult("A_UnLoadLoad", true);
            TableData.GetInstance().SetStationResult("B_UnLoadLoad", true);
            ParamSetMgr.GetInstance().SetBoolParam("点胶完成", true);
            return(step);
        }
 private void roundButton_SnapSave_Click(object sender, EventArgs e)
 {
     // roundButton1_Click(null, null);
     CameraMgr.GetInstance().SaveImg(comboBox_SelCam.Text);
 }