mirror of
git://projects.qi-hardware.com/wernermisc.git
synced 2024-11-15 08:50:38 +02:00
cad/test2/button.py: removed "epsilon" and "noise"
This commit is contained in:
parent
70eef56611
commit
4296080e9b
@ -5,9 +5,6 @@
|
|||||||
from cadmium import *
|
from cadmium import *
|
||||||
|
|
||||||
|
|
||||||
epsilon = 0.01
|
|
||||||
noise = epsilon/10
|
|
||||||
|
|
||||||
but_top_x = 10.0
|
but_top_x = 10.0
|
||||||
but_top_y = but_top_x+5.0
|
but_top_y = but_top_x+5.0
|
||||||
but_top_z = 1.5
|
but_top_z = 1.5
|
||||||
@ -28,8 +25,7 @@ but_chamfer_r = 0.2
|
|||||||
|
|
||||||
def fillet_line(x, r):
|
def fillet_line(x, r):
|
||||||
s = Box(x, r, r)
|
s = Box(x, r, r)
|
||||||
s -= Cylinder(r, h = x+2*epsilon). \
|
s -= Cylinder(r, h = x). \
|
||||||
translate(0, 0, -epsilon). \
|
|
||||||
rotate(Y_axis, 90). \
|
rotate(Y_axis, 90). \
|
||||||
translate(0, r, r)
|
translate(0, r, r)
|
||||||
return s.translate(-x/2, 0, 0)
|
return s.translate(-x/2, 0, 0)
|
||||||
@ -44,15 +40,14 @@ def fillet_circle(r, fillet_r):
|
|||||||
|
|
||||||
|
|
||||||
def chamfer_line (x, r):
|
def chamfer_line (x, r):
|
||||||
s = Box(x, r+epsilon, r+epsilon)
|
s = Box(x, r, r)
|
||||||
s -= Cylinder(r, h = x+2*epsilon). \
|
s -= Cylinder(r, h = x). \
|
||||||
translate(0, 0, -epsilon). \
|
|
||||||
rotate(Y_axis, 90)
|
rotate(Y_axis, 90)
|
||||||
return s.translate(-x/2, -r, -r)
|
return s.translate(-x/2, -r, -r)
|
||||||
|
|
||||||
def chamfer_circle(r, fillet_r):
|
def chamfer_circle(r, fillet_r):
|
||||||
return Box(2*(r+epsilon), 2*(r+epsilon), fillet_r+epsilon). \
|
return Box(2*(r), 2*(r), fillet_r). \
|
||||||
translate(-r-epsilon, -r-epsilon, -fillet_r)- \
|
translate(-r, -r, -fillet_r)- \
|
||||||
Cylinder(r-fillet_r, h = fillet_r). \
|
Cylinder(r-fillet_r, h = fillet_r). \
|
||||||
translate(0, 0, -fillet_r)- \
|
translate(0, 0, -fillet_r)- \
|
||||||
Torus(r-fillet_r, fillet_r, center = True). \
|
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
|
s = t
|
||||||
else:
|
else:
|
||||||
s += t
|
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):
|
def rbox_chamfer_top(x, y, z, r, chamfer_r):
|
||||||
s = rbox_chamfer_top_corners(x, y, z, r, chamfer_r)
|
s = rbox_chamfer_top_corners(x, y, z, r, chamfer_r)
|
||||||
for a in [0, 180]:
|
for a in [0, 180]:
|
||||||
s += chamfer_line(x-2*r, chamfer_r). \
|
s += chamfer_line(x-2*r, chamfer_r). \
|
||||||
translate(0, y/2, z+noise). \
|
translate(0, y/2, z). \
|
||||||
rotate(Z_axis, a)
|
rotate(Z_axis, a)
|
||||||
s += chamfer_line(y-2*r, chamfer_r). \
|
s += chamfer_line(y-2*r, chamfer_r). \
|
||||||
translate(0, x/2, z+noise). \
|
translate(0, x/2, z). \
|
||||||
rotate(Z_axis, a+90)
|
rotate(Z_axis, a+90)
|
||||||
return s
|
return s
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user