/// <summary> /// 标定待机位 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnCalibWaitPos_Click(object sender, System.EventArgs e) { pt[0] = Position.Instance.RootPostion[0].X; pt[1] = Position.Instance.RootPostion[0].Y; pt[2] = Position.Instance.RootPostion[0].Z; pt[3] = Position.Instance.RootPostion[0].R; pt[4] = 0; pt[5] = 0; pt[6] = (int)(tbrJogSpeed.Value); mYAMAHA.MovP(pt); Station1.YaxisServo.MoveTo(Position.Instance.YaxisPostion[0].pos); Station1.ZaxisServo.MoveTo(Position.Instance.ZaxisPostion[0].pos); if (rdbLeftCalib.Checked) { Station1.LFXaxisServo.MoveTo(Position.Instance.LPhotoOriPostion.LFXPhoto); Station1.LFYaxisServo.MoveTo(Position.Instance.LPhotoOriPostion.LFYPhoto); Station1.LRXaxisServo.MoveTo(Position.Instance.LPhotoOriPostion.LRXPhoto); Station1.LRYaxisServo.MoveTo(Position.Instance.LPhotoOriPostion.LRYPhoto); Station1.RYaxisServo.MoveTo(Position.Instance.LPhotoOriPostion.RYPhoto); Station1.XaxisServo.MoveTo(Position.Instance.LPhotoOriPostion.XPhoto); Station1.SwichCylinder.Reset(); } if (rdbRightCalib.Checked) { Station1.LFXaxisServo.MoveTo(Position.Instance.RPhotoOriPostion.LFXPhoto); Station1.LFYaxisServo.MoveTo(Position.Instance.RPhotoOriPostion.LFYPhoto); Station1.LRXaxisServo.MoveTo(Position.Instance.RPhotoOriPostion.LRXPhoto); Station1.LRYaxisServo.MoveTo(Position.Instance.RPhotoOriPostion.LRYPhoto); Station1.RYaxisServo.MoveTo(Position.Instance.RPhotoOriPostion.RYPhoto); Station1.XaxisServo.MoveTo(Position.Instance.RPhotoOriPostion.XPhoto); Station1.SwichCylinder.Set(); } }
private void ContinuousMove() { bool result, ready; for (int i = 0; i < 3; i++) { if (radioButtonMovP.Checked) { yamaha.MovP(point); } else { yamaha.MovL(point); } do { result = yamaha.Ready(out ready); }while (!ready); if (radioButtonMovP.Checked) { yamaha.MovP(point); } else { yamaha.MovL(point); } do { result = yamaha.Ready(out ready); }while (!ready); } }
/// <summary> /// 点击事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e) { switch (e.ColumnIndex) { case 5: if (MessageBox.Show(string.Format("是否定位{0}的数据", dataGridView1.Rows[e.RowIndex].Cells[0].Value), "定位", MessageBoxButtons.OKCancel) == DialogResult.Cancel) { break; } if (dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString() == "定位") { double x = System.Convert.ToDouble(dataGridView1.Rows[e.RowIndex].Cells[1].Value); double y = System.Convert.ToDouble(dataGridView1.Rows[e.RowIndex].Cells[2].Value); double z = System.Convert.ToDouble(dataGridView1.Rows[e.RowIndex].Cells[3].Value); double r = System.Convert.ToDouble(dataGridView1.Rows[e.RowIndex].Cells[4].Value); pt[0] = x; pt[1] = y; pt[2] = z; pt[3] = r; pt[4] = 0; pt[5] = 0; pt[6] = (int)(tbrJogSpeed.Value); mYAMAHA.MovP(pt); } break; case 6: if (MessageBox.Show(string.Format("是否保存{0}的数据", dataGridView1.Rows[e.RowIndex].Cells[0].Value), "保存", MessageBoxButtons.OKCancel) == DialogResult.Cancel) { break; } if (dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString() == "保存") { Position.Instance.RootPostion[e.RowIndex].X = mYAMAHA.CurrentPosX; Position.Instance.RootPostion[e.RowIndex].Y = mYAMAHA.CurrentPosY; Position.Instance.RootPostion[e.RowIndex].Z = mYAMAHA.CurrentPosZ; Position.Instance.RootPostion[e.RowIndex].R = mYAMAHA.CurrentPosR; //Position.Instance.RootPostion[e.RowIndex].Name = dataGridView1.Rows[e.RowIndex].Cells[0].Value.ToString(); InitdgvPlatePositionRows(); } break; default: break; } }
/// <summary> /// 走标定位置 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnGotoStart_Click(object sender, System.EventArgs e) { pt[0] = Config.Instance.PhotoCalibPostion.X; pt[1] = Config.Instance.PhotoCalibPostion.Y; pt[2] = Config.Instance.PhotoCalibPostion.Z; pt[3] = Config.Instance.PhotoCalibPostion.R; pt[4] = 0; pt[5] = 0; pt[6] = (int)(tbrJogSpeed.Value); mYAMAHA.MovP(pt); }