From 962c0e4ffeaf8b97c43ec73d3b0055945d3940d9 Mon Sep 17 00:00:00 2001 From: looooo Date: Thu, 29 Jun 2017 10:22:19 +0200 Subject: [PATCH] involute-rack: add head parameter --- gearfunc/_Classes.py | 3 +++ gearfunc/_involute_tooth.py | 22 ++++++++++++---------- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/gearfunc/_Classes.py b/gearfunc/_Classes.py index fa6682b..8b90833 100644 --- a/gearfunc/_Classes.py +++ b/gearfunc/_Classes.py @@ -188,6 +188,8 @@ class involute_gear_rack(): "App::PropertyAngle", "pressure_angle", "involute_parameter", "pressure angle") obj.addProperty( "App::PropertyBool", "double_helix", "gear_parameter", "double helix") + obj.addProperty( + "App::PropertyFloat", "head", "gear_parameter", "head_value * modul_value = additional length of head") obj.addProperty("App::PropertyPythonObject", "rack", "test", "test") obj.rack = self.involute_rack obj.teeth = 15 @@ -205,6 +207,7 @@ class involute_gear_rack(): fp.rack.pressure_angle = fp.pressure_angle.Value * pi / 180. fp.rack.thickness = fp.thickness.Value fp.rack.beta = fp.beta.Value * pi / 180. + fp.rack.head = fp.head fp.rack._update() pts = fp.rack.points() pol = Wire(makePolygon(list(map(fcvec, pts)))) diff --git a/gearfunc/_involute_tooth.py b/gearfunc/_involute_tooth.py index 08f8697..d036519 100644 --- a/gearfunc/_involute_tooth.py +++ b/gearfunc/_involute_tooth.py @@ -152,27 +152,29 @@ class involute_tooth(): class involute_rack(object): - def __init__(self, m=5, z=15, pressure_angle=20 * pi / 180., thickness=5, beta=0): + def __init__(self, m=5, z=15, pressure_angle=20 * pi / 180., thickness=5, beta=0, head=0): self.pressure_angle = pressure_angle self.thickness = thickness self.m = m self.z = z self.beta = beta + self.head = head def _update(self): - self.__init__(m = self.m, z = self.z, pressure_angle = self.pressure_angle, thickness = self.thickness, beta=self.beta) + self.__init__(m = self.m, z = self.z, pressure_angle = self.pressure_angle, + thickness=self.thickness, beta=self.beta, head=self.head) def points(self, num=10): pressure_angle_t = arctan(tan(self.pressure_angle) / cos(self.beta)) m = self.m / cos(self.beta) - a = 2 * self.m * tan(pressure_angle_t) - b = ((m * pi) / 2 - a) / 2 + a = (2 + self.head) * m * tan(pressure_angle_t) + b = (m * pi) / 4 - (1 + self.head) * m * tan(pressure_angle_t) tooth= [ - [self.m, -a - b], - [-self.m, -b], - [-self.m, b], - [self.m, a + b] + [-self.m, -a - b], + [self.m * (1 + self.head), -b], + [self.m * (1 + self.head), b], + [-self.m, a + b] ] teeth = [tooth] trans = translation([0., m * pi, 0.]) @@ -180,9 +182,9 @@ class involute_rack(object): teeth.append(trans(teeth[-1])) teeth = list(np.vstack(teeth)) teeth.append(list(teeth[-1])) - teeth[-1][0] += self.thickness + teeth[-1][0] -= self.thickness teeth.append(list(teeth[0])) - teeth[-1][0] += self.thickness + teeth[-1][0] -= self.thickness teeth.append(teeth[0]) return(teeth)