Use jute rope for handle

This commit is contained in:
Leni Aniva 2025-05-30 23:07:25 -07:00
parent c8bbc0de91
commit d6ccc3496b
Signed by: aniva
GPG Key ID: D5F96287843E8DFB
1 changed files with 37 additions and 28 deletions
nhf/touhou/yasaka_kanako

View File

@ -310,8 +310,9 @@ class Onbashira(Model):
rotor_spacer_outer_diam: float = 12.0
handle_base_height: float = 10.0
handle_thickness: float = 17.0
handle_length: float = 140.0
handle_thickness_x: float = 20.0
handle_thickness_y: float = 10.0
handle_radius: float = 20.0
handle_height: float = 50.0
motor: Motor = Motor()
@ -2184,7 +2185,7 @@ class Onbashira(Model):
@target(name="handle")
def handle(self) -> Cq.Workplane:
w = self.side_width + self.angle_joint_extra_width
w = self.side_width * 0.7
base = (
Cq.Workplane(
origin=(0, 0, -self.handle_base_height)
@ -2198,7 +2199,7 @@ class Onbashira(Model):
.faces(">Z")
.workplane()
.pushPoints([
(x * sx, y * sy)
(x * sx, (y + self.angle_joint_gap/2) * sy)
for (x, y) in self.angle_joint_bolt_position
for sx in (-1, 1)
for sy in (-1, 1)
@ -2210,30 +2211,19 @@ class Onbashira(Model):
depth=None,
)
)
dx = self.handle_length / 2 - self.handle_thickness / 2
assert self.handle_length < w
z = self.handle_height - self.handle_thickness / 2
handle = Cq.Solid.makeCylinder(
radius=self.handle_thickness/2,
height=dx * 2,
pnt=(-dx, 0, z),
dir=(1, 0, 0),
# Construct the handle
bar = (
Cq.Workplane(origin=(0, self.handle_radius, 0))
.rect(self.handle_thickness_x, self.handle_thickness_y)
.revolve(180, (0, -self.handle_radius, 0), (1, -self.handle_radius, 0))
)
pillar = Cq.Solid.makeCylinder(
radius=self.handle_thickness/2,
height=z,
)
joint = Cq.Solid.makeSphere(radius=self.handle_thickness/2)
result = (
base +
handle +
pillar.moved(dx, 0, 0) +
pillar.moved(-dx, 0, 0) +
joint.moved(dx, 0, z) +
joint.moved(-dx, 0, z)
bar
)
t = self.handle_base_height
for i, (x, y) in enumerate(self.angle_joint_bolt_position):
for i, (x, yi) in enumerate(self.angle_joint_bolt_position):
y = yi + self.angle_joint_gap/2
result.tagAbsolute(f"holeLPO{i}", (+x, y, 0), direction="+Z")
result.tagAbsolute(f"holeLSO{i}", (-x, y, 0), direction="+Z")
result.tagAbsolute(f"holeLPI{i}", (+x, y, -t), direction="-Z")
@ -2268,22 +2258,41 @@ class Onbashira(Model):
self.assembly_ring(self.angle_joint()),
name="ring2",
)
name_handle1 = "handle2_1"
a = a.addS(
self.handle(),
name="handle",
name=name_handle1,
material=self.material_brace,
role=Role.HANDLE,
)
name_handle2 = "handle2_2"
a = a.addS(
self.handle(),
name=name_handle2,
material=self.material_brace,
role=Role.HANDLE,
)
# Handle constrain
for ih, (x, y) in enumerate(self.angle_joint_bolt_position):
a = a.constrain(
f"handle?holeLPI{ih}",
f"ring2/side0?holeLPO{ih}",
f"{name_handle1}?holeLPI{ih}",
f"ring2/side2?holeLPO{ih}",
"Plane",
)
a = a.constrain(
f"handle?holeRPI{ih}",
f"ring2/side0?holeRPO{ih}",
f"{name_handle1}?holeRPI{ih}",
f"ring2/side2?holeRPO{ih}",
"Plane",
)
a = a.constrain(
f"{name_handle2}?holeLPI{ih}",
f"ring2/side4?holeLPO{ih}",
"Plane",
)
a = a.constrain(
f"{name_handle2}?holeRPI{ih}",
f"ring2/side4?holeRPO{ih}",
"Plane",
)
if has_part(parts, "section3"):