Point3D TrackZAndUpdateStartPoint(Point3D inputPoint, double mmToAddToDistance)
        {
            double analogConverted = UniversalRobotHelperFunctions.GetCurrentZDistance();

            double currentZDistance = coilToTargetDistance + mmToAddToDistance;

            if (double.IsNaN(analogConverted) ||
                double.IsNaN(currentZDistance))
            {
                string errorMessage = "Cannot read a valid distance from the laser. Unable to perform move!";
                if (CheckRunThroughAll())
                {
                    errorMessage += " The Run Through All moves will now be cancelled.";
                }
                MessageBox.Show(errorMessage, "Unable to perform move!", MessageBoxButton.OK, MessageBoxImage.Error);
                return(new Point3D(
                           App.Current.URController.URRobotStatus.ToolVectorActual_1,
                           App.Current.URController.URRobotStatus.ToolVectorActual_2,
                           App.Current.URController.URRobotStatus.ToolVectorActual_3));
            }

            if (analogConverted < currentZDistance)
            {
                startPoint = UniversalRobotHelperFunctions.AdjustLocationToLaser(startPoint, lookDirection, analogConverted, currentZDistance);
            }
            return(UniversalRobotHelperFunctions.AdjustLocationToLaser(inputPoint, lookDirection, analogConverted, currentZDistance));
        }
        private void MoveToZ_Click(object sender, RoutedEventArgs e)
        {
            double analogConverted = UniversalRobotHelperFunctions.GetCurrentZDistance();

            double currentZDistance = App.Current.ApplicationSettings.CoilToTargetDistanceMM;

            if (double.IsNaN(analogConverted) ||
                double.IsNaN(currentZDistance))
            {
                MessageBox.Show("Cannot read a valid distance from the laser. Unable to perform move!", "Unable to perform move!", MessageBoxButton.OK, MessageBoxImage.Error);
            }
            else
            {
                Point3D move = UniversalRobotHelperFunctions.AdjustLocationToLaser(GetCurrentPoint(), GetCurrentLookDirection(), analogConverted, currentZDistance);
                MoveToPoint(move, GetCurrentLookDirectionAsPoint(), false);
            }
        }
        Point3D TrackZ(Point3D inputPoint, double mmToAddToDistance)
        {
            double analogConverted = UniversalRobotHelperFunctions.GetCurrentZDistance();

            double currentZDistance = coilToTargetDistance + mmToAddToDistance;

            if (double.IsNaN(analogConverted) ||
                double.IsNaN(currentZDistance))
            {
                MessageBox.Show("Cannot read a valid distance from the laser. Unable to perform move!", "Unable to perform move!", MessageBoxButton.OK, MessageBoxImage.Error);
                return(new Point3D(
                           App.Current.URController.URRobotStatus.ToolVectorActual_1,
                           App.Current.URController.URRobotStatus.ToolVectorActual_2,
                           App.Current.URController.URRobotStatus.ToolVectorActual_3));
            }
            return(UniversalRobotHelperFunctions.AdjustLocationToLaser(inputPoint, lookDirection, analogConverted, currentZDistance));
        }