コード例 #1
0
 private void JogNegativeBtn_MouseUp(object sender, System.Windows.Forms.MouseEventArgs e)
 {
     if (JogRadioBtn.Checked)
     {
         try
         {
             axis.Stop();
         }
         catch (System.Exception ex)
         {
             MessageBox.Show(ex.Message);
         }
     }
     else
     {
         try
         {
             axis.MoveRelativeStart(acceleration, JogVelocity(), -StepSize());
         }
         catch (Exception ex)
         {
             MessageBox.Show(ex.Message);
         }
     }
 }
コード例 #2
0
 private void btnStop_Click(object sender, EventArgs e)
 {
     if (axis != null)
     {
         try
         {
             checkHomedStatus = false;
             axis.Stop();
             DisplayStatus("Stopped");
         }
         catch (Exception ex)
         {
             DisplayError("Stop error: " + ex.Message);
         }
     }
 }
コード例 #3
0
 private void buttonStop_Click(object sender, EventArgs e)
 {
     _axisX.Stop();
     _axisY.Stop();
     _axisTheta.Stop();
 }
コード例 #4
0
        private void AxisJoggingHelper(object sender, MouseEventArgs e, bool isMOuseDown)
        {
            Control            con = (Control)sender;
            AxisAndMovePackage pkg = null;

            if (con.Tag != null)
            {
                pkg = (AxisAndMovePackage)con.Tag;
                IAxis axis = pkg.Axis;

                // Reduction of speed
                IMoveProfile mf = new MoveProfileBase();
                mf.Acceleration = pkg.MoveProfile.Acceleration;
                mf.Deceleration = pkg.MoveProfile.Deceleration;
                mf.Velocity     = pkg.MoveProfile.Velocity;

                double spdReduction = Convert.ToDouble(touchscreenNumBoxSpeedPercentage.Text);
                mf.Velocity     = pkg.MoveProfile.Velocity * spdReduction / 100.0;
                mf.Acceleration = pkg.MoveProfile.Acceleration * spdReduction / 100.0;
                mf.Deceleration = pkg.MoveProfile.Deceleration * spdReduction / 100.0;

                double sign = pkg.IsPositiveMove ? 1 : -1;
                if (e.Button == MouseButtons.Left)
                {
                    try
                    {
                        if (checkBoxIsRelativeMove.Checked)
                        {
                            if (isMOuseDown)
                            {
                                if (BeforeRelativeMove != null)
                                {
                                    CancelEventArgs ce = new CancelEventArgs();
                                    BeforeRelativeMove(axis, sign * Convert.ToDouble(touchscreenNumBoxRelativeMoveDistance.Text), ce);
                                    if (ce.Cancel == true)
                                    {
                                        return;
                                    }
                                }
                                if (axis.IsMoveDone)
                                {
                                    double relDist = Math.Round(Convert.ToDouble(touchscreenNumBoxRelativeMoveDistance.Text), 3);
                                    axis.MoveRelativeStart(mf, relDist * sign);
                                    if (_simulationX)
                                    {
                                        if (sign == 1)
                                        {
                                            _actualPositionX = _actualPositionX + relDist;
                                        }
                                        else
                                        {
                                            _actualPositionX = _actualPositionX - relDist;
                                        }
                                    }

                                    if (_simulationY)
                                    {
                                        if (sign == 1)
                                        {
                                            _actualPositionY = _actualPositionY + relDist;
                                        }
                                        else
                                        {
                                            _actualPositionY = _actualPositionY - relDist;
                                        }
                                    }

                                    if (_simulationTheta)
                                    {
                                        if (sign == 1)
                                        {
                                            _actualPositionTheta = _actualPositionTheta + relDist;
                                        }
                                        else
                                        {
                                            _actualPositionTheta = _actualPositionTheta - relDist;
                                        }
                                    }
                                }
                            }
                        }
                        else
                        {
                            if (isMOuseDown) //
                            {
                                if (axis.IsMoveDone)
                                {
                                    axis.MoveRelativeStart(mf, 5000 * sign);
                                    labelStatus.Text = string.Format("{0} is moving...", axis.Name);
                                }
                            }
                            else
                            {
                                axis.Stop();
                                labelStatus.Text = string.Format("{0} is stopped.", axis.Name);
                                labelStatus.Refresh();
                                System.Threading.Thread.Sleep(100);
                                labelStatus.Text = "Status";
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        axis.Stop();
                        MessageBox.Show(ex.Message);
                    }
                }
            }
        }
コード例 #5
0
 private void buttonStop_Click(object sender, EventArgs e)
 {
     _axis.Stop();
 }