diff --git a/freecad/gears/features.py b/freecad/gears/features.py index f2b1ddb..929aa5d 100644 --- a/freecad/gears/features.py +++ b/freecad/gears/features.py @@ -110,6 +110,8 @@ class InvoluteGear(object): "gear", "gear_parameter", "test") obj.addProperty("App::PropertyLength", "dw", "computed", "pitch diameter", 1) + obj.addProperty("App::PropertyLength", "transverse_pitch", + "computed", "transverse_pitch", 1) obj.gear = self.involute_tooth obj.simple = False obj.undercut = False @@ -170,7 +172,9 @@ class InvoluteGear(object): rw = fp.gear.dw / 2 fp.Shape = Part.makeCylinder(rw, fp.height.Value) + # computed properties fp.dw = "{}mm".format(fp.gear.dw) + fp.transverse_pitch = "{}mm".format(fp.gear.pitch) def __getstate__(self): return None diff --git a/pygears/involute_tooth.py b/pygears/involute_tooth.py index 0351274..04bd763 100644 --- a/pygears/involute_tooth.py +++ b/pygears/involute_tooth.py @@ -48,6 +48,8 @@ class InvoluteTooth(): else: self.pressure_angle_t = self.pressure_angle self.m = self.m_n + + self.pitch = self.m * np.pi self.c = self.clearance * self.m_n self.midpoint = [0., 0.] self.d = self.z * self.m @@ -216,7 +218,7 @@ class InvoluteRack(object): if self.add_endings: ext1 = teeth[0] + np.array([0., a + b - pitch / 2]) ext2 = teeth[-1] - np.array([0., a + b - pitch / 2]) - teeth = [ext1.tolist(), ext1.tolist()] + teeth + [ext2.tolist(), ext2.tolist()] + teeth = [ext1.tolist(), ext1.tolist()] + teeth.tolist() + [ext2.tolist(), ext2.tolist()] else: teeth = [teeth[0].tolist()] + teeth.tolist() + [teeth[-1].tolist()] #teeth.append(list(teeth[-1]))