private void btn_Scan3D_Click(object sender, EventArgs e) { m_objFixture8338.SickLaserPowerOnOff(false); System.Threading.Thread.Sleep(200); m_objFixture8338.Scan(); m_objFixture8338.SickLaserPowerOnOff(true); }
private void pbx_ShowImage_Click(object sender, EventArgs e) { int x, y; string strAsk; DialogResult dlgRes; strAsk = string.Format("将激光移动至 点 X={0} Y= {1}", m_PointSelX, m_PointSelY); dlgRes = MessageBox.Show(strAsk, "确认信息", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (dlgRes == DialogResult.No) { return; } //激光点标定 // x =(int) (m_PointSelX * (51.744) - m_PointSelY*(105.08)+87296.7); //y = (int)(m_PointSelX * (105.08) + m_PointSelY* (51.744) -46792.34); x = (int)(-67.1875 * m_PointSelX + 143431.0625); y = (int)(151.646706586826 * m_PointSelY + 33815.8263473054); //x = 17438; //y = 20771; ////相机相对平移 //x -= 1500; //y -= 3500; m_objFixture.SickLaserPowerOnOff(true); m_objFixture.MovePT_Line(x, y); MoveTheRealPoint(); }
private void InitialHal() { m_objComPort = new clsFixture.stComPort(); if (Properties.Settings.Default.PLC_ComNum == "") { MessageBox.Show("Com Number 输入错误!"); return; } m_objComPort.strComPortNumber = Properties.Settings.Default.PLC_ComNum; m_objComPort.iBaundRate = Properties.Settings.Default.PLC_BaudRate; m_objComPort.iDataBit = Properties.Settings.Default.PLC_DataBit; m_objComPort.iStopBit = Properties.Settings.Default.PLC_StopBit; m_objComPort.strParity = Properties.Settings.Default.PLC_Parity; //m_objFixtureAMP204 = new clsFixtureAMP204(); //if (m_objFixtureAMP204.InitialFixture(Properties.Settings.Default.Card204, 0) == false) //{ // MessageBox.Show("APM 204 card initial fail 通信初始化失败!!!"); // ShowLog("APM 204 初始化失败"); // //return; //} //else //{ // ShowLog("APM 204 初始化成功"); //} //m_objFixtureAMP204.ServoOn(true); //m_objFixtureAMP204.HomeXY(); //scanner try { clsScanner.Callback += new clsScanner.OnMessageCallback(ShowLog); m_objScanner = new clsScanner(); } catch (Exception ex) { MessageBox.Show(ex.Message); } m_objFixture8338 = new clsFixture8338(); if (m_objFixture8338.InitialFixture(Properties.Settings.Default.Card8338ID) == false) { MessageBox.Show("card 8338 initial fail 通信初始化失败!!!"); ShowLog("PCIE-8338 初始化失败"); //return; } else { ShowLog("PCIE-8338 初始化成功"); } m_objFixture8338.SickLaserPowerOnOff(true); m_objFixture8338.Scanner = m_objScanner; m_objFixture8338.ServoOn(true); m_objFixture8338.HomeXY(); //frmShowImage objImageShowFromLocal = new frmShowImage(); //pbxLocal = objImageShowFromLocal.PbxShowImage; m_objCameraLocl = new CCBasler(); List <ICameraInfo> listCam = CCBasler.GetDeviceList(); bool findLocalCam = false; foreach (ICameraInfo cam in listCam) { if (cam[CameraInfoKey.FriendlyName].Contains(Properties.Settings.Default.Camera_LocalSN)) { findLocalCam = true; m_objCameraLocl.SetDeviceInfo(cam); m_objCameraLocl.ConnectToDevice(); m_objCameraLocl.SetExposure(Properties.Settings.Default.Camera_LocalExp); break; } } if (findLocalCam == false) { MessageBox.Show("局部相机 通信初始化失败!!!"); ShowLog("未能找到局部相机 ID:" + Properties.Settings.Default.Camera_LocalSN); //return; } //remove plc //m_objFixture = new clsFixture(); //m_objFixture.ComPort = m_objComPort; //if (m_objFixture.InitFixture() == false) //{ // MessageBox.Show("PLC 通信初始化失败!!!"); // ShowLog("PLC 通信失败"); // //return; //} }