Skip to content

Instantly share code, notes, and snippets.

@mamoit
Last active August 3, 2018 08:52
Show Gist options
  • Save mamoit/a51d513ec2d13f78ea0db2df3ab7771a to your computer and use it in GitHub Desktop.
Save mamoit/a51d513ec2d13f78ea0db2df3ab7771a to your computer and use it in GitHub Desktop.
Gcode throughput stresstest
# Stress test for command throughput
# Run like this:
# python gcode-stresstest.py > gcode-stresstest.gcode
from math import cos, sin, pi
radius = 5
height = 25
center = (radius*1.5, radius*1.5, height)
vertices = [2**i for i in range(2, 10)]
loops = 10
feedrate = 60
dwell_time = 2
print("G28")
print("G1 Z{height}".format(height=height))
for n in vertices:
print("M117 Printing with {}".format(n))
angle_step = 2*pi/n
for l in range(loops):
for v in range(n):
print("G1 X{x} Y{y} F{f}".format(
x=center[0]+radius*cos(angle_step*v),
y=center[1]+radius*sin(angle_step*v),
f=feedrate*60
))
print("G1 X{x} Y{y} F{f}".format(
x=center[0]+radius,
y=center[1],
f=feedrate*60
))
print("M117 Printed with {}".format(n))
print("G4 S{}".format(dwell_time))
print("M117 Test complete!")
print("G28")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment