Пример #1
0
        /// <summary>
        /// Parses a recevied probe report
        /// </summary>
        private void ParseProbe(string line)
        {
            if (ProbeFinished == null)
            {
                return;
            }

            Match probeMatch = ProbeEx.Match(line);

            Group pos     = probeMatch.Groups["Pos"];
            Group success = probeMatch.Groups["Success"];

            if (!probeMatch.Success || !(pos.Success & success.Success))
            {
                NonFatalException.Invoke($"Received Bad Probe: '{line}'");
                return;
            }

            Vector3 ProbePos = Vector3.Parse(pos.Value);

            ProbePos -= WorkOffset;                 //Mpos, Wpos only get updated by the same dispatcher, so this should be thread safe

            bool ProbeSuccess = success.Value == "1";

            ProbeFinished.Invoke(ProbePos, ProbeSuccess);
        }
Пример #2
0
        /// <summary>
        /// Parses a recevied probe report
        /// </summary>
        private void ParseProbe(string line)
        {
            if (ProbeFinished == null)
            {
                return;
            }

            Match probeMatch = ProbeEx.Match(line);

            Group pos     = probeMatch.Groups["Pos"];
            Group success = probeMatch.Groups["Success"];

            if (!probeMatch.Success || !(pos.Success & success.Success))
            {
                NonFatalException.Invoke($"Received Bad Probe: '{line}'");
                return;
            }

            Vector3 ProbePos = Vector3.Parse(pos.Value);

            LastProbePosMachine = ProbePos;

            ProbePos -= WorkOffset;

            LastProbePosWork = ProbePos;

            bool ProbeSuccess = success.Value == "1";

            ProbeFinished.Invoke(ProbePos, ProbeSuccess);
        }
Пример #3
0
        /// <summary>
        /// Parses a recevied probe report
        /// </summary>
        private void ParseProbe(string line)
        {
            if (ProbeFinished == null)
            {
                return;
            }

            Match probeMatch = ProbeEx.Match(line);
            Group mx         = probeMatch.Groups["MX"];
            Group my         = probeMatch.Groups["MY"];
            Group mz         = probeMatch.Groups["MZ"];
            Group success    = probeMatch.Groups["Success"];

            if (!probeMatch.Success || !(mx.Success & my.Success & mz.Success & success.Success))
            {
                NonFatalException.Invoke($"Received Bad Probe: '{line}'");
                return;
            }

            Vector3 ProbePos = new Vector3(double.Parse(mx.Value, Constants.DecimalParseFormat), double.Parse(my.Value, Constants.DecimalParseFormat), double.Parse(mz.Value, Constants.DecimalParseFormat));

            ProbePos += WorkPosition - MachinePosition;                 //Mpos, Wpos only get updated by the same dispatcher, so this should be thread safe

            bool ProbeSuccess = success.Value == "1";

            ProbeFinished.Invoke(ProbePos, ProbeSuccess);
        }
Пример #4
0
        /// <summary>
        /// Parses a recevied probe report
        /// </summary>
        private void ParseProbe(string line)
        {
            if (ProbeFinished == null)
            {
                return;
            }

            Match probeMatch = ProbeEx.Match(line);

            Group pos     = probeMatch.Groups["Pos"];
            Group success = probeMatch.Groups["Success"];

            if (!probeMatch.Success || !(pos.Success & success.Success))
            {
                NonFatalException.Invoke($"Received Bad Probe: '{line}'");
                return;
            }

            string PositionString = pos.Value;

            if (Properties.Settings.Default.IgnoreAdditionalAxes)
            {
                string[] parts = PositionString.Split(',');
                if (parts.Length > 3)
                {
                    Array.Resize(ref parts, 3);
                    PositionString = string.Join(",", parts);
                }
            }

            Vector3 ProbePos = Vector3.Parse(PositionString);

            LastProbePosMachine = ProbePos;

            ProbePos -= WorkOffset;

            LastProbePosWork = ProbePos;

            bool ProbeSuccess = success.Value == "1";

            ProbeFinished.Invoke(ProbePos, ProbeSuccess);
        }