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); }
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; }