added code for generating part for clamping the plate to the rod
This commit is contained in:
parent
817db1a623
commit
1a02956519
|
@ -166,8 +166,10 @@ class PlateLayout:
|
||||||
# compute coordinates and various measurements for fixed radii of plate and tubes
|
# compute coordinates and various measurements for fixed radii of plate and tubes
|
||||||
self.target_plate_radius = 160.0
|
self.target_plate_radius = 160.0
|
||||||
self.target_center_hole_radius = 7.5
|
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 = 20.0
|
||||||
|
self.target_radius_2_inner = 34.0/2.0
|
||||||
teeth = 200
|
teeth = 200
|
||||||
|
|
||||||
D = 2 * self.target_plate_radius
|
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]['tangent_point'] = t1
|
||||||
self.tube_1_cuts[k]['angle_deg'] = angle1_deg
|
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]['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')
|
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]['tangent_point'] = t1
|
||||||
self.tube_2_cuts[k]['angle_deg'] = angle1_deg
|
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]['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')
|
plt.plot(cut_center[0], cut_center[1], 'o')
|
||||||
|
|
||||||
|
@ -410,7 +412,24 @@ class PlateLayout:
|
||||||
if output_all:
|
if output_all:
|
||||||
f_lines = self.output_whole(f_lines)
|
f_lines = self.output_whole(f_lines)
|
||||||
else:
|
else:
|
||||||
f_lines = self.output_segment(f_lines, 2, split_at_big_circles=False)
|
f_lines += '<g>\n'
|
||||||
|
f_lines = self.output_segment(f_lines, 2, split_at_big_circles=True)
|
||||||
|
f_lines += '</g>\n'
|
||||||
|
|
||||||
|
# output other parts
|
||||||
|
r = np.linalg.norm(self.tube_1_coords[0]) - self.target_radius_1
|
||||||
|
f_lines += '<g>\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 += '</g>\n'
|
||||||
|
|
||||||
|
f_lines += '<g>\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 += '</g>\n'
|
||||||
|
|
||||||
f_lines.append('</svg>\n')
|
f_lines.append('</svg>\n')
|
||||||
|
|
||||||
|
@ -419,6 +438,10 @@ class PlateLayout:
|
||||||
fw.writelines(f_lines)
|
fw.writelines(f_lines)
|
||||||
fw.close()
|
fw.close()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
@ -454,13 +477,13 @@ class PlateLayout:
|
||||||
f_lines += svg_gear_marking(self.tube_1_tangents[k_next], self.tube_1_coords[k_next])
|
f_lines += svg_gear_marking(self.tube_1_tangents[k_next], self.tube_1_coords[k_next])
|
||||||
|
|
||||||
# cutout rectangle for big circles
|
# 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
|
# gear pos for small circle
|
||||||
f_lines += svg_gear_marking(self.tube_2_tangents[k], self.tube_2_coords[k])
|
f_lines += svg_gear_marking(self.tube_2_tangents[k], self.tube_2_coords[k])
|
||||||
|
|
||||||
# cutout rectangle for small circles
|
# 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
|
# first segment border
|
||||||
f_lines += svg_segment_border_inner(self.tube_1_angles[k], self.target_center_hole_radius,
|
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)
|
f_lines += svg_arc(p1, p2, self.target_center_hole_radius, 0, 1)
|
||||||
|
|
||||||
# small circles arcs
|
# 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])
|
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)
|
self.tube_2_angles[k_next], orientation_flag=0)
|
||||||
|
|
||||||
# big circle
|
# 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
|
# gear pos for big circle
|
||||||
f_lines += svg_gear_marking(self.tube_1_tangents[k_next], self.tube_1_coords[k_next])
|
f_lines += svg_gear_marking(self.tube_1_tangents[k_next], self.tube_1_coords[k_next])
|
||||||
|
|
||||||
# cutout rectangle for big circles
|
# cutout rectangle for big circles
|
||||||
f_lines += svg_rectangle(k, 'cut', self.tube_1_cuts[k_next])
|
f_lines += svg_rect_trans(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_next])
|
||||||
|
|
||||||
# gear pos for small circle
|
# gear pos for small circle
|
||||||
f_lines += svg_gear_marking(self.tube_2_tangents[k_next], self.tube_2_coords[k_next])
|
f_lines += svg_gear_marking(self.tube_2_tangents[k_next], self.tube_2_coords[k_next])
|
||||||
|
|
||||||
# cutout rectangle for small circles
|
# 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
|
# first segment border
|
||||||
f_lines += svg_segment_border_inner(self.tube_2_angles[k], self.target_center_hole_radius,
|
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,
|
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
|
# second segment border
|
||||||
f_lines += svg_segment_border_inner(self.tube_2_angles[k_next], self.target_center_hole_radius,
|
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,
|
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
|
# find outmost points for segment cut lines
|
||||||
|
@ -629,13 +652,13 @@ class PlateLayout:
|
||||||
|
|
||||||
# output cuts for big circles
|
# output cuts for big circles
|
||||||
for k, c in self.tube_1_cuts.items():
|
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
|
f_lines = f_lines + text
|
||||||
pass
|
pass
|
||||||
|
|
||||||
# output cuts for small circles
|
# output cuts for small circles
|
||||||
for k, c in self.tube_2_cuts.items():
|
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
|
f_lines = f_lines + text
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
|
@ -10,12 +10,15 @@ Important: SVG produced by python script needs to be openend, transformed and sa
|
||||||
In progress:
|
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)
|
- 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
|
- shovels for dispensers by cutting segments from a sphere
|
||||||
|
|
||||||
DONE:
|
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)
|
- stack 2 plates for better stability (add cuts at small circles)
|
||||||
- automate generation of plate segment
|
- automate generation of plate segment
|
||||||
- connectors for segments (jigsaw puzzle style)
|
- connectors for segments (jigsaw puzzle style)
|
||||||
|
|
|
@ -161,14 +161,7 @@ def svg_arc(p1, p2, r, large_arc, sweep):
|
||||||
|
|
||||||
return text
|
return text
|
||||||
|
|
||||||
|
def svg_rect(x, y, width, height, angle=0.0):
|
||||||
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
|
|
||||||
text = ['<g transform="rotate({})">\n '
|
text = ['<g transform="rotate({})">\n '
|
||||||
'<rect x="{}mm" y="{}mm" width="{}mm" height="{}mm" style="fill:none;stroke-width:0.1mm;stroke:rgb(0,0,0)" />\n '
|
'<rect x="{}mm" y="{}mm" width="{}mm" height="{}mm" style="fill:none;stroke-width:0.1mm;stroke:rgb(0,0,0)" />\n '
|
||||||
'</g>\n'
|
'</g>\n'
|
||||||
|
@ -176,6 +169,16 @@ def svg_rectangle(id, name, c):
|
||||||
|
|
||||||
return text
|
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):
|
def svg_line(p1, p2, width=1.0):
|
||||||
text = ['<line x1="{}mm" y1="{}mm" x2="{}mm" y2="{}mm" style="stroke:rgb(0,0,0);stroke-width:{}mm" />'.format(p1[0],
|
text = ['<line x1="{}mm" y1="{}mm" x2="{}mm" y2="{}mm" style="stroke:rgb(0,0,0);stroke-width:{}mm" />'.format(p1[0],
|
||||||
|
|
Loading…
Reference in New Issue
Block a user