started with cutting away gear path for segments

master
Simon Pirkelmann 2019-09-12 21:54:53 +02:00
parent a31dd52392
commit 42c5f92ece
1 changed files with 34 additions and 0 deletions

View File

@ -579,6 +579,8 @@ class PlateLayout:
text = svg_line(p3, p4, 0.1)
f_lines = f_lines + text
outer_point_1 = p4
# segment border (left)
a = self.tube_1_angles[k_next]
a = a / 360.0 * 2.0 * np.pi
@ -596,6 +598,38 @@ class PlateLayout:
text = svg_line(p3, p4, 0.1)
f_lines = f_lines + text
outer_point_2 = p4
# truncate gear path
for k in range(len(f_lines)):
current_line = f_lines[k]
if 'd="m ' in current_line:
# remove center whole drawn by gear-dev
gear_data = current_line
index_start = gear_data.find('m') # end of path containing gear outline coordinates
index_end = gear_data.find('z')
coordinates_data_raw = gear_data[index_start+1:index_end].split()
c_running = np.array([float(v) for v in coordinates_data_raw[0].split(',')])
coordinates = [c_running]
for c in coordinates_data_raw[1:]:
dv = np.array([float(v) for v in c.split(',')])
c_running = c_running + dv
coordinates.append(c_running)
pass
dist_1 = [np.linalg.norm(c - outer_point_1*scale) for c in coordinates]
dist_2 = [np.linalg.norm(c - outer_point_2 * scale) for c in coordinates]
# find minimum distance and keep only points between the two distances
# problem: does not consider manual rotation of the plate
# -> rotate points outer_point_1 and outer_point_2 before computing the distance
# ...
pass
#f_lines[k] = gear_data[0:index+1] + gear_data[-2:]
return f_lines
def output_whole(self, f_lines):