forked from migpics/GCode
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTurtle_Spiral.py
74 lines (48 loc) · 1.55 KB
/
Turtle_Spiral.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
import turtle
turtle.screensize(400,800)
turtle.shape("turtle")
myNewCoords=[]
##Draw Pancake Griddle
turtle.fill(True)
turtle.forward(460)
turtle.left(90)
turtle.forward(260)
turtle.left(90)
turtle.forward(460)
turtle.left(90)
turtle.forward(260)
turtle.fill(False)
##Move pen to Start Point
turtle.penup()
turtle.setposition(200,150)
turtle.pendown()
def drawPancake():
turtle.pencolor("white")
turtle.pensize(3)
for i in range(1,20):
turtle.left(245)
for i in range(1,15):
turtle.forward(i)
turtle.left(2*i)
myNewCoords.append('G00 X'+ str(round(turtle.xcor(),2))+' Y'+str(round(turtle.ycor(),2)))
def writeGCode():
newFile = raw_input('Enter the name of the GCodeFile')
GCodefile = open(newFile+'.Gcode', 'w+')
GCodefile.write('G21; sets units to millimeters \n')
GCodefile.write('M107; Turns extruder off \n')
GCodefile.write('G28; Home all axes \n')
GCodefile.write('G1 F9600; Sets the speed of Pancakebot \n')
GCodefile.write('M107; \n')
for i in myNewCoords:
GCodefile.write(i+';')
GCodefile.write('\n')
GCodefile.write('M107; Turns extruder off \n')
GCodefile.write('G28 X0 Y0; Home all axes \n')
GCodefile.write('M84; Disable motors \n')
GCodefile.close();
drawPancake()
myConfirmation = raw_input('Do you want to save the GCode File? Enter Yes or No ')
if myConfirmation == 'Yes':
writeGCode()
else:
print "Thanks! You are done!"