-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathtest_lathe.py
executable file
·58 lines (43 loc) · 1.24 KB
/
test_lathe.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
#!/usr/bin/env python
from EZCAD3 import *
class Lathe(Part):
def __init__(self, up, name):
""" *Lathe*: Initialize *Base* object (i.e. *self*) with a
parent of *up*.
"""
# Verify argument types:
assert isinstance(up, Part) or up == None
assert isinstance(name, str)
# Initialize the *Part* superclass:
Part.__init__(self, up, name)
def construct(self):
""" *Lathe*: Construct the *Base* object (i.e. *self*).
"""
# Use *lathe* instead of *self*:
lathe = self
# Define the *material* and *color*:
material = Material("plastic", "acrylic")
color = Color("green")
# Define some constants:
zero = L()
one = L(inch=1.0)
two = L(inch=2.0)
# Define some points:
start = P(zero, two, zero)
peak = P(one, one, zero)
end = P(zero, zero, zero)
# Construct the exterior contour:
r1 = L(inch="1/32")
contour = Contour("profile")
contour.bend_append("start", start, r1)
contour.bend_append("peak", peak, r1)
contour.bend_append("end", end, r1)
# Lathe it out:
lathe.tool_prefer("Laser_007")
lathe.lathe("lathe", material, color, start, end, contour, 32)
def test_lathe():
ezcad = EZCAD3(0, directory="/tmp")
lathe= Lathe(None, "lathe")
lathe.process(ezcad)
if __name__== "__main__":
test_lathe()