From 42c5f92ecee7f322a25c2c3b1e0bf1263457d575 Mon Sep 17 00:00:00 2001 From: spirkelmann Date: Thu, 12 Sep 2019 21:54:53 +0200 Subject: [PATCH] started with cutting away gear path for segments --- prototype/circles.py | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/prototype/circles.py b/prototype/circles.py index 6652f77..19d0c98 100644 --- a/prototype/circles.py +++ b/prototype/circles.py @@ -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):