fix: Hirth joint mating line
This commit is contained in:
parent
a3f2b01b8c
commit
75c06585ed
|
@ -8,7 +8,8 @@ def hirth_joint(radius=60,
|
||||||
base_height=20,
|
base_height=20,
|
||||||
n_tooth=16,
|
n_tooth=16,
|
||||||
tooth_height=16,
|
tooth_height=16,
|
||||||
tooth_height_inner=2):
|
tooth_height_inner=2,
|
||||||
|
tol=0.01):
|
||||||
"""
|
"""
|
||||||
Creates a cylindrical Hirth Joint
|
Creates a cylindrical Hirth Joint
|
||||||
"""
|
"""
|
||||||
|
@ -26,14 +27,16 @@ def hirth_joint(radius=60,
|
||||||
# triangles.
|
# triangles.
|
||||||
outer = [
|
outer = [
|
||||||
(radius * math.tan(theta), 0),
|
(radius * math.tan(theta), 0),
|
||||||
|
(radius * math.tan(theta) - tol, 0),
|
||||||
(0, tooth_height),
|
(0, tooth_height),
|
||||||
|
(-radius * math.tan(theta) + tol, 0),
|
||||||
(-radius * math.tan(theta), 0),
|
(-radius * math.tan(theta), 0),
|
||||||
]
|
]
|
||||||
inner = [
|
inner = [
|
||||||
(radius_inner * math.sin(theta), 0),
|
(radius_inner * math.sin(theta), 0),
|
||||||
(radius_inner * math.sin(theta), inner_raise - tooth_height_inner / 2),
|
(radius_inner * math.sin(theta), inner_raise),
|
||||||
(0, inner_raise + tooth_height_inner / 2),
|
(0, inner_raise + tooth_height_inner),
|
||||||
(-radius_inner * math.sin(theta), inner_raise - tooth_height_inner / 2),
|
(-radius_inner * math.sin(theta), inner_raise),
|
||||||
(-radius_inner * math.sin(theta), 0),
|
(-radius_inner * math.sin(theta), 0),
|
||||||
]
|
]
|
||||||
tooth = (
|
tooth = (
|
||||||
|
@ -43,13 +46,13 @@ def hirth_joint(radius=60,
|
||||||
.workplane(offset=radius - radius_inner)
|
.workplane(offset=radius - radius_inner)
|
||||||
.polyline(outer)
|
.polyline(outer)
|
||||||
.close()
|
.close()
|
||||||
.loft(combine=True)
|
.loft(ruled=True, combine=True)
|
||||||
.val()
|
.val()
|
||||||
)
|
)
|
||||||
tooth_centre_radius = radius_inner * math.cos(theta)
|
tooth_centre_radius = radius_inner * math.cos(theta)
|
||||||
teeth = (
|
teeth = (
|
||||||
Cq.Workplane('XY')
|
Cq.Workplane('XY')
|
||||||
.polarArray(radius=radius_inner, startAngle=0, angle=360, count=n_tooth)
|
.polarArray(radius=tooth_centre_radius, startAngle=0, angle=360, count=n_tooth)
|
||||||
.eachpoint(lambda loc: tooth.located(loc))
|
.eachpoint(lambda loc: tooth.located(loc))
|
||||||
.intersect(Cq.Solid.makeCylinder(
|
.intersect(Cq.Solid.makeCylinder(
|
||||||
height=base_height + tooth_height,
|
height=base_height + tooth_height,
|
||||||
|
@ -67,7 +70,7 @@ def hirth_joint(radius=60,
|
||||||
.clean()
|
.clean()
|
||||||
)
|
)
|
||||||
#base.workplane(offset=tooth_height/2).circle(radius=radius,forConstruction=True).tag("mate")
|
#base.workplane(offset=tooth_height/2).circle(radius=radius,forConstruction=True).tag("mate")
|
||||||
base.polyline([(0, 0, 0), (0, 0, 1)], forConstruction=True).tag("mate")
|
base.polyline([(0, 0, base_height), (0, 0, base_height+tooth_height)], forConstruction=True).tag("mate")
|
||||||
return base
|
return base
|
||||||
|
|
||||||
def hirth_assembly():
|
def hirth_assembly():
|
||||||
|
@ -90,8 +93,8 @@ def hirth_assembly():
|
||||||
result = (
|
result = (
|
||||||
Cq.Assembly()
|
Cq.Assembly()
|
||||||
.add(obj1, name="obj1", color=Cq.Color(0.8,0.8,0.5,0.3))
|
.add(obj1, name="obj1", color=Cq.Color(0.8,0.8,0.5,0.3))
|
||||||
.add(obj2, name="obj2", color=Cq.Color(0.5,0.5,0.5,0.3), loc=Cq.Location((0,0,80)))
|
.add(obj2, name="obj2", color=Cq.Color(0.5,0.5,0.5,0.3))
|
||||||
.constrain("obj1?mate", "obj2?mate", "Axis")
|
.constrain("obj1?mate", "obj2?mate", "Plane")
|
||||||
.solve()
|
.solve()
|
||||||
)
|
)
|
||||||
return result
|
return result
|
||||||
|
|
Loading…
Reference in New Issue