public void Count()
        {
            Rapid = 0;
            Feed  = 0;
            double duration_min = 0.0;

            BaseMotion prevMotion = null;

            foreach (var gc in _gcode)
            {
                if (!(gc is BaseMotion))
                {
                    continue;
                }
                BaseMotion curMotion = (BaseMotion)gc;

                if (prevMotion != null)
                {
                    double distance = (curMotion.Position - prevMotion.Position).Length;
                    if (curMotion is CoordinatMotion)
                    {
                        Feed         += distance;
                        duration_min += distance / ((CoordinatMotion)curMotion).Feed;
                    }
                    else
                    {
                        Rapid        += distance;
                        duration_min += distance / 20000;
                    }
                }
                prevMotion = curMotion;
            }
            EstimatedTime = TimeSpan.FromMinutes(duration_min);
        }
Esempio n. 2
0
        private Color GCodeToColor(BaseMotion motion)
        {
            if (motion is CoordinatMotion)
            {
                var cm = (CoordinatMotion)motion;
                return Color.FromRgb(cm.Color.R, cm.Color.G, cm.Color.B);
            }

            if (motion is RapidMotion)
                return Colors.HotPink;

            return Colors.HotPink;
        }