double helix rack

This commit is contained in:
looooo
2017-06-27 11:44:05 +02:00
parent 4b34073f28
commit 4448f1f7e1
2 changed files with 31 additions and 10 deletions

View File

@@ -182,8 +182,12 @@ class involute_gear_rack():
"App::PropertyLength", "height", "gear_parameter", "height")
obj.addProperty(
"App::PropertyLength", "thickness", "gear_parameter", "thickness")
obj.addProperty(
"App::PropertyAngle", "beta", "gear_parameter", "beta ")
obj.addProperty(
"App::PropertyAngle", "pressure_angle", "involute_parameter", "pressure angle")
obj.addProperty(
"App::PropertyBool", "double_helix", "gear_parameter", "double helix")
obj.addProperty("App::PropertyPythonObject", "rack", "test", "test")
obj.rack = self.involute_rack
obj.teeth = 15
@@ -191,6 +195,7 @@ class involute_gear_rack():
obj.pressure_angle = '20. deg'
obj.height = '5. mm'
obj.thickness = '5 mm'
obj.beta = '0. deg'
self.obj = obj
obj.Proxy = self
@@ -199,10 +204,25 @@ class involute_gear_rack():
fp.rack.z = fp.teeth
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._update()
pts = fp.rack.points()
pol = Wire(makePolygon(list(map(fcvec, pts))))
fp.Shape = Face(Wire(pol)).extrude(fcvec([0., 0., fp.height]))
if fp.beta.Value == 0:
face = Face(Wire(pol))
fp.Shape = face.extrude(fcvec([0., 0., fp.height.Value]))
elif fp.double_helix:
beta = fp.beta.Value * pi / 180.
pol2 = Part.Wire(pol)
pol2.translate(fcvec([0., tan(beta) * fp.height.Value / 2, fp.height.Value / 2]))
pol3 = Part.Wire(pol)
pol3.translate(fcvec([0., 0., fp.height.Value]))
fp.Shape = makeLoft([pol, pol2, pol3], True, True)
else:
beta = fp.beta.Value * pi / 180.
pol2 = Part.Wire(pol)
pol2.translate(fcvec([0., tan(beta) * fp.height.Value, fp.height.Value]))
fp.Shape = makeLoft([pol, pol2], True)
def __getstate__(self):
return None
@@ -212,9 +232,7 @@ class involute_gear_rack():
class cycloide_gear():
"""FreeCAD gear"""
def __init__(self, obj):
self.cycloide_tooth = cycloide_tooth()
obj.addProperty("App::PropertyInteger",
@@ -236,7 +254,7 @@ class cycloide_gear():
obj.addProperty("App::PropertyAngle", "beta", "gear_parameter", "beta")
obj.addProperty(
"App::PropertyLength", "backlash", "gear_parameter", "backlash in mm")
obj.addProperty("App::PropertyPythonObject", "gear", "gear_parameter", "test")
obj.addProperty("App::PropertyPythonObject", "gear", "gear_parameter", "the python object")
obj.gear = self.cycloide_tooth
obj.teeth = 15
obj.module = '1. mm'

View File

@@ -39,7 +39,6 @@ class involute_tooth():
self._calc_gear_factors()
def _calc_gear_factors(self):
print(self.head)
self.pressure_angle_t = arctan(tan(self.pressure_angle) / cos(self.beta))
self.m = self.m_n / cos(self.beta)
self.c = self.clearance * self.m_n
@@ -153,18 +152,22 @@ class involute_tooth():
class involute_rack(object):
def __init__(self, m=5, z=15, pressure_angle=20 * pi / 180., thickness=5):
def __init__(self, m=5, z=15, pressure_angle=20 * pi / 180., thickness=5, beta=0):
self.pressure_angle = pressure_angle
self.thickness = thickness
self.m = m
self.z = z
self.beta = beta
def _update(self):
self.__init__(m = self.m, z = self.z, pressure_angle = self.pressure_angle, thickness = self.thickness)
self.__init__(m = self.m, z = self.z, pressure_angle = self.pressure_angle, thickness = self.thickness, beta=self.beta)
def points(self, num=10):
a = 2 * self.m * tan(self.pressure_angle)
b = ((self.m * pi) / 2 - a) / 2
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
tooth= [
[self.m, -a - b],
[-self.m, -b],
@@ -172,7 +175,7 @@ class involute_rack(object):
[self.m, a + b]
]
teeth = [tooth]
trans = translation([0., self.m * pi, 0.])
trans = translation([0., m * pi, 0.])
for i in range(self.z):
teeth.append(trans(teeth[-1]))
teeth = list(np.vstack(teeth))