1
0
mirror of git://projects.qi-hardware.com/wernermisc.git synced 2024-11-15 06:41:53 +02:00

cad/test2/button.py: removed "epsilon" and "noise"

This commit is contained in:
Werner Almesberger 2011-07-23 11:16:40 -03:00
parent 70eef56611
commit 4296080e9b

View File

@ -5,9 +5,6 @@
from cadmium import *
epsilon = 0.01
noise = epsilon/10
but_top_x = 10.0
but_top_y = but_top_x+5.0
but_top_z = 1.5
@ -28,8 +25,7 @@ but_chamfer_r = 0.2
def fillet_line(x, r):
s = Box(x, r, r)
s -= Cylinder(r, h = x+2*epsilon). \
translate(0, 0, -epsilon). \
s -= Cylinder(r, h = x). \
rotate(Y_axis, 90). \
translate(0, r, r)
return s.translate(-x/2, 0, 0)
@ -44,15 +40,14 @@ def fillet_circle(r, fillet_r):
def chamfer_line (x, r):
s = Box(x, r+epsilon, r+epsilon)
s -= Cylinder(r, h = x+2*epsilon). \
translate(0, 0, -epsilon). \
s = Box(x, r, r)
s -= Cylinder(r, h = x). \
rotate(Y_axis, 90)
return s.translate(-x/2, -r, -r)
def chamfer_circle(r, fillet_r):
return Box(2*(r+epsilon), 2*(r+epsilon), fillet_r+epsilon). \
translate(-r-epsilon, -r-epsilon, -fillet_r)- \
return Box(2*(r), 2*(r), fillet_r). \
translate(-r, -r, -fillet_r)- \
Cylinder(r-fillet_r, h = fillet_r). \
translate(0, 0, -fillet_r)- \
Torus(r-fillet_r, fillet_r, center = True). \
@ -103,16 +98,16 @@ def rbox_chamfer_top_corners(x, y, z, r, chamfer_r):
s = t
else:
s += t
return s-rbox_core(x-epsilon, y-epsilon, z, r)
return s-rbox_core(x, y, z, r)
def rbox_chamfer_top(x, y, z, r, chamfer_r):
s = rbox_chamfer_top_corners(x, y, z, r, chamfer_r)
for a in [0, 180]:
s += chamfer_line(x-2*r, chamfer_r). \
translate(0, y/2, z+noise). \
translate(0, y/2, z). \
rotate(Z_axis, a)
s += chamfer_line(y-2*r, chamfer_r). \
translate(0, x/2, z+noise). \
translate(0, x/2, z). \
rotate(Z_axis, a+90)
return s