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
|
#!/usr/bin/python
import sys
from brlcad import *
VERSION=0.2
class base(Shape):
def __init__(self, vertex=(0,0,0), height=(0, 1.5, 0), radius=0.5):
'''TODO: little nubs for the threads to bite?
TODO: a way to keep the pestle in'''
x, y, z = vertex
h = height
hy = float(h[1])
radius = float(radius)
shell = Shape( [
Cylinder((x, y + 2*hy/3, z), (h[0], hy/3, h[2]), radius),
Cone(vertex, (h[0], 2 * hy/3, h[2]), 0.25 ,radius)
], basename='shell', suffix='', group=True)
innards = Shape ( [
Cylinder((x, y + 2 * hy / 3, z),
(h[0], hy/3 + 0.0001, h[2]),
radius * .75),
Cone((x, y + 2 * hy / 3, z),
(h[0], hy/3 - 1, h[2]),
radius * .75 - .025, 0.125),
Cylinder(vertex, (h[0], hy/3, h[2]), 0.25)
], basename='innards', suffix='', group=True)
Shape.__init__(self, [
shell, innards
], combination = shell - innards, basename='base')
class pestle(Shape):
def __init__(self, vertex = (2,0,0), height=(0, 1, 0), radius=0.5, **kwargs):
radius = float(radius)
h = height
hy = float(height[1])
Shape.__init__(self, [
Cylinder(vertex, (h[0], hy, h[2]), radius * .75, basename='pestle'),
Cylinder(vertex, (h[0], hy/2, h[2]), radius, basename='cap')
], group=True, **kwargs)
class slater(Shape):
def __init__(self, vertex=(0,0,0), height=(0,2,0), radius=0.5):
x, y, z = vertex
h = height
hy = float(h[1])
Shape.__init__(self, [
base(vertex, (h[0], hy * 3 /4, h[2]), radius),
pestle((x,y+3,z), (h[0], hy * - 1 / 2, h[2]), radius),
], basename='slater', suffix='', group=True)
print warning, '\n\n', copyright, '\n', license, '\n'
print Script(
Title('slater'),
Units('inch'),
slater((-1,0,0), (0,2,0), 0.5)
)
|