Sun, 09 Sep 2018 00:21:30 +0200
hardware axis speedtest
import argparse def gen_speedtest(args): fd = open(args.file, 'wb') if args.axis.lowercase() == 'x': pos = [0, args.dx] print(fd, "G0 y%i F%i" % ( args.dy / 2, args.min * 60)) else: pos = [0, args.dy] print(fd, "G0 x%i F%i" % ( args.dx / 2, args.min * 60)) loops = (args.max - args.min) / args.increment speed = args.min for loop in range(loops): print(fd, "G0 %s%i F%i" % ( args.axis, pos[0], speed * 60)) print(fd, "G0 %s%i F%i" % ( args.axis, pos[1], speed * 60)) speed += args.inc fd.close() def main(): parser = argparse.ArgumentParser() parser.add_argument("axis", help="Define X or Y axis") parser.add_argument("file", help="Output gcode filename") parser.add_argument("--min", type=int, default=100, help="Minimum speed mm/s (100)") parser.add_argument("--max", type=int, default=200, help="Maximum speed mm/s (200)") parser.add_argument("--dx", type=int, default=200, help="Maximum X dimension (200)") parser.add_argument("--dy", type=int, default=200, help="Maximum Y dimension (200)") parser.add_argument("--inc", type=int, default=10, help="Speed increment after each line") args = parser.parse_args() gen_speedtest(args) if __name__ == '__main__': main()