1
0
mirror of git://projects.qi-hardware.com/ben-counterweight.git synced 2025-01-28 08:51:06 +02:00

Update for gravity casting.

- cw.py: added inlets and air escapes for gravity casting
- README: documented the tool making workflow
This commit is contained in:
Werner Almesberger 2010-08-05 23:19:31 -03:00
parent fcd83689fa
commit 891ad69331
2 changed files with 65 additions and 0 deletions

17
README
View File

@ -28,3 +28,20 @@ Finally, all elements on the main PCB that are unusually tall are taped
over, to further reduce the risk of them working their way into the
counterweight. Right now, the only component where problems are
considered likely is the buzzer.
Workflow
--------
- analyze geometry, e.g., by viewing ben-bottom-inside-500um
- define CAD model in cw.py
- generate in HeeksCAD with "import cw"
- define Zig-Zag operation
- generate Python script and run it (takes a while)
- save NC file
- convert G-code to gnuplot, with cncmap/g2gp
- mount piece and determine geometry with millp
(from http://svn.openmoko.org/developers/werner/cncmap)
- define conversion in "doit" script (to do: put in repository)
- ./doit >job
- send job with cncmap/spool

48
cw.py
View File

@ -25,6 +25,14 @@ z_ceiling = 5.0 # mm
#
y_axis = 16.0
off_x = -15+18
off_y = -46+5
channel_radius = 1 # mm
inlet_radius = 7
shaft = 3
ymax_piece = 50
total_mass = 0
total_torque = 0
@ -87,6 +95,35 @@ def rect_gnuplot(x0, y0, z0, x1, y1, z1):
print
#
# add inlets and air escapes for gravitation casting
#
def channel(sk, x, y, r0, r1):
if r0 == r1:
cad.cylinder(x, y, 0, r0, ymax_piece-y)
obj = cad.getlastobj()
else:
cad.cylinder(x, y, 0, r0, shaft)
cyl = cad.getlastobj()
cad.cone(x, y, shaft, r0, r1, ymax_piece-y-shaft)
cone = cad.getlastobj()
cad.fuse(cyl, cone)
obj = cad.getlastobj()
cad.rotate(obj, x, y, 0, 1, 0, 0, -math.pi/2)
cad.cut(sk, obj)
return cad.getlastobj()
def inlet(sk, x, y):
return channel(sk, x+off_x, y+off_y, channel_radius, inlet_radius)
pass
def escape(sk, x, y):
return channel(sk, x+off_x, y+off_y, channel_radius, channel_radius)
#
# add a rectangle to the CAD model
#
@ -185,6 +222,9 @@ else:
make_base()
#
# for wax model
#
#if __name__ != "__main__":
# sk = do_rect_cad(10, 40, z_ceiling, 110, 70, z_ceiling)
# cad.extrude(sk, 3)
@ -205,6 +245,14 @@ if __name__ != "__main__":
cad.extrude(sk, -10)
sk = cad.getlastobj()
cad.cut(sk, group)
sk = cad.getlastobj()
sk = escape(sk, 15+channel_radius, 69.5)
sk = inlet(sk, 34-channel_radius, 69.5)
sk = inlet(sk, 89.5+channel_radius, 69)
sk = escape(sk, 100-channel_radius, 69)
sk = escape(sk, 60.5-channel_radius, 65)
sk = escape(sk, 62.5+channel_radius, 65)
sk = inlet(sk, 50, 65)
print >>sys.stderr, "total mass =", total_mass, "g"
print >>sys.stderr, "total torque =", total_torque*1000.0, "mNm"