private void MoveToHandler() { try { if (_simulationX || _simulationY || _simulationTheta) { Thread.Sleep(100); } if (BeforeMove != null) { CancelEventArgs ce = new CancelEventArgs(); BeforeMove(this, ce); if (ce.Cancel == true) { return; } } // Move XYT to target //temp do not move in vector/parallel //temp move individually _axisX.MoveAbsoluteStart(_axisMoveProfileX, _moveToPositionX); _axisY.MoveAbsoluteStart(_axisMoveProfileY, _moveToPositionY); _axisTheta.MoveAbsoluteStart(_axisMoveProfileTheta, _moveToPositionTheta); if (_simulationX) { _actualPositionX = Convert.ToDouble(textBoxMoveToPositionX.Text); } if (_simulationY) { _actualPositionY = Convert.ToDouble(textBoxMoveToPositionY.Text); } if (_simulationTheta) { _actualPositionTheta = Convert.ToDouble(textBoxMoveToPositionTheta.Text); } } catch (ThreadAbortException) { } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { if (this.IsHandleCreated) { this.BeginInvoke(new SetControlEnableStateDelegate(SetControlEnableState), buttonMoveTo, true); } } }
private void btnMoveAbs_Click(object sender, EventArgs e) { if (axis != null) { try { axis.MoveAbsoluteStart(double.Parse(tNumAcceleration.Text), double.Parse(tNumVelocity.Text), double.Parse(tbPosition.Text)); DisplayStatus("Moved started to " + tbPosition.Text); } catch (Exception ex) { DisplayError("Move error: " + ex.Message); } } }
private void buttonMove_Click(object sender, System.EventArgs e) { if (axis != null) { try { double acceleration = Convert.ToDouble(textAcceleration.Text); double velocity = Convert.ToDouble(textVelocity.Text); double position = Convert.ToDouble(textPosition.Text); axis.MoveAbsoluteStart(acceleration, velocity, position); DisplayStatus("moved started to " + position.ToString("0.000")); } catch (Exception ex) { DisplayError("Move error: " + ex.Message); } } }
private void MoveToHandler() { try { if (_simulation) { Thread.Sleep(100); } if (BeforeMove != null) { CancelEventArgs ce = new CancelEventArgs(); BeforeMove(this, ce); if (ce.Cancel == true) { return; } } // Move XYT to target _axis.MoveAbsoluteStart(_axisMoveProfile, _moveToPosition); if (_simulation) { _actualPosition = Convert.ToDouble(textBoxMoveToPosition.Text); } } catch (ThreadAbortException) { } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { if (this.IsHandleCreated) { this.BeginInvoke(new SetControlEnableStateDelegate(SetControlEnableState), buttonMoveTo, true); } } }