fix: Housing wall location

This commit is contained in:
Leni Aniva 2024-07-17 14:47:22 -07:00
parent bbe24091da
commit eb445b3d8b
Signed by: aniva
GPG Key ID: 4D9B1C8D10EA4C50
2 changed files with 38 additions and 22 deletions

View File

@ -326,8 +326,8 @@ class DiskJoint(Model):
radius_disk: float = 20.0
radius_axle: float = 3.0
housing_thickness: float = 5.0
disk_thickness: float = 5.0
housing_thickness: float = 4.0
disk_thickness: float = 7.0
# Gap between disk and the housing
#disk_thickness_gap: float = 0.1
@ -382,9 +382,8 @@ class DiskJoint(Model):
"""
return self.total_thickness / 2 - self.housing_thickness
@target(name="disk")
def disk(self) -> Cq.Workplane:
cut = (
def _disk_cut(self) -> Cq.Workplane:
return (
Cq.Solid.makeBox(
length=self.spring.tail_length,
width=self.spring.thickness,
@ -393,6 +392,9 @@ class DiskJoint(Model):
.located(Cq.Location((0, self.spring.radius_inner, 0)))
.rotate((0, 0, 0), (0, 0, 1), self.spring_slot_offset)
)
@target(name="disk")
def disk(self) -> Cq.Workplane:
radius_tongue = self.radius_disk + self.tongue_length
tongue = (
Cq.Solid.makeCylinder(
@ -419,7 +421,7 @@ class DiskJoint(Model):
centered=(True, True, False),
combine='cut',
)
.cut(cut)
.cut(self._disk_cut())
)
plane = result.copyWorkplane(Cq.Workplane('XY'))
theta = math.radians(self.spring_slot_offset)
@ -460,7 +462,7 @@ class DiskJoint(Model):
result = result.cut(
self
.wall()
.located(Cq.Location((0, 0, self.disk_thickness - self.wall_inset)))
.located(Cq.Location((0, 0, self.housing_thickness - self.wall_inset)))
#.rotate((0, 0, 0), (1, 0, 0), 180)
#.located(Cq.Location((0, 0, self.disk_thickness + self.housing_thickness)))
)
@ -512,8 +514,8 @@ class DiskJoint(Model):
)
result = (
result
.cut(carve.located(Cq.Location((0, 0, -self.housing_upper_carve_offset))))
.union(wall, tol=TOL)
.cut(carve.located(Cq.Location((0, 0, -self.housing_upper_carve_offset))))
)
return result.clean()
@ -597,7 +599,7 @@ class ElbowJoint(Model):
lip_thickness: float = 5.0
lip_length: float = 60.0
hole_pos: list[float] = field(default_factory=lambda: [15, 25])
parent_arm_span: float = 30.0
parent_arm_width: float = 10.0
# Angle of the beginning of the parent arm
parent_arm_angle: float = 180.0
@ -612,7 +614,6 @@ class ElbowJoint(Model):
assert self.child_arm_radius > self.disk_joint.radius_housing
assert self.parent_arm_radius > self.disk_joint.radius_housing
self.disk_joint.tongue_length = self.child_arm_radius - self.disk_joint.radius_disk - self.lip_thickness / 2
assert self.disk_joint.movement_angle < self.parent_arm_angle < 360 - self.parent_arm_span
def lip(self) -> Cq.Workplane:
holes = [
@ -642,14 +643,18 @@ class ElbowJoint(Model):
flip_x = Cq.Location((0, 0, 0), (1, 0, 0), 180)
flip_z = Cq.Location((0, 0, 0), (0, 0, 1), 180)
lip_dz = self.lip_thickness
result = (
Cq.Assembly()
.add(self.lip(), name="lip", loc=
loc_lip = (
Cq.Location((0, 0, 0), (0, 1, 0), 180) *
Cq.Location((-lip_dz, 0, 0), (1, 0, 0), 90) *
Cq.Location((0, 0, 0), (0, 1, 0), 90))
.add(self.disk_joint.disk(), name="disk",
loc=flip_x * flip_z * Cq.Location((-self.child_arm_radius, 0, -dz), (0, 0, 1), angle))
Cq.Location((0, 0, 0), (0, 1, 0), 90)
)
loc_disk = flip_x * flip_z * Cq.Location((-self.child_arm_radius, 0, -dz), (0, 0, 1), angle)
disk_cut = self.disk_joint._disk_cut().located(
loc_lip.inverse * Cq.Location((0, self.disk_joint.spring.radius_inner, 0)) * loc_disk)
result = (
Cq.Assembly()
.add(self.lip().cut(disk_cut), name="lip", loc=loc_lip)
.add(self.disk_joint.disk(), name="disk", loc=loc_disk)
)
return result
@ -661,18 +666,25 @@ class ElbowJoint(Model):
def parent_joint_upper(self):
axial_offset = Cq.Location((self.parent_arm_radius, 0, 0))
housing_dz = self.disk_joint.housing_upper_dz
conn_h = self.lip_thickness
conn_h = self.disk_joint.total_thickness
conn_w = self.parent_arm_width
connector = (
Cq.Solid.makeCylinder(
Cq.Solid.makeBox(
length=self.parent_arm_radius,
width=conn_w,
height=conn_h,
radius=self.parent_arm_radius - self.lip_thickness / 2,
angleDegrees=self.parent_arm_span)
).located(Cq.Location((0, -conn_w/2, 0)))
#Cq.Solid.makeCylinder(
# height=conn_h,
# radius=self.parent_arm_radius - self.lip_thickness / 2,
# angleDegrees=self.parent_arm_span)
.cut(Cq.Solid.makeCylinder(
height=conn_h,
radius=self.disk_joint.radius_housing,
))
.located(Cq.Location((0, 0, -conn_h / 2)))
.rotate((0,0,0), (0,0,1), 180-self.parent_arm_span / 2)
.rotate((0,0,0), (0,0,1), 180)
#.rotate((0,0,0), (0,0,1), 180-self.parent_arm_span / 2)
)
housing = self.disk_joint.housing_upper()
housing_loc = Cq.Location(

View File

@ -50,6 +50,7 @@ class WingProfile(Model):
disk_joint=DiskJoint(
movement_angle=55,
),
hole_diam=6.0,
))
# Distance between the two spacers on the elbow, halved
elbow_h2: float = 5.0
@ -62,8 +63,11 @@ class WingProfile(Model):
radius_disk=13.0,
radius_housing=15.0,
),
child_arm_radius=20.0,
hole_pos=[10, 20],
lip_length=50,
child_arm_radius=23.0,
parent_arm_radius=30.0,
hole_diam=4.0,
))
# Distance between the two spacers on the elbow, halved
wrist_h2: float = 5.0