forked from ajmendez/PyGRBL
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcircle.py
46 lines (33 loc) · 801 Bytes
/
circle.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
#!/usr/bin/env python
# circle.py
# [2012.10.27] Mendez written
from lib.util import IndexDict
# import lib.tool
Z_MOVE = 0.020 # [0.020 in]
Z_MILL = -0.007 # [0.007 in]
def _circle(x, y, r, depth):
moves = []
cmd = [0,1,2,2,2]
xOffset = [0,0,0,r,0,-r]
yOffset = [0,r,r,0,-r,0]
m = IndexDict()
m[0],m[1],m[2],m[3] = (x,y,Z_MOVE,0)
moves.append(m)
m = IndexDict()
m[0],m[1],m[2],m[3] = (x+r,y,Z_MOVE,0)
moves.append(m)
m = IndexDict()
m[0],m[1],m[2],m[3] = (x+r,y,Z_MILL,1)
moves.append(m)
for xo,yo in zip(xOffset,yOffset):
m = IndexDict()
m.x,m.y,m.cmd,m.i,m.j = (x+xo,y+yo,2,-yo,-xo)
m.updateName()
moves.append(m)
for m in moves:
print m.toGcode()
def makeCircle():
# T = tool.Tool()
c = _circle(0,0,1,-0.25)
if __name__ == "__main__":
makeCircle()