Esempio n. 1
0
        /// <summary>
        /// returns true if the other Bounds object is fully contained inside this one
        /// </summary>
        /// <param name="other">The other Bounds object</param>
        /// <returns></returns>
        public bool Contains(Bounds other)
        {
            bool contains = true;

            contains &= MinX <= other.MinX;
            contains &= MaxX >= other.MaxX;
            contains &= MinY <= other.MinY;
            contains &= MaxY >= other.MaxY;

            return contains;
        }
Esempio n. 2
0
        public static Bounds Dimensions(this IEnumerable<GCodeCommand> commands)
        {
            Bounds b = new Bounds();

            foreach(var Command in commands)
            {
                var MoveCommand = Command as Movement;

                if (MoveCommand == null)
                    continue;

                b.ExpandTo(MoveCommand.Start.X, MoveCommand.Start.Y);
                b.ExpandTo(MoveCommand.End.X, MoveCommand.End.Y);
            }

            return b;
        }
Esempio n. 3
0
        private void GCodeUpdated()
        {
            size = Commands.Dimensions();
            labelSize.Text = string.Format("Dimensions: X: {0:0.00} ~ {1:0.00}  Y: {2:0.00} ~ {3:0.00}", size.MinX, size.MaxX, size.MinY, size.MaxY);

            toolStripStatusLabelFill.Text = string.Format("Total distance: {0} mm", Commands.TravelDistance());

            RedrawPreview();
            HeightMapUpdated();
        }