From 1a0295651946ce3ccdc37d6d5ecbbe646ac3c667 Mon Sep 17 00:00:00 2001 From: spirkelmann Date: Mon, 16 Sep 2019 14:24:07 +0200 Subject: [PATCH] added code for generating part for clamping the plate to the rod --- prototype/circles.py | 59 +++++++++++++++++++++++++++++------------- prototype/notes.txt | 7 +++-- prototype/svg_utils.py | 19 ++++++++------ 3 files changed, 57 insertions(+), 28 deletions(-) diff --git a/prototype/circles.py b/prototype/circles.py index 3d6414f..a8b2b7d 100644 --- a/prototype/circles.py +++ b/prototype/circles.py @@ -166,8 +166,10 @@ class PlateLayout: # compute coordinates and various measurements for fixed radii of plate and tubes self.target_plate_radius = 160.0 self.target_center_hole_radius = 7.5 - self.target_radius_1 = 50.5 + self.target_radius_1 = 50.5 # should be 50 mm according to data sheet but in fact its a bit more than that.. + self.target_radius_1_inner = 94.0/2.0 self.target_radius_2 = 20.0 + self.target_radius_2_inner = 34.0/2.0 teeth = 200 D = 2 * self.target_plate_radius @@ -296,7 +298,7 @@ class PlateLayout: self.tube_1_cuts[k]['tangent_point'] = t1 self.tube_1_cuts[k]['angle_deg'] = angle1_deg self.tube_1_cuts[k]['length'] = dispenser_1_outer_diameter_small - self.tube_1_cuts[k]['width'] = 5.0 + self.tube_1_cuts[k]['width'] = 4.0 plt.plot(cut_center[0], cut_center[1], 'o') @@ -355,7 +357,7 @@ class PlateLayout: self.tube_2_cuts[k]['tangent_point'] = t1 self.tube_2_cuts[k]['angle_deg'] = angle1_deg self.tube_2_cuts[k]['length'] = dispenser_2_outer_diameter_small - self.tube_2_cuts[k]['width'] = 5.0 + self.tube_2_cuts[k]['width'] = 4.0 plt.plot(cut_center[0], cut_center[1], 'o') @@ -410,7 +412,24 @@ class PlateLayout: if output_all: f_lines = self.output_whole(f_lines) else: - f_lines = self.output_segment(f_lines, 2, split_at_big_circles=False) + f_lines += '\n' + f_lines = self.output_segment(f_lines, 2, split_at_big_circles=True) + f_lines += '\n' + + # output other parts + r = np.linalg.norm(self.tube_1_coords[0]) - self.target_radius_1 + f_lines += '\n' + f_lines += svg_circle('1', 'center_ring_clamp', (0,0), r) + f_lines += svg_circle('2', 'center_ring_clamp', (0,0), self.target_center_hole_radius) + height = 5.0 + width = 40.0 + f_lines += svg_rect(x=-width/2.0, y=-height/2.0, width=width, height=height) + f_lines += '\n' + + f_lines += '\n' + f_lines += svg_circle('1', 'center_ring', (0,0), r) + f_lines += svg_circle('2', 'center_ring', (0,0), self.target_center_hole_radius) + f_lines += '\n' f_lines.append('\n') @@ -419,6 +438,10 @@ class PlateLayout: fw.writelines(f_lines) fw.close() + + + + pass @@ -454,13 +477,13 @@ class PlateLayout: f_lines += svg_gear_marking(self.tube_1_tangents[k_next], self.tube_1_coords[k_next]) # cutout rectangle for big circles - f_lines += svg_rectangle(k_next, 'cut', self.tube_1_cuts[k_next]) + f_lines += svg_rect_trans(k_next, 'cut', self.tube_1_cuts[k_next]) # gear pos for small circle f_lines += svg_gear_marking(self.tube_2_tangents[k], self.tube_2_coords[k]) # cutout rectangle for small circles - f_lines += svg_rectangle(k, 'cut', self.tube_2_cuts[k]) + f_lines += svg_rect_trans(k, 'cut', self.tube_2_cuts[k]) # first segment border f_lines += svg_segment_border_inner(self.tube_1_angles[k], self.target_center_hole_radius, @@ -501,38 +524,38 @@ class PlateLayout: f_lines += svg_arc(p1, p2, self.target_center_hole_radius, 0, 1) # small circles arcs - f_lines += svg_half_circle(k, 'small circle', self.tube_2_coords[k], self.target_radius_2, + f_lines += svg_half_circle(k, 'small circle', self.tube_2_coords[k], self.target_radius_2_inner, self.tube_2_angles[k]) - f_lines += svg_half_circle(k_next, 'small circle', self.tube_2_coords[k_next], self.target_radius_2, + f_lines += svg_half_circle(k_next, 'small circle', self.tube_2_coords[k_next], self.target_radius_2_inner, self.tube_2_angles[k_next], orientation_flag=0) # big circle - f_lines += svg_circle(k, 'big circle', self.tube_1_coords[k_next], self.target_radius_1) + f_lines += svg_circle(k, 'big circle', self.tube_1_coords[k_next], self.target_radius_1_inner) # gear pos for big circle f_lines += svg_gear_marking(self.tube_1_tangents[k_next], self.tube_1_coords[k_next]) # cutout rectangle for big circles - f_lines += svg_rectangle(k, 'cut', self.tube_1_cuts[k_next]) - f_lines += svg_rectangle(k, 'cut', self.tube_1_cuts[k_next_next]) + f_lines += svg_rect_trans(k, 'cut', self.tube_1_cuts[k_next]) + f_lines += svg_rect_trans(k, 'cut', self.tube_1_cuts[k_next_next]) # gear pos for small circle f_lines += svg_gear_marking(self.tube_2_tangents[k_next], self.tube_2_coords[k_next]) # cutout rectangle for small circles - f_lines += svg_rectangle(k_next, 'cut', self.tube_2_cuts[k_next]) + f_lines += svg_rect_trans(k_next, 'cut', self.tube_2_cuts[k_next]) # first segment border f_lines += svg_segment_border_inner(self.tube_2_angles[k], self.target_center_hole_radius, - self.tube_2_coords[k], self.target_radius_2, puzzle_scale=0.5, placement=0.25) + self.tube_2_coords[k], self.target_radius_2_inner, puzzle_scale=0.5, placement=0.25) f_lines += svg_segment_border_outer(self.tube_2_angles[k], self.target_plate_radius, self.plate_module, - self.tube_2_coords[k], self.target_radius_2) + self.tube_2_coords[k], self.target_radius_2_inner) # second segment border f_lines += svg_segment_border_inner(self.tube_2_angles[k_next], self.target_center_hole_radius, - self.tube_2_coords[k_next], self.target_radius_2, puzzle_scale=0.5, placement=0.25) + self.tube_2_coords[k_next], self.target_radius_2_inner, puzzle_scale=0.5, placement=0.25) f_lines += svg_segment_border_outer(self.tube_2_angles[k_next], self.target_plate_radius, self.plate_module, - self.tube_2_coords[k_next], self.target_radius_2) + self.tube_2_coords[k_next], self.target_radius_2_inner) # find outmost points for segment cut lines @@ -629,13 +652,13 @@ class PlateLayout: # output cuts for big circles for k, c in self.tube_1_cuts.items(): - text = svg_rectangle(k, 'cut', c['center'], c['length'], c['width'], c['angle_deg']) + text = svg_rect_trans(k, 'cut', c) f_lines = f_lines + text pass # output cuts for small circles for k, c in self.tube_2_cuts.items(): - text = svg_rectangle(k, 'cut', c['center'], c['length'], c['width'], c['angle_deg']) + text = svg_rect_trans(k, 'cut', c) f_lines = f_lines + text pass diff --git a/prototype/notes.txt b/prototype/notes.txt index f96c031..9e0cb63 100644 --- a/prototype/notes.txt +++ b/prototype/notes.txt @@ -10,12 +10,15 @@ Important: SVG produced by python script needs to be openend, transformed and sa In progress: -TODO: +TODO: +- add displacement between gear cuts and circles to have more stability at the cuts - second ring above the first plate to fix the containers and hide the gear mechanic (or manufacure them from acrylic to show the mechanic) -- whole for hinges of big dispenser gears +- hole for hinges of big dispenser gears (only if necessary) - shovels for dispensers by cutting segments from a sphere DONE: +- center ring for holding the plates +- make circles for lower plate of the two plates a bit smaller s.t. tube are perfectly set into the upper plate and fixed by the lower plate - stack 2 plates for better stability (add cuts at small circles) - automate generation of plate segment - connectors for segments (jigsaw puzzle style) diff --git a/prototype/svg_utils.py b/prototype/svg_utils.py index 43bf64e..18a0dfc 100644 --- a/prototype/svg_utils.py +++ b/prototype/svg_utils.py @@ -161,14 +161,7 @@ def svg_arc(p1, p2, r, large_arc, sweep): return text - -def svg_rectangle(id, name, c): - center = c['center'] - width = c['length'] - height = c['width'] - angle = c['angle_deg'] - x = np.sqrt(center[0] ** 2 + center[1] ** 2) - width / 2 - y = - height +def svg_rect(x, y, width, height, angle=0.0): text = ['\n ' '\n ' '\n' @@ -176,6 +169,16 @@ def svg_rectangle(id, name, c): return text +def svg_rect_trans(id, name, c): + center = c['center'] + width = c['length'] + height = c['width'] + angle = c['angle_deg'] + x = np.sqrt(center[0] ** 2 + center[1] ** 2) - width / 2 + y = - height + + return svg_rect(x, y, width, height, angle) + def svg_line(p1, p2, width=1.0): text = [''.format(p1[0],