Before I make a test rig for my customer's injection moulded gears ( the gears which I made the solid models for ), I checked some of the gears, by rotating them on a spindle under a dial indicator. I am quite pleased with the way I displayed my results to him. The paper data was written down by my assistant, as I spoke the values. I then wrote a Python program, which made a text file. The file contents were copied and pasted into HeeksCAD, making points, which I could then create spline curves through. I wonder if I could automate this using an arduino, a stepper motor, and a dial indicator with a serial interface? something like this http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1288396532
Python program to make HeeksCAD points:
import math
fout = open("points.txt", "w")
fout.write('\n')
gears = [
[17, 17, 16, 17, 17, 17, 16, 16, 15, 14, 13, 13, 13, 13, 13, 15, 16, 17, 18, 20, 22, 26, 29, 32, 37, 43, 41, 36, 32, 29, 23, 19, 12, 10, 9, 8, 7, 3, 2, 1, 0, 1, 2, 2, 5, 8, 10, 13, 13, 14, 15, 15],
[10, 10, 11, 11, 11, 11, 11, 11, 12, 11, 11, 12, 11, 12, 10, 10, 11, 10, 10, 12, 15, 18, 22, 28, 33, 36, 41, 42, 37, 31, 26, 22, 18, 14, 9, 5, 5, 5, 4, 4, 4, 3, 3, 4, 5, 6, 7, 8, 9, 9, 9, 9],
[15, 15, 16, 17, 17, 17, 17, 15, 14, 13, 12, 12, 13, 13, 13, 15, 17, 20, 21, 21, 24, 27, 31, 34, 39, 44, 43, 37, 34, 29, 21, 17, 13, 11, 10, 8, 6, 4, 3, 1, 1, 2, 3, 4, 6, 10, 13, 14, 14, 13, 15, 14],
]
id = 1
for gear in gears:
i = 0
for p in gear:
angle = (float(360)/len(gear) * i) * math.pi / 180
r = float(1.0) + 0.4 * float(p) / 40.0
y = r * math.sin(angle)
x = r * math.cos(angle)
fout.write('
i += 1
id += 1
1 comment:
Hi.
Looks like the code is incomplete, the output file will contain nothing but newline characters.
Post a Comment