better naming

This commit is contained in:
looooo
2015-10-24 19:09:11 +02:00
parent b6499ebd40
commit c6c8a23c9e
6 changed files with 110 additions and 113 deletions

View File

@@ -5,9 +5,6 @@ from gearfunc._cycloide_tooth import cycloide_tooth
from gearfunc._bevel_tooth import bevel_tooth
from gearfunc import CreateInvoluteRack, CreateCycloideGear, CreateInvoluteGear, CreateBevelGear
from tests import bspline_surf
__All__ = [
"CreateInvoluteRack",
"CreateCycloideGear",

View File

@@ -60,9 +60,9 @@ class involute_gear():
obj.addProperty(
"App::PropertyLength", "height", "gear_parameter", "height")
obj.addProperty(
"App::PropertyAngle", "alpha", "involute_parameter", "alpha")
"App::PropertyAngle", "pressure_angle", "involute_parameter", "pressure angle")
obj.addProperty(
"App::PropertyFloat", "clearence", "gear_parameter", "clearence")
"App::PropertyFloat", "clearance", "gear_parameter", "clearance")
obj.addProperty("App::PropertyInteger", "numpoints",
"gear_parameter", "number of points for spline")
obj.addProperty(
@@ -76,10 +76,10 @@ class involute_gear():
obj.teeth = 15
obj.module = '1. mm'
obj.shift = 0.
obj.alpha = '20. deg'
obj.pressure_angle = '20. deg'
obj.beta = '0. deg'
obj.height = '5. mm'
obj.clearence = 0.25
obj.clearance = 0.25
obj.numpoints = 6
obj.backlash = '0.00 mm'
self.obj = obj
@@ -90,9 +90,9 @@ class involute_gear():
fp.gear.z = fp.teeth
fp.gear.undercut = fp.undercut
fp.gear.shift = fp.shift
fp.gear.alpha = fp.alpha.Value * pi / 180.
fp.gear.pressure_angle = fp.pressure_angle.Value * pi / 180.
fp.gear.beta = fp.beta.Value * pi / 180
fp.gear.clearence = fp.clearence
fp.gear.clearance = fp.clearance
fp.gear.backlash = fp.backlash.Value
fp.gear._update()
pts = fp.gear.points(num=fp.numpoints)
@@ -154,12 +154,12 @@ class involute_gear_rack():
obj.addProperty(
"App::PropertyLength", "thickness", "gear_parameter", "thickness")
obj.addProperty(
"App::PropertyAngle", "alpha", "involute_parameter", "alpha")
"App::PropertyAngle", "pressure_angle", "involute_parameter", "pressure angle")
obj.addProperty("App::PropertyPythonObject", "rack", "test", "test")
obj.rack = self.involute_rack
obj.teeth = 15
obj.module = '1. mm'
obj.alpha = '20. deg'
obj.pressure_angle = '20. deg'
obj.height = '5. mm'
obj.thickness = '5 mm'
self.obj = obj
@@ -168,7 +168,7 @@ class involute_gear_rack():
def execute(self, fp):
fp.rack.m = fp.module.Value
fp.rack.z = fp.teeth
fp.rack.alpha = fp.alpha.Value * pi / 180.
fp.rack.pressure_angle = fp.pressure_angle.Value * pi / 180.
fp.rack.thickness = fp.thickness.Value
fp.rack._update()
pts = fp.rack.points()
@@ -199,7 +199,7 @@ class cycloide_gear():
obj.addProperty(
"App::PropertyLength", "height", "gear_parameter", "height")
obj.addProperty(
"App::PropertyFloat", "clearence", "gear_parameter", "clearence")
"App::PropertyFloat", "clearance", "gear_parameter", "clearance")
obj.addProperty("App::PropertyInteger", "numpoints",
"gear_parameter", "number of points for spline")
obj.addProperty("App::PropertyAngle", "beta", "gear_parameter", "beta")
@@ -213,7 +213,7 @@ class cycloide_gear():
obj.outer_diameter = '5 mm'
obj.beta = '0. deg'
obj.height = '5. mm'
obj.clearence = 0.25
obj.clearance = 0.25
obj.numpoints = 15
obj.backlash = '0.00 mm'
obj.Proxy = self
@@ -224,7 +224,7 @@ class cycloide_gear():
fp.gear.z = fp.teeth
fp.gear.z1 = fp.inner_diameter.Value
fp.gear.z2 = fp.outer_diameter.Value
fp.gear.clearence = fp.clearence
fp.gear.clearance = fp.clearance
fp.gear.backlash = fp.backlash.Value
fp.gear._update()
pts = fp.gear.points(num=fp.numpoints)
@@ -266,8 +266,8 @@ class cycloide_gear():
class bevel_gear():
"""parameters:
alpha: pressureangle, 10-30°
gamma: cone angle, 0 < gamma < pi/4
pressure_angle: pressureangle, 10-30°
pitch_angle: cone angle, 0 < pitch_angle < pi/4
"""
def __init__(self, obj):
@@ -277,12 +277,12 @@ class bevel_gear():
obj.addProperty(
"App::PropertyLength", "height", "gear_parameter", "height")
obj.addProperty(
"App::PropertyAngle", "gamma", "involute_parameter", "gamma")
"App::PropertyAngle", "pitch_angle", "involute_parameter", "pitch_angle")
obj.addProperty(
"App::PropertyAngle", "alpha", "involute_parameter", "alpha")
"App::PropertyAngle", "pressure_angle", "involute_parameter", "pressure_angle")
obj.addProperty("App::PropertyLength", "m", "gear_parameter", "m")
obj.addProperty(
"App::PropertyFloat", "clearence", "gear_parameter", "clearence")
"App::PropertyFloat", "clearance", "gear_parameter", "clearance")
obj.addProperty("App::PropertyInteger", "numpoints",
"gear_parameter", "number of points for spline")
obj.addProperty(
@@ -291,19 +291,19 @@ class bevel_gear():
obj.gear = self.bevel_tooth
obj.m = '1. mm'
obj.teeth = 15
obj.alpha = '20. deg'
obj.gamma = '45. deg'
obj.pressure_angle = '20. deg'
obj.pitch_angle = '45. deg'
obj.height = '5. mm'
obj.numpoints = 6
obj.backlash = '0.00 mm'
obj.clearence = 0.1
obj.clearance = 0.1
self.obj = obj
obj.Proxy = self
def execute1(self, fp):
fp.gear.z = fp.teeth
fp.gear.alpha = fp.alpha.Value * pi / 180.
fp.gear.gamma = fp.gamma.Value * pi / 180
fp.gear.pressure_angle = fp.pressure_angle.Value * pi / 180.
fp.gear.pitch_angle = fp.pitch_angle.Value * pi / 180
fp.gear.backlash = fp.backlash
fp.gear._update()
pts = fp.gear.points(num=fp.numpoints)
@@ -339,11 +339,11 @@ class bevel_gear():
def execute(self, fp):
fp.gear.z = fp.teeth
fp.gear.module = fp.m.Value
fp.gear.alpha = (90 - fp.alpha.Value) * pi / 180.
fp.gear.gamma = fp.gamma.Value * pi / 180
fp.gear.pressure_angle = (90 - fp.pressure_angle.Value) * pi / 180.
fp.gear.pitch_angle = fp.pitch_angle.Value * pi / 180
fp.gear.backlash = fp.backlash.Value
scale = fp.m.Value * fp.gear.z / 2 / tan(fp.gamma.Value * pi / 180)
fp.gear.clearence = fp.clearence / scale
scale = fp.m.Value * fp.gear.z / 2 / tan(fp.pitch_angle.Value * pi / 180)
fp.gear.clearance = fp.clearance / scale
fp.gear._update()
pts = fp.gear.points(num=fp.numpoints)
scale1 = scale - fp.height.Value / 2
@@ -356,9 +356,9 @@ class bevel_gear():
def create_tooth(self):
w = []
scal1 = self.obj.m.Value * self.obj.gear.z / 2 / tan(
self.obj.gamma.Value * pi / 180) - self.obj.height.Value / 2
self.obj.pitch_angle.Value * pi / 180) - self.obj.height.Value / 2
scal2 = self.obj.m.Value * self.obj.gear.z / 2 / tan(
self.obj.gamma.Value * pi / 180) + self.obj.height.Value / 2
self.obj.pitch_angle.Value * pi / 180) + self.obj.height.Value / 2
s = [scal1, scal2]
pts = self.obj.gear.points(num=self.obj.numpoints)
for j, pos in enumerate(s):

View File

@@ -28,79 +28,79 @@ from _functions import rotation3D, reflection3D, intersection_line_circle
class bevel_tooth(object):
def __init__(self, alpha=70 * pi / 180, gamma=pi / 4, clearence=0.1,
def __init__(self, pressure_angle=70 * pi / 180, pitch_angle=pi / 4, clearance=0.1,
z=21, backlash=0.00, module=0.25):
self.alpha = alpha
self.gamma = gamma
self.pressure_angle = pressure_angle
self.pitch_angle = pitch_angle
self.z = z
self.clearence = clearence
self.clearance = clearance
self.backlash = backlash
self.module = module
self.involute_end = arccos(
1 / sqrt(2) * sqrt((42. + 16.*cos(2.*self.alpha) +
6.*cos(4.*self.alpha) + cos(4.*self.alpha - 4.*self.gamma) - 8.*cos(2.*self.alpha - 2.*self.gamma) -
4.*cos(4.*self.alpha - 2.*self.gamma) + 24.*cos(2.*self.gamma) - 2.*cos(4.*self.gamma) -
8.*cos(2.*(self.alpha + self.gamma)) + cos(4.*(self.alpha + self.gamma)) -
4.*cos(4.*self.alpha + 2.*self.gamma) + 24.*cos((4.*sin(self.gamma))/self.z) +
4.*cos(2.*self.alpha - (4.*sin(self.gamma))/self.z) + 4.*cos(2.*self.alpha -
4.*self.gamma - (4.*sin(self.gamma))/self.z) - 8.*cos(2.*self.alpha - 2.*self.gamma -
(4.*sin(self.gamma))/self.z) + 24.*cos(4.*(self.gamma + sin(self.gamma)/self.z)) -
8.*cos(2.*(self.alpha + self.gamma + (2.*sin(self.gamma))/self.z)) + 4.*cos(2.*self.alpha +
(4.*sin(self.gamma))/self.z) + 16.*cos(2.*self.gamma + (4.*sin(self.gamma))/self.z) +
4.*cos(2.*self.alpha + 4.*self.gamma + (4.*sin(self.gamma))/self.z) + 32.*abs(cos(self.gamma +
(2.*sin(self.gamma))/self.z))*cos(self.alpha)*sqrt(4.*cos(2.*self.alpha) -
2.*(-2. + cos(2.*self.alpha - 2.*self.gamma) - 2.*cos(2.*self.gamma) + cos(2.*(self.alpha + self.gamma)) +
4.*cos(2.*self.gamma + (4.*sin(self.gamma))/self.z)))*sin(2.*self.gamma))/(-6. - 2.*cos(2.*self.alpha) +
cos(2.*self.alpha - 2.*self.gamma) - 2.*cos(2.*self.gamma) + cos(2.*(self.alpha + self.gamma)))**2))
1 / sqrt(2) * sqrt((42. + 16.*cos(2.*self.pressure_angle) +
6.*cos(4.*self.pressure_angle) + cos(4.*self.pressure_angle - 4.*self.pitch_angle) - 8.*cos(2.*self.pressure_angle - 2.*self.pitch_angle) -
4.*cos(4.*self.pressure_angle - 2.*self.pitch_angle) + 24.*cos(2.*self.pitch_angle) - 2.*cos(4.*self.pitch_angle) -
8.*cos(2.*(self.pressure_angle + self.pitch_angle)) + cos(4.*(self.pressure_angle + self.pitch_angle)) -
4.*cos(4.*self.pressure_angle + 2.*self.pitch_angle) + 24.*cos((4.*sin(self.pitch_angle))/self.z) +
4.*cos(2.*self.pressure_angle - (4.*sin(self.pitch_angle))/self.z) + 4.*cos(2.*self.pressure_angle -
4.*self.pitch_angle - (4.*sin(self.pitch_angle))/self.z) - 8.*cos(2.*self.pressure_angle - 2.*self.pitch_angle -
(4.*sin(self.pitch_angle))/self.z) + 24.*cos(4.*(self.pitch_angle + sin(self.pitch_angle)/self.z)) -
8.*cos(2.*(self.pressure_angle + self.pitch_angle + (2.*sin(self.pitch_angle))/self.z)) + 4.*cos(2.*self.pressure_angle +
(4.*sin(self.pitch_angle))/self.z) + 16.*cos(2.*self.pitch_angle + (4.*sin(self.pitch_angle))/self.z) +
4.*cos(2.*self.pressure_angle + 4.*self.pitch_angle + (4.*sin(self.pitch_angle))/self.z) + 32.*abs(cos(self.pitch_angle +
(2.*sin(self.pitch_angle))/self.z))*cos(self.pressure_angle)*sqrt(4.*cos(2.*self.pressure_angle) -
2.*(-2. + cos(2.*self.pressure_angle - 2.*self.pitch_angle) - 2.*cos(2.*self.pitch_angle) + cos(2.*(self.pressure_angle + self.pitch_angle)) +
4.*cos(2.*self.pitch_angle + (4.*sin(self.pitch_angle))/self.z)))*sin(2.*self.pitch_angle))/(-6. - 2.*cos(2.*self.pressure_angle) +
cos(2.*self.pressure_angle - 2.*self.pitch_angle) - 2.*cos(2.*self.pitch_angle) + cos(2.*(self.pressure_angle + self.pitch_angle)))**2))
self.involute_start = -pi/2. + arctan(1/tan(self.gamma)*1/cos(self.alpha))
self.involute_start = -pi/2. + arctan(1/tan(self.pitch_angle)*1/cos(self.pressure_angle))
self.involute_start_radius = self.get_radius(self.involute_start)
self.r_f = sin(self.gamma - sin(gamma) * 2 / self.z) - self.clearence * sin(self.gamma)
self.z_f = cos(self.gamma - sin(gamma) * 2 / self.z)
self.r_f = sin(self.pitch_angle - sin(pitch_angle) * 2 / self.z) - self.clearance * sin(self.pitch_angle)
self.z_f = cos(self.pitch_angle - sin(pitch_angle) * 2 / self.z)
self.add_foot = True
# if self.involute_start_radius < self.r_f:
# self.add_foot = False
# self.involute_start = -arccos(
# sqrt((42 + 16*cos(2*self.alpha) + 6*cos(4*self.alpha) -
# 4*cos(4*self.alpha - 2*self.gamma) - 8*cos(2*(self.alpha - self.gamma)) +
# cos(4*(self.alpha - self.gamma)) + 24*cos(2*self.gamma) - 2*cos(4*self.gamma) -
# 8*cos(2*(self.alpha + self.gamma)) + cos(4*(self.alpha + self.gamma)) -
# 4*cos(2*(2*self.alpha + self.gamma)) + 24*cos((4*sin(self.gamma))/self.z) +
# 4*cos(2*self.alpha - (4*sin(self.gamma))/self.z) + 16*cos(2*self.gamma -
# (4*sin(self.gamma))/self.z) + 24*cos(4*self.gamma - (4*sin(self.gamma))/self.z) +
# 4*cos(2*self.alpha + 4*self.gamma - (4*sin(self.gamma))/self.z) -
# 8*cos(2*(self.alpha + self.gamma - (2*sin(self.gamma))/self.z)) +
# 4*cos(2*self.alpha + (4*sin(self.gamma))/self.z) + 4*cos(2*self.alpha -
# 4*self.gamma + (4*sin(self.gamma))/self.z) - 8*cos(2*self.alpha - 2*self.gamma +
# (4*sin(self.gamma))/self.z) + 32*sqrt(2)*sqrt(-(cos(self.alpha)**2*
# (-2 - 2*cos(2*self.alpha) + cos(2*(self.alpha - self.gamma)) -
# 2*cos(2*self.gamma) + cos(2*(self.alpha + self.gamma)) +
# 4*cos(2*self.gamma - (4*sin(self.gamma))/self.z))*cos(self.gamma - (2*sin(self.gamma))/self.z)**2*
# sin(2*self.gamma)**2)))/(-6 - 2*cos(2*self.alpha) + cos(2*(self.alpha - self.gamma)) -
# 2*cos(2*self.gamma) + cos(2*(self.alpha + self.gamma)))**2)/sqrt(2))
# sqrt((42 + 16*cos(2*self.pressure_angle) + 6*cos(4*self.pressure_angle) -
# 4*cos(4*self.pressure_angle - 2*self.pitch_angle) - 8*cos(2*(self.pressure_angle - self.pitch_angle)) +
# cos(4*(self.pressure_angle - self.pitch_angle)) + 24*cos(2*self.pitch_angle) - 2*cos(4*self.pitch_angle) -
# 8*cos(2*(self.pressure_angle + self.pitch_angle)) + cos(4*(self.pressure_angle + self.pitch_angle)) -
# 4*cos(2*(2*self.pressure_angle + self.pitch_angle)) + 24*cos((4*sin(self.pitch_angle))/self.z) +
# 4*cos(2*self.pressure_angle - (4*sin(self.pitch_angle))/self.z) + 16*cos(2*self.pitch_angle -
# (4*sin(self.pitch_angle))/self.z) + 24*cos(4*self.pitch_angle - (4*sin(self.pitch_angle))/self.z) +
# 4*cos(2*self.pressure_angle + 4*self.pitch_angle - (4*sin(self.pitch_angle))/self.z) -
# 8*cos(2*(self.pressure_angle + self.pitch_angle - (2*sin(self.pitch_angle))/self.z)) +
# 4*cos(2*self.pressure_angle + (4*sin(self.pitch_angle))/self.z) + 4*cos(2*self.pressure_angle -
# 4*self.pitch_angle + (4*sin(self.pitch_angle))/self.z) - 8*cos(2*self.pressure_angle - 2*self.pitch_angle +
# (4*sin(self.pitch_angle))/self.z) + 32*sqrt(2)*sqrt(-(cos(self.pressure_angle)**2*
# (-2 - 2*cos(2*self.pressure_angle) + cos(2*(self.pressure_angle - self.pitch_angle)) -
# 2*cos(2*self.pitch_angle) + cos(2*(self.pressure_angle + self.pitch_angle)) +
# 4*cos(2*self.pitch_angle - (4*sin(self.pitch_angle))/self.z))*cos(self.pitch_angle - (2*sin(self.pitch_angle))/self.z)**2*
# sin(2*self.pitch_angle)**2)))/(-6 - 2*cos(2*self.pressure_angle) + cos(2*(self.pressure_angle - self.pitch_angle)) -
# 2*cos(2*self.pitch_angle) + cos(2*(self.pressure_angle + self.pitch_angle)))**2)/sqrt(2))
def involute_function_x(self):
def func(s):
return((
-(cos(s*1/sin(self.alpha)*1/sin(self.gamma))*sin(self.alpha)*sin(s)) +
(cos(s)*sin(self.gamma) + cos(self.alpha)*cos(self.gamma)*sin(s))*
sin(s*1/sin(self.alpha)*1/sin(self.gamma))))
-(cos(s*1/sin(self.pressure_angle)*1/sin(self.pitch_angle))*sin(self.pressure_angle)*sin(s)) +
(cos(s)*sin(self.pitch_angle) + cos(self.pressure_angle)*cos(self.pitch_angle)*sin(s))*
sin(s*1/sin(self.pressure_angle)*1/sin(self.pitch_angle))))
return(func)
def involute_function_y(self):
def func(s):
return((
cos(s*1/sin(self.alpha)*1/sin(self.gamma))*(cos(s)*sin(self.gamma) +
cos(self.alpha)*cos(self.gamma)*sin(s)) + sin(self.alpha)*sin(s)*
sin(s*1/sin(self.alpha)*1/sin(self.gamma))))
cos(s*1/sin(self.pressure_angle)*1/sin(self.pitch_angle))*(cos(s)*sin(self.pitch_angle) +
cos(self.pressure_angle)*cos(self.pitch_angle)*sin(s)) + sin(self.pressure_angle)*sin(s)*
sin(s*1/sin(self.pressure_angle)*1/sin(self.pitch_angle))))
return(func)
def involute_function_z(self):
def func(s):
return((
cos(self.gamma)*cos(s) - cos(self.alpha)*sin(self.gamma)*sin(s)))
cos(self.pitch_angle)*cos(s) - cos(self.pressure_angle)*sin(self.pitch_angle)*sin(s)))
return(func)
def get_radius(self, s):
@@ -110,7 +110,6 @@ class bevel_tooth(object):
ry = y(s)
return(sqrt(rx**2 + ry**2))
def involute_points(self, num=10):
pts = linspace(self.involute_start, self.involute_end, num=num)
fx = self.involute_function_x()
@@ -127,7 +126,7 @@ class bevel_tooth(object):
r_cut = self.r_f / self.z_f
for i, point in enumerate(xy[1:]):
if point.dot(point) >= r_cut ** 2:
break;
break
if i > 0:
self.add_foot = False
intersection_point = intersection_line_circle(xy[i], point, r_cut)
@@ -138,7 +137,7 @@ class bevel_tooth(object):
return(xyz)
def points(self, num=10):
pts = self.involute_points(num = num)
pts = self.involute_points(num=num)
rot = rotation3D(-pi/self.z/2)
pts = rot(pts)
ref = reflection3D(pi/2)
@@ -153,17 +152,18 @@ class bevel_tooth(object):
[pts1[-2], pts1[-1]]
]))
else:
return(array([pts,[pts[-1],pts1[0]], pts1]))
return(array([pts, [pts[-1], pts1[0]], pts1]))
def _update(self):
self.__init__(z = self.z, clearence = self.clearence,
alpha = self.alpha, gamma = self.gamma, backlash = self.backlash, module = self.module)
self.__init__(z=self.z, clearance=self.clearance,
pressure_angle=self.pressure_angle,
pitch_angle=self.pitch_angle,
backlash=self.backlash, module=self.module)
if __name__ == "__main__":
from matplotlib import pyplot
gear = bevel_tooth(z=60, clearence=0.0, gamma=np.deg2rad(45))
gear = bevel_tooth(z=60, clearance=0.0, pitch_angle=np.deg2rad(45))
x, y, z = gear.involute_points().T
pyplot.plot(x, y)
pyplot.show()

View File

@@ -25,10 +25,10 @@ from numpy import cos, sin, arccos, pi, array, linspace, transpose, vstack
from _functions import rotation, reflection
class cycloide_tooth():
def __init__(self, z1 = 5, z2 = 5, z = 14, m = 5, clearence = 0.12, backlash = 0.00):
def __init__(self, z1 = 5, z2 = 5, z = 14, m = 5, clearance = 0.12, backlash = 0.00):
self.m = m
self.z = z
self.clearence = clearence
self.clearance = clearance
self.backlash = backlash
self.z1 = z1
self.z2 = z2
@@ -40,7 +40,7 @@ class cycloide_tooth():
self.phi = self.m * pi
self.d = self.z * self.m
self.da = self.d + 2*self.m
self.di = self.d - 2*self.m - self.clearence * self.m
self.di = self.d - 2*self.m - self.clearance * self.m
self.phipart = 2 * pi / self.z
def epicycloide_x(self):
@@ -103,7 +103,7 @@ class cycloide_tooth():
def _update(self):
self.__init__(m = self.m, z = self.z, z1 = self.z1, z2 = self.z2,
clearence = self.clearence, backlash = self.backlash)
clearance = self.clearance, backlash = self.backlash)
if __name__ == "__main__":
from matplotlib import pyplot

View File

@@ -25,27 +25,27 @@ from numpy.linalg import solve
import numpy as np
def reflection(alpha):
def reflection(pressure_angle):
mat = array(
[[cos(2 * alpha), -sin(2 * alpha)], [-sin(2 * alpha), -cos(2 * alpha)]])
[[cos(2 * pressure_angle), -sin(2 * pressure_angle)], [-sin(2 * pressure_angle), -cos(2 * pressure_angle)]])
def func(x):
return(dot(x, mat))
return(func)
def reflection3D(alpha):
mat = array([[cos(2 * alpha), -sin(2 * alpha), 0.],
[-sin(2 * alpha), -cos(2 * alpha), 0.], [0., 0., 1.]])
def reflection3D(pressure_angle):
mat = array([[cos(2 * pressure_angle), -sin(2 * pressure_angle), 0.],
[-sin(2 * pressure_angle), -cos(2 * pressure_angle), 0.], [0., 0., 1.]])
def func(x):
return(dot(x, mat))
return(func)
def rotation(alpha, midpoint=None):
def rotation(pressure_angle, midpoint=None):
midpoint = midpoint or [0, 0]
mat = array([[cos(alpha), -sin(alpha)], [sin(alpha), cos(alpha)]])
mat = array([[cos(pressure_angle), -sin(pressure_angle)], [sin(pressure_angle), cos(pressure_angle)]])
midpoint = array(midpoint)
vec = midpoint - dot(midpoint, mat)
trans = translation(vec)
@@ -55,11 +55,11 @@ def rotation(alpha, midpoint=None):
return(func)
def rotation3D(alpha):
def rotation3D(pressure_angle):
mat = array(
[
[cos(alpha), -sin(alpha), 0.],
[sin(alpha), cos(alpha), 0.],
[cos(pressure_angle), -sin(pressure_angle), 0.],
[sin(pressure_angle), cos(pressure_angle), 0.],
[0., 0., 1.]])
def func(xx):

View File

@@ -25,40 +25,40 @@ from _functions import nearestpts, rotation, reflection, trimfunc, norm, transla
import numpy as np
class involute_tooth():
def __init__(self, m=5, z=15, alpha=20 * pi / 180., clearence=0.12, shift=0.5, beta=0., undercut=False, backlash=0.00):
self.alpha = alpha
def __init__(self, m=5, z=15, pressure_angle=20 * pi / 180., clearance=0.12, shift=0.5, beta=0., undercut=False, backlash=0.00):
self.pressure_angle = pressure_angle
self.beta = beta
self.m_n = m
self.z = z
self.undercut = undercut
self.shift = shift
self.clearence = clearence
self.clearance = clearance
self.backlash = backlash
self._calc_gear_factors()
def _calc_gear_factors(self):
self.alpha_t = arctan(tan(self.alpha) / cos(self.beta))
self.pressure_angle_t = arctan(tan(self.pressure_angle) / cos(self.beta))
self.m = self.m_n / cos(self.beta)
self.c = self.clearence * self.m_n
self.c = self.clearance * self.m_n
self.midpoint = [0., 0.]
self.d = self.z * self.m
self.dw = self.m * self.z
self.da = self.dw + 2. * self.m_n + 2. * self.shift * self.m_n
self.df = self.dw - 2. * self.m_n - \
2 * self.c + 2. * self.shift * self.m_n
self.dg = self.d * cos(self.alpha_t)
self.dg = self.d * cos(self.pressure_angle_t)
self.phipart = 2 * pi / self.z
self.undercut_end = sqrt(-self.df ** 2 + self.da ** 2) / self.da
self.undercut_rot = (-self.df / self.dw * tan(arctan((2 * ((self.m * pi) / 4. -
(self.c + self.m_n) * tan(self.alpha_t))) / self.df)))
(self.c + self.m_n) * tan(self.pressure_angle_t))) / self.df)))
self.involute_end = sqrt(self.da ** 2 - self.dg ** 2) / self.dg
self.involute_rot1 = sqrt(-self.dg ** 2 + (self.dw) ** 2) / self.dg - arctan(
sqrt(-self.dg ** 2 + (self.dw) ** 2) / self.dg)
self.involute_rot2 = self.m / \
(self.d) * (pi / 2 + 2 * self.shift * tan(self.alpha_t))
self.involute_rot2 = 1 / self.z * (pi / 2 + 2 * self.shift * tan(self.alpha_t))
(self.d) * (pi / 2 + 2 * self.shift * tan(self.pressure_angle_t))
self.involute_rot2 = 1 / self.z * (pi / 2 + 2 * self.shift * tan(self.pressure_angle_t))
self.involute_rot = self.involute_rot1 + self.involute_rot2
self.involute_start = 0.
if self.dg <= self.df:
@@ -145,22 +145,22 @@ class involute_tooth():
def _update(self):
self.__init__(m = self.m_n, z = self.z,
alpha = self.alpha, clearence = self.clearence, shift = self.shift,
pressure_angle = self.pressure_angle, clearance = self.clearance, shift = self.shift,
beta = self.beta, undercut = self.undercut, backlash = self.backlash)
class involute_rack(object):
def __init__(self, m=5, z=15, alpha=20 * pi / 180., thickness=5):
self.alpha = alpha
def __init__(self, m=5, z=15, pressure_angle=20 * pi / 180., thickness=5):
self.pressure_angle = pressure_angle
self.thickness = thickness
self.m = m
self.z = z
def _update(self):
self.__init__(m = self.m, z = self.z, alpha = self.alpha, thickness = self.thickness)
self.__init__(m = self.m, z = self.z, pressure_angle = self.pressure_angle, thickness = self.thickness)
def points(self, num=10):
a = 2 * self.m * tan(self.alpha)
a = 2 * self.m * tan(self.pressure_angle)
b = ((self.m * pi) / 2 - a) / 2
tooth= [
[self.m, -a - b],