started working on figuring out cuts for dispenser gears
This commit is contained in:
parent
f34775eb3f
commit
8940f5965f
|
@ -5,10 +5,11 @@ import operator
|
||||||
|
|
||||||
|
|
||||||
def svg_circle(id, name, c, r):
|
def svg_circle(id, name, c, r):
|
||||||
|
# create circle object in svg notation
|
||||||
text = [' <circle\n',
|
text = [' <circle\n',
|
||||||
' id="circle{}"\n'.format(id),
|
' id="circle{}"\n'.format(id),
|
||||||
' inkscape:label="{}"\n'.format(name),
|
' inkscape:label="{}"\n'.format(name),
|
||||||
' style="fill:none;stroke:#000000;stroke-width:1.0"\n',
|
' style="fill:none;stroke:#000000;stroke-width:1.0mm"\n',
|
||||||
' r="{}mm"\n'.format(r),
|
' r="{}mm"\n'.format(r),
|
||||||
' cy="{}mm"\n'.format(c[1]),
|
' cy="{}mm"\n'.format(c[1]),
|
||||||
' cx="{}mm" />\n'.format(c[0])]
|
' cx="{}mm" />\n'.format(c[0])]
|
||||||
|
@ -174,10 +175,10 @@ class PlateLayout:
|
||||||
self.target_plate_radius = 155.0
|
self.target_plate_radius = 155.0
|
||||||
self.target_radius_1 = 50.0
|
self.target_radius_1 = 50.0
|
||||||
self.target_radius_2 = 20.0
|
self.target_radius_2 = 20.0
|
||||||
teeth = 360
|
teeth = 200
|
||||||
|
|
||||||
D = 2 * self.target_plate_radius
|
D = 2 * self.target_plate_radius
|
||||||
m = D/teeth/math.pi
|
m = D/teeth
|
||||||
|
|
||||||
print("plate radius = {:6.2f} mm".format(self.target_plate_radius))
|
print("plate radius = {:6.2f} mm".format(self.target_plate_radius))
|
||||||
print("big circle radius = {:6.2f} mm".format(self.target_radius_1))
|
print("big circle radius = {:6.2f} mm".format(self.target_radius_1))
|
||||||
|
@ -187,6 +188,29 @@ class PlateLayout:
|
||||||
print("pitch diameter: D = {} mm".format(D))
|
print("pitch diameter: D = {} mm".format(D))
|
||||||
print("module: M = {} mm".format(m))
|
print("module: M = {} mm".format(m))
|
||||||
|
|
||||||
|
|
||||||
|
# parameters for dispenser gears
|
||||||
|
self.dispenser_module = 1.5
|
||||||
|
dispenser_1_target_pitch_diameter_big = 80.0
|
||||||
|
dispenser_1_target_pitch_diameter_small = 25.0
|
||||||
|
dispenser_1_teeth_big = int(dispenser_1_target_pitch_diameter_big/self.dispenser_module)
|
||||||
|
dispenser_1_teeth_small = int(dispenser_1_target_pitch_diameter_small/ self.dispenser_module)
|
||||||
|
|
||||||
|
dispenser_1_pitch_diameter_big = self.dispenser_module * dispenser_1_teeth_big
|
||||||
|
dispenser_1_outer_diameter_big = dispenser_1_pitch_diameter_big + 2 * self.dispenser_module
|
||||||
|
dispenser_1_pitch_diameter_small = self.dispenser_module * dispenser_1_teeth_small
|
||||||
|
dispenser_1_outer_diameter_small = dispenser_1_pitch_diameter_small + 2 * self.dispenser_module
|
||||||
|
|
||||||
|
dispenser_2_target_pitch_diameter_big = 40.0
|
||||||
|
dispenser_2_target_pitch_diameter_small = 25.0
|
||||||
|
dispenser_2_teeth_big = int(dispenser_2_target_pitch_diameter_big / self.dispenser_module)
|
||||||
|
dispenser_2_teeth_small = int(dispenser_2_target_pitch_diameter_small / self.dispenser_module)
|
||||||
|
|
||||||
|
dispenser_2_pitch_diameter_big = self.dispenser_module * dispenser_2_teeth_big
|
||||||
|
dispenser_2_outer_diameter_big = dispenser_2_pitch_diameter_big + 2 * self.dispenser_module
|
||||||
|
dispenser_2_pitch_diameter_small = self.dispenser_module * dispenser_2_teeth_small
|
||||||
|
dispenser_2_outer_diameter_small = dispenser_2_pitch_diameter_small + 2 * self.dispenser_module
|
||||||
|
|
||||||
# plot plate
|
# plot plate
|
||||||
plt.figure(2)
|
plt.figure(2)
|
||||||
plt.plot(0.0, 0.0, 'o')
|
plt.plot(0.0, 0.0, 'o')
|
||||||
|
@ -220,6 +244,13 @@ class PlateLayout:
|
||||||
circle = plt.Circle((x,y), self.target_radius_1, fill=False)
|
circle = plt.Circle((x,y), self.target_radius_1, fill=False)
|
||||||
plt.gca().add_artist(circle)
|
plt.gca().add_artist(circle)
|
||||||
|
|
||||||
|
p1 = dispenser_1_pitch_diameter_big
|
||||||
|
p2 = dispenser_1_pitch_diameter_small
|
||||||
|
a1 = self.dispenser_module
|
||||||
|
a2 = self.dispenser_module
|
||||||
|
offset_1 = sqrt((p1 / 2 + p2 / 2) ** 2 - (p1 / 2 + a1) ** 2) - p2 / 2 - a2
|
||||||
|
print("dispenser 1 offset = {}".format(offset_1))
|
||||||
|
|
||||||
print(" big circle tangent points: ")
|
print(" big circle tangent points: ")
|
||||||
for k in range(0, self.N):
|
for k in range(0, self.N):
|
||||||
x = coords[k][0] * outer_radius
|
x = coords[k][0] * outer_radius
|
||||||
|
@ -255,6 +286,13 @@ class PlateLayout:
|
||||||
circle = plt.Circle((x, y), self.target_radius_2, fill=False)
|
circle = plt.Circle((x, y), self.target_radius_2, fill=False)
|
||||||
plt.gca().add_artist(circle)
|
plt.gca().add_artist(circle)
|
||||||
|
|
||||||
|
p1 = dispenser_2_pitch_diameter_big
|
||||||
|
p2 = dispenser_2_pitch_diameter_small
|
||||||
|
a1 = self.dispenser_module
|
||||||
|
a2 = self.dispenser_module
|
||||||
|
offset_2 = sqrt((p1 / 2 + p2 / 2) ** 2 - (p1 / 2 + a1) ** 2) - p2 / 2 - a2
|
||||||
|
print("dispenser 2 offset = {}".format(offset_2))
|
||||||
|
|
||||||
print(" small circle tangent points: ")
|
print(" small circle tangent points: ")
|
||||||
for k in range(0, self.N):
|
for k in range(0, self.N):
|
||||||
x = coords_2[k][0] * outer_radius
|
x = coords_2[k][0] * outer_radius
|
||||||
|
@ -272,62 +310,8 @@ class PlateLayout:
|
||||||
plt.plot(t1[0], t1[1], 'o')
|
plt.plot(t1[0], t1[1], 'o')
|
||||||
plt.plot(t2[0], t2[1], 'o')
|
plt.plot(t2[0], t2[1], 'o')
|
||||||
|
|
||||||
# for k in range(0, self.N):
|
pass
|
||||||
#
|
|
||||||
# t1, t2 = compute_tangent_points((0,0),(x,y), target_radius_1)
|
|
||||||
# self.tube_1_tangents[k] = (t1, t2)
|
|
||||||
#
|
|
||||||
# plt.plot(t1[0] / 1000, t1[1] / 1000, 'o')
|
|
||||||
# plt.plot(t2[0] / 1000, t2[1] / 1000, 'o')
|
|
||||||
#
|
|
||||||
# angle = arctan2(y,x) * 360.0 / (2.0 * math.pi)
|
|
||||||
# dist = (x**2 + y**2)**0.5
|
|
||||||
#
|
|
||||||
# angle_t1 = arctan2(t1[1], t1[0]) * 360.0 / (2.0 * math.pi)
|
|
||||||
# dist_t1 = (t1[0] ** 2 + t1[1] ** 2) ** 0.5
|
|
||||||
#
|
|
||||||
# angle_t2 = arctan2(t2[1], t2[0]) * 360.0 / (2.0 * math.pi)
|
|
||||||
# dist_t2 = (t2[0] ** 2 + t2[1] ** 2) ** 0.5
|
|
||||||
# print(" k = {}, (x,y) = ({:8.3f}, {:8.3f}), angle = {:8.3f} deg, dist = {:8.3f} mm".format(k, x, y, angle, dist))
|
|
||||||
# print(" t1 = ({:8.3f}, {:8.3f}), angle = {:8.3f} deg, dist = {:8.3f} mm".format(t1[0], t1[1], angle_t1,
|
|
||||||
# dist_t1))
|
|
||||||
# print(" t2 = ({:8.3f}, {:8.3f}), angle = {:8.3f} deg, dist = {:8.3f} mm".format(t2[0], t2[1], angle_t2,
|
|
||||||
# dist_t2))
|
|
||||||
# print("\n")
|
|
||||||
# tube1['coords'] = tube_1_coords
|
|
||||||
# tube1['tangents'] = tube_1_tangents
|
|
||||||
#
|
|
||||||
# tube_2_coords = {}
|
|
||||||
# tube_2_tangents = {}
|
|
||||||
# print(" coordinates:")
|
|
||||||
# for k in range(0,self.N):
|
|
||||||
# x = coords_2[k][0] * 1000
|
|
||||||
# y = coords_2[k][1] * 1000
|
|
||||||
#
|
|
||||||
# tube_2_coords[k] = (x, y)
|
|
||||||
#
|
|
||||||
# t1, t2 = compute_tangent_points((0, 0), (x, y), r * 100)
|
|
||||||
# tube_2_tangents[k] = (t1, t2)
|
|
||||||
# plt.plot(t1[0] / 1000, t1[1] / 1000, 'o')
|
|
||||||
# plt.plot(t2[0] / 1000, t2[1] / 1000, 'o')
|
|
||||||
#
|
|
||||||
# angle = arctan2(y, x) * 360.0 / (2.0 * math.pi)
|
|
||||||
# dist = (x ** 2 + y ** 2) ** 0.5
|
|
||||||
#
|
|
||||||
# angle_t1 = arctan2(t1[1], t1[0]) * 360.0 / (2.0 * math.pi)
|
|
||||||
# dist_t1 = (t1[0] ** 2 + t1[1] ** 2) ** 0.5
|
|
||||||
#
|
|
||||||
# angle_t2 = arctan2(t2[1], t2[0]) * 360.0 / (2.0 * math.pi)
|
|
||||||
# dist_t2 = (t2[0] ** 2 + t2[1] ** 2) ** 0.5
|
|
||||||
# print(" k = {}, (x,y) = ({:8.3f}, {:8.3f}), angle = {:8.3f} deg, dist = {:8.3f} mm".format(k, x, y, angle, dist))
|
|
||||||
# print(" t1 = ({:8.3f}, {:8.3f}), angle = {:8.3f} deg, dist = {:8.3f} mm".format(t1[0], t1[1], angle_t1,
|
|
||||||
# dist_t1))
|
|
||||||
# print(" t2 = ({:8.3f}, {:8.3f}), angle = {:8.3f} deg, dist = {:8.3f} mm".format(t2[0], t2[1], angle_t2,
|
|
||||||
# dist_t2))
|
|
||||||
# tube2['coords'] = tube_2_coords
|
|
||||||
# tube2['tangents'] = tube_2_tangents
|
|
||||||
#
|
|
||||||
# return tube1, tube2
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
input: file = svg with plate gear centered at (0,0)
|
input: file = svg with plate gear centered at (0,0)
|
||||||
|
@ -358,6 +342,7 @@ class PlateLayout:
|
||||||
|
|
||||||
f_lines.append('</svg>\n')
|
f_lines.append('</svg>\n')
|
||||||
|
|
||||||
|
# write new svg image
|
||||||
fw = open('output.svg', 'w')
|
fw = open('output.svg', 'w')
|
||||||
fw.writelines(f_lines)
|
fw.writelines(f_lines)
|
||||||
fw.close()
|
fw.close()
|
||||||
|
|
415
prototype/dispenser_gears.svg
Normal file
415
prototype/dispenser_gears.svg
Normal file
File diff suppressed because one or more lines are too long
After Width: | Height: | Size: 82 KiB |
Loading…
Reference in New Issue
Block a user