diff --git a/prototype/circles.py b/prototype/circles.py index 186b5de..c5ad117 100644 --- a/prototype/circles.py +++ b/prototype/circles.py @@ -5,10 +5,11 @@ import operator def svg_circle(id, name, c, r): + # create circle object in svg notation text = [' \n'.format(c[0])] @@ -174,10 +175,10 @@ class PlateLayout: self.target_plate_radius = 155.0 self.target_radius_1 = 50.0 self.target_radius_2 = 20.0 - teeth = 360 + teeth = 200 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("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("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 plt.figure(2) plt.plot(0.0, 0.0, 'o') @@ -220,6 +244,13 @@ class PlateLayout: circle = plt.Circle((x,y), self.target_radius_1, fill=False) 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: ") for k in range(0, self.N): x = coords[k][0] * outer_radius @@ -255,6 +286,13 @@ class PlateLayout: circle = plt.Circle((x, y), self.target_radius_2, fill=False) 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: ") for k in range(0, self.N): x = coords_2[k][0] * outer_radius @@ -272,62 +310,8 @@ class PlateLayout: plt.plot(t1[0], t1[1], 'o') plt.plot(t2[0], t2[1], 'o') - # for k in range(0, self.N): - # - # 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 + pass + """ input: file = svg with plate gear centered at (0,0) @@ -358,6 +342,7 @@ class PlateLayout: f_lines.append('\n') + # write new svg image fw = open('output.svg', 'w') fw.writelines(f_lines) fw.close() diff --git a/prototype/dispenser_gears.svg b/prototype/dispenser_gears.svg new file mode 100644 index 0000000..5d752dc --- /dev/null +++ b/prototype/dispenser_gears.svg @@ -0,0 +1,415 @@ + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + p1/2 + p2/2 + p1/2 + a1(= Outside circle) + + + + + + (p1/2 + p2/2)**2 = (p1/2 + a1)**2 + (p2/2 + a2 + x)**2 => Offset x = sqrt((p1/2 + p2/2)**2 - (p1/2 + a1)**2) - p2/2 - a2 x + + + p2/2 + a2 + p1: Pitch diameter gear 1p2: Pitch diameter gear 2a1: Addendum gear 1 = module 1a2: Addendum gear 2 = module 2x : Offset Dispenser gears + + + Teeth: 16 CP: 4.7124(mm) + DP: 0.667 Module: 135.0000 + Pressure Angle: 25.00 degrees + Pitch diameter: 24.000 mm + Outer diameter: 27.000 mm + Base diameter: 21.751 mm + + + + + Teeth: 53 CP: 4.7124(mm) + DP: 0.667 Module: 135.0000 + Pressure Angle: 25.00 degrees + Pitch diameter: 79.500 mm + Outer diameter: 82.500 mm + Base diameter: 72.051 mm + + + + + Teeth: 26 CP: 4.7124(mm) + DP: 0.667 Module: 135.0000 + Pressure Angle: 25.00 degrees + Pitch diameter: 39.000 mm + Outer diameter: 42.000 mm + Base diameter: 35.346 mm + +