Date:2011-07-23 16:16:40 (8 years 4 months ago)
Author:Werner Almesberger
Commit:4296080e9b5a609e16f87d6091856693928237d5
Message:cad/test2/button.py: removed "epsilon" and "noise"

Files: cad/test2/button.py (4 diffs)

Change Details

cad/test2/button.py
55from cadmium import *
66
77
8epsilon = 0.01
9noise = epsilon/10
10
118but_top_x = 10.0
129but_top_y = but_top_x+5.0
1310but_top_z = 1.5
...... 
2825
2926def fillet_line(x, r):
3027    s = Box(x, r, r)
31    s -= Cylinder(r, h = x+2*epsilon). \
32        translate(0, 0, -epsilon). \
28    s -= Cylinder(r, h = x). \
3329        rotate(Y_axis, 90). \
3430        translate(0, r, r)
3531    return s.translate(-x/2, 0, 0)
...... 
4440
4541
4642def chamfer_line (x, r):
47    s = Box(x, r+epsilon, r+epsilon)
48    s -= Cylinder(r, h = x+2*epsilon). \
49        translate(0, 0, -epsilon). \
43    s = Box(x, r, r)
44    s -= Cylinder(r, h = x). \
5045        rotate(Y_axis, 90)
5146    return s.translate(-x/2, -r, -r)
5247
5348def chamfer_circle(r, fillet_r):
54    return Box(2*(r+epsilon), 2*(r+epsilon), fillet_r+epsilon). \
55        translate(-r-epsilon, -r-epsilon, -fillet_r)- \
49    return Box(2*(r), 2*(r), fillet_r). \
50        translate(-r, -r, -fillet_r)- \
5651        Cylinder(r-fillet_r, h = fillet_r). \
5752        translate(0, 0, -fillet_r)- \
5853        Torus(r-fillet_r, fillet_r, center = True). \
...... 
10398                s = t
10499            else:
105100                s += t
106    return s-rbox_core(x-epsilon, y-epsilon, z, r)
101    return s-rbox_core(x, y, z, r)
107102
108103def rbox_chamfer_top(x, y, z, r, chamfer_r):
109104    s = rbox_chamfer_top_corners(x, y, z, r, chamfer_r)
110105    for a in [0, 180]:
111106        s += chamfer_line(x-2*r, chamfer_r). \
112            translate(0, y/2, z+noise). \
107            translate(0, y/2, z). \
113108            rotate(Z_axis, a)
114109        s += chamfer_line(y-2*r, chamfer_r). \
115            translate(0, x/2, z+noise). \
110            translate(0, x/2, z). \
116111            rotate(Z_axis, a+90)
117112    return s
118113

Archive Download the corresponding diff file

Branches:
master



interactive