Skip to content

Instantly share code, notes, and snippets.

@appcove
Created December 21, 2015 18:51
Show Gist options
  • Save appcove/85ad173d1ac7fe450109 to your computer and use it in GitHub Desktop.
Save appcove/85ad173d1ac7fe450109 to your computer and use it in GitHub Desktop.
SIZE_X = 20
SIZE_Y = 20
TOP_Z = 0.750
CUTTER_DIAMETER = 0.750
#This is just some misc setup stuff
from decimal import Decimal
def drange(start, stop, step):
value = Decimal(start)
step = Decimal(step)
stop = Decimal(stop)
while value < stop:
yield value
value += step
with open('output.txt', 'w') as myfile:
def w(text):
myfile.write(text + "\n")
print(text)
w('m5')
w('g53 z0')
w('g90')
w('t5')
w('s15000')
w('f400')
w('m3')
w('g0 x0 y-{0}'.format(CUTTER_DIAMETER))
w('g0 z{0}'.format(TOP_Z+0.25))
w('g1 z{0}'.format(TOP_Z))
for x in drange("0.000", SIZE_X, CUTTER_DIAMETER/2):
w('g1 y{0}'.format(SIZE_Y+CUTTER_DIAMETER))
w('g0 y-{0}'.format(CUTTER_DIAMETER))
w('g0 x{0}'.format(x))
w('g53 z0')
w('m5')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment