private void UpdatePositionData() { if (m_oKernel.m_bMotionCardInit) { var dXCurPos = m_oKernel.GetAxisCurPos(0, CKernel.ENUM_AXIS_TYPE.X_AXIS); var dYCurPos = m_oKernel.GetAxisCurPos(0, CKernel.ENUM_AXIS_TYPE.Y_AXIS); var dZCurPos = m_oKernel.GetAxisCurPos(0, CKernel.ENUM_AXIS_TYPE.Z_AXIS); //坐标 m_labelPositionX.Text = dXCurPos.ToString("f3"); m_labelPositionY.Text = dYCurPos.ToString("f3"); m_labelPositionZ.Text = dZCurPos.ToString("f3"); } }
private void 获取当前位置ToolStripMenuItem_Click(object sender, EventArgs e) { if (dataGridView_Position.CurrentRow != null) { var dXposition = m_oKernel.GetAxisCurPos(0, CKernel.ENUM_AXIS_TYPE.X_AXIS); var dYposition = m_oKernel.GetAxisCurPos(0, CKernel.ENUM_AXIS_TYPE.Y_AXIS); var dZposition = m_oKernel.GetAxisCurPos(0, CKernel.ENUM_AXIS_TYPE.Z_AXIS); int iRowIndex = dataGridView_Position.CurrentRow.Index; dataGridView_Position.Rows[iRowIndex].Cells[1].Value = dXposition.ToString(); dataGridView_Position.Rows[iRowIndex].Cells[2].Value = dYposition.ToString(); dataGridView_Position.Rows[iRowIndex].Cells[3].Value = dZposition.ToString(); //Console.Write(dataGridView_Position.Rows[dataGridView_Position.CurrentRow.Index].Cells[0].Value); } }