2024-06-24 16:13:15 -07:00
|
|
|
"""
|
2024-07-03 23:15:39 -07:00
|
|
|
To build, execute
|
|
|
|
```
|
|
|
|
python3 nhf/touhou/houjuu_nue/__init__.py
|
|
|
|
```
|
|
|
|
|
2024-06-24 16:13:15 -07:00
|
|
|
This cosplay consists of 3 components:
|
|
|
|
|
|
|
|
## Trident
|
|
|
|
|
|
|
|
The trident is composed of individual segments, made of acrylic, and a 3D
|
|
|
|
printed head (convention rule prohibits metal) with a metallic paint. To ease
|
|
|
|
transportation, the trident handle has individual segments with threads and can
|
|
|
|
be assembled on site.
|
|
|
|
|
|
|
|
## Snake
|
|
|
|
|
|
|
|
A 3D printed snake with a soft material so it can wrap around and bend
|
|
|
|
|
|
|
|
## Wings
|
|
|
|
|
|
|
|
This is the crux of the cosplay and the most complex component. The wings mount
|
|
|
|
on a wearable harness. Each wing consists of 4 segments with 3 joints. Parts of
|
|
|
|
the wing which demands transluscency are created from 1/16" acrylic panels.
|
|
|
|
These panels serve double duty as the exoskeleton.
|
|
|
|
|
|
|
|
The wings are labeled r1,r2,r3,l1,l2,l3. The segments of the wings are labeled
|
2024-06-25 06:11:48 -07:00
|
|
|
from root to tip s0 (root),
|
|
|
|
s1, s2, s3. The joints are named (from root to tip)
|
2024-06-24 16:13:15 -07:00
|
|
|
shoulder, elbow, wrist in analogy with human anatomy.
|
|
|
|
"""
|
2024-07-03 18:45:16 -07:00
|
|
|
from dataclasses import dataclass, field
|
2024-06-20 23:29:18 -07:00
|
|
|
import cadquery as Cq
|
2024-07-04 12:03:38 -07:00
|
|
|
from nhf import Material, Role
|
2024-07-07 21:45:10 -07:00
|
|
|
from nhf.build import Model, TargetKind, target, assembly
|
2024-07-06 16:41:13 -07:00
|
|
|
from nhf.parts.joints import HirthJoint, TorsionJoint
|
2024-07-09 22:09:16 -07:00
|
|
|
from nhf.parts.handle import Handle, BayonetMount
|
2024-06-24 16:13:15 -07:00
|
|
|
import nhf.touhou.houjuu_nue.wing as MW
|
2024-06-25 06:11:48 -07:00
|
|
|
import nhf.touhou.houjuu_nue.trident as MT
|
2024-07-12 23:16:04 -07:00
|
|
|
import nhf.touhou.houjuu_nue.joints as MJ
|
2024-07-06 16:41:13 -07:00
|
|
|
import nhf.utils
|
2024-06-19 15:54:09 -07:00
|
|
|
|
2024-06-28 20:07:37 -07:00
|
|
|
@dataclass
|
2024-07-03 23:15:39 -07:00
|
|
|
class Parameters(Model):
|
2024-06-19 21:23:41 -07:00
|
|
|
"""
|
2024-06-24 16:13:15 -07:00
|
|
|
Defines dimensions for the Houjuu Nue cosplay
|
2024-06-19 21:23:41 -07:00
|
|
|
"""
|
2024-06-24 16:13:15 -07:00
|
|
|
|
|
|
|
# Thickness of the exoskeleton panel in millimetres
|
2024-06-19 21:23:41 -07:00
|
|
|
panel_thickness: float = 25.4 / 16
|
|
|
|
|
2024-06-23 22:27:15 -07:00
|
|
|
# Harness
|
|
|
|
harness_thickness: float = 25.4 / 8
|
2024-06-28 20:07:37 -07:00
|
|
|
harness_width: float = 300
|
|
|
|
harness_height: float = 400
|
|
|
|
harness_fillet: float = 10
|
2024-06-23 22:27:15 -07:00
|
|
|
|
2024-07-03 18:45:16 -07:00
|
|
|
harness_wing_base_pos: list[tuple[str, float, float]] = field(default_factory=lambda: [
|
2024-06-23 22:27:15 -07:00
|
|
|
("r1", 70, 150),
|
|
|
|
("l1", -70, 150),
|
|
|
|
("r2", 100, 0),
|
|
|
|
("l2", -100, 0),
|
|
|
|
("r3", 70, -150),
|
|
|
|
("l3", -70, -150),
|
2024-07-03 18:45:16 -07:00
|
|
|
])
|
2024-06-23 22:27:15 -07:00
|
|
|
|
|
|
|
# Holes drilled onto harness for attachment with HS joint
|
2024-07-03 18:45:16 -07:00
|
|
|
harness_to_root_conn_diam: float = 6
|
2024-06-23 22:27:15 -07:00
|
|
|
|
2024-07-03 18:45:16 -07:00
|
|
|
hs_hirth_joint: HirthJoint = field(default_factory=lambda: HirthJoint(
|
2024-06-28 20:07:37 -07:00
|
|
|
radius=30,
|
|
|
|
radius_inner=20,
|
|
|
|
tooth_height=10,
|
|
|
|
base_height=5
|
2024-07-03 18:45:16 -07:00
|
|
|
))
|
2024-06-28 20:07:37 -07:00
|
|
|
|
2024-06-19 21:23:41 -07:00
|
|
|
# Wing root properties
|
2024-06-24 16:13:15 -07:00
|
|
|
#
|
|
|
|
# The Houjuu-Scarlett joint mechanism at the base of the wing
|
2024-06-28 20:07:37 -07:00
|
|
|
hs_joint_base_width: float = 85
|
|
|
|
hs_joint_base_thickness: float = 10
|
|
|
|
hs_joint_corner_fillet: float = 5
|
|
|
|
hs_joint_corner_cbore_diam: float = 12
|
|
|
|
hs_joint_corner_cbore_depth: float = 2
|
|
|
|
hs_joint_corner_inset: float = 12
|
2024-06-24 11:05:03 -07:00
|
|
|
|
2024-06-28 20:07:37 -07:00
|
|
|
hs_joint_axis_diam: float = 12
|
|
|
|
hs_joint_axis_cbore_diam: float = 20
|
|
|
|
hs_joint_axis_cbore_depth: float = 3
|
2024-06-24 11:05:03 -07:00
|
|
|
|
2024-07-09 19:57:54 -07:00
|
|
|
wing_profile: MW.WingProfile = field(default_factory=lambda: MW.WingProfile(
|
2024-07-12 23:16:04 -07:00
|
|
|
shoulder_height=100.0,
|
|
|
|
elbow_height=110.0,
|
2024-07-09 19:57:54 -07:00
|
|
|
))
|
|
|
|
|
2024-06-24 16:13:15 -07:00
|
|
|
# Exterior radius of the wing root assembly
|
2024-06-28 20:07:37 -07:00
|
|
|
wing_root_radius: float = 40
|
2024-07-06 16:41:13 -07:00
|
|
|
wing_root_wall_thickness: float = 8
|
|
|
|
|
2024-07-12 23:16:04 -07:00
|
|
|
shoulder_joint: MJ.ShoulderJoint = field(default_factory=lambda: MJ.ShoulderJoint(
|
|
|
|
shoulder_height=100.0,
|
|
|
|
))
|
|
|
|
elbow_joint: MJ.ElbowJoint = field(default_factory=lambda: MJ.ElbowJoint(
|
|
|
|
))
|
|
|
|
wrist_joint: MJ.ElbowJoint = field(default_factory=lambda: MJ.ElbowJoint(
|
2024-07-06 16:41:13 -07:00
|
|
|
))
|
2024-06-19 21:23:41 -07:00
|
|
|
|
2024-06-20 23:29:18 -07:00
|
|
|
"""
|
2024-07-07 21:01:40 -07:00
|
|
|
Heights for various wing joints, where the numbers start from the first
|
|
|
|
joint.
|
2024-06-20 23:29:18 -07:00
|
|
|
"""
|
2024-07-07 12:15:47 -07:00
|
|
|
wing_s0_thickness: float = 40
|
2024-07-07 21:01:40 -07:00
|
|
|
|
|
|
|
# Length of the spacer
|
|
|
|
wing_s1_thickness: float = 20
|
|
|
|
wing_s1_spacer_thickness: float = 25.4 / 8
|
|
|
|
wing_s1_spacer_width: float = 20
|
2024-07-08 21:46:35 -07:00
|
|
|
wing_s1_spacer_hole_diam: float = 8
|
|
|
|
wing_s1_shoulder_spacer_hole_dist: float = 20
|
|
|
|
wing_s1_shoulder_spacer_width: float = 60
|
2024-06-20 23:29:18 -07:00
|
|
|
|
2024-07-03 18:45:16 -07:00
|
|
|
trident_handle: Handle = field(default_factory=lambda: Handle(
|
2024-06-26 08:28:25 -07:00
|
|
|
diam=38,
|
2024-07-01 17:59:42 -07:00
|
|
|
diam_inner=38-2 * 25.4/8,
|
2024-06-26 08:28:25 -07:00
|
|
|
diam_connector_internal=18,
|
|
|
|
simplify_geometry=False,
|
2024-07-09 22:09:16 -07:00
|
|
|
mount=BayonetMount(n_pin=3),
|
2024-07-03 18:45:16 -07:00
|
|
|
))
|
2024-07-10 16:20:33 -07:00
|
|
|
trident_terminal_height: float = 80
|
|
|
|
trident_terminal_hole_diam: float = 24
|
|
|
|
trident_terminal_bottom_thickness: float = 10
|
2024-06-25 06:11:48 -07:00
|
|
|
|
2024-07-07 21:01:40 -07:00
|
|
|
material_panel: Material = Material.ACRYLIC_TRANSPARENT
|
|
|
|
material_bracket: Material = Material.ACRYLIC_TRANSPARENT
|
|
|
|
|
2024-06-24 16:13:15 -07:00
|
|
|
def __post_init__(self):
|
2024-07-04 10:02:58 -07:00
|
|
|
super().__init__(name="houjuu-nue")
|
2024-06-28 20:07:37 -07:00
|
|
|
assert self.wing_root_radius > self.hs_hirth_joint.radius,\
|
2024-06-24 16:13:15 -07:00
|
|
|
"Wing root must be large enough to accomodate joint"
|
2024-07-08 21:46:35 -07:00
|
|
|
assert self.wing_s1_shoulder_spacer_hole_dist > self.wing_s1_spacer_hole_diam, \
|
|
|
|
"Spacer holes are too close to each other"
|
2024-06-24 16:13:15 -07:00
|
|
|
|
2024-07-04 01:13:22 -07:00
|
|
|
@target(name="trident/handle-connector")
|
|
|
|
def handle_connector(self):
|
|
|
|
return self.trident_handle.connector()
|
|
|
|
@target(name="trident/handle-insertion")
|
|
|
|
def handle_insertion(self):
|
|
|
|
return self.trident_handle.insertion()
|
2024-07-09 22:22:48 -07:00
|
|
|
@target(name="trident/proto-handle-connector", prototype=True)
|
|
|
|
def proto_handle_connector(self):
|
2024-07-09 22:09:16 -07:00
|
|
|
return self.trident_handle.one_side_connector(height=15)
|
|
|
|
@target(name="trident/handle-terminal-connector")
|
|
|
|
def handle_terminal_connector(self):
|
2024-07-10 16:20:33 -07:00
|
|
|
result = self.trident_handle.one_side_connector(height=self.trident_terminal_height)
|
|
|
|
#result.faces("<Z").circle(radius=25/2).cutThruAll()
|
|
|
|
h = self.trident_terminal_height + self.trident_handle.insertion_length - self.trident_terminal_bottom_thickness
|
|
|
|
result = result.faces(">Z").hole(self.trident_terminal_hole_diam, depth=h)
|
|
|
|
return result
|
2024-07-04 01:13:22 -07:00
|
|
|
|
2024-06-22 13:40:06 -07:00
|
|
|
|
2024-06-23 22:27:15 -07:00
|
|
|
def harness_profile(self) -> Cq.Sketch:
|
|
|
|
"""
|
|
|
|
Creates the harness shape
|
|
|
|
"""
|
|
|
|
w, h = self.harness_width / 2, self.harness_height / 2
|
|
|
|
sketch = (
|
|
|
|
Cq.Sketch()
|
|
|
|
.polygon([
|
|
|
|
(0.7 * w, h),
|
|
|
|
(w, 0),
|
|
|
|
(0.7 * w, -h),
|
|
|
|
(0.7 * -w, -h),
|
|
|
|
(-w, 0),
|
|
|
|
(0.7 * -w, h),
|
|
|
|
])
|
|
|
|
#.rect(self.harness_width, self.harness_height)
|
|
|
|
.vertices()
|
|
|
|
.fillet(self.harness_fillet)
|
|
|
|
)
|
|
|
|
for tag, x, y in self.harness_wing_base_pos:
|
|
|
|
conn = [(px + x, py + y) for px, py in self.hs_joint_harness_conn()]
|
|
|
|
sketch = (
|
|
|
|
sketch
|
|
|
|
.push(conn)
|
|
|
|
.tag(tag)
|
2024-06-24 16:13:15 -07:00
|
|
|
.circle(self.harness_to_root_conn_diam / 2, mode='s')
|
2024-06-23 22:27:15 -07:00
|
|
|
.reset()
|
|
|
|
)
|
|
|
|
return sketch
|
|
|
|
|
2024-07-04 01:11:16 -07:00
|
|
|
@target(name="harness", kind=TargetKind.DXF)
|
2024-06-23 22:27:15 -07:00
|
|
|
def harness(self) -> Cq.Shape:
|
|
|
|
"""
|
|
|
|
Creates the harness shape
|
|
|
|
"""
|
|
|
|
result = (
|
|
|
|
Cq.Workplane('XZ')
|
|
|
|
.placeSketch(self.harness_profile())
|
|
|
|
.extrude(self.harness_thickness)
|
|
|
|
)
|
|
|
|
result.faces(">Y").tag("mount")
|
|
|
|
plane = result.faces(">Y").workplane()
|
|
|
|
for tag, x, y in self.harness_wing_base_pos:
|
2024-07-06 16:41:13 -07:00
|
|
|
conn = [(px + x, py + y) for px, py
|
|
|
|
in self.hs_joint_harness_conn()]
|
2024-06-23 22:27:15 -07:00
|
|
|
for i, (px, py) in enumerate(conn):
|
|
|
|
(
|
|
|
|
plane
|
|
|
|
.moveTo(px, py)
|
|
|
|
.circle(1, forConstruction='True')
|
|
|
|
.edges()
|
|
|
|
.tag(f"{tag}_{i}")
|
|
|
|
)
|
|
|
|
return result
|
|
|
|
|
|
|
|
def hs_joint_harness_conn(self) -> list[tuple[int, int]]:
|
|
|
|
"""
|
|
|
|
Generates a set of points corresponding to the connectorss
|
|
|
|
"""
|
|
|
|
dx = self.hs_joint_base_width / 2 - self.hs_joint_corner_inset
|
|
|
|
return [
|
|
|
|
(dx, dx),
|
|
|
|
(dx, -dx),
|
|
|
|
(-dx, -dx),
|
|
|
|
(-dx, dx),
|
|
|
|
]
|
|
|
|
|
2024-07-03 23:15:39 -07:00
|
|
|
@target(name="hs_joint_parent")
|
2024-06-22 13:40:06 -07:00
|
|
|
def hs_joint_parent(self):
|
|
|
|
"""
|
|
|
|
Parent part of the Houjuu-Scarlett joint, which is composed of a Hirth
|
|
|
|
coupling, a cylindrical base, and a mounting base.
|
|
|
|
"""
|
2024-06-28 20:07:37 -07:00
|
|
|
hirth = self.hs_hirth_joint.generate()
|
2024-06-23 22:27:15 -07:00
|
|
|
conn = self.hs_joint_harness_conn()
|
2024-06-22 13:40:06 -07:00
|
|
|
result = (
|
|
|
|
Cq.Workplane('XY')
|
|
|
|
.box(
|
|
|
|
self.hs_joint_base_width,
|
|
|
|
self.hs_joint_base_width,
|
|
|
|
self.hs_joint_base_thickness,
|
|
|
|
centered=(True, True, False))
|
2024-07-04 12:03:38 -07:00
|
|
|
.translate((0, 0, -self.hs_joint_base_thickness))
|
2024-06-22 13:40:06 -07:00
|
|
|
.edges("|Z")
|
|
|
|
.fillet(self.hs_joint_corner_fillet)
|
|
|
|
.faces(">Z")
|
|
|
|
.workplane()
|
2024-06-23 22:27:15 -07:00
|
|
|
.pushPoints(conn)
|
2024-06-22 13:40:06 -07:00
|
|
|
.cboreHole(
|
2024-06-24 16:13:15 -07:00
|
|
|
diameter=self.harness_to_root_conn_diam,
|
2024-06-22 13:40:06 -07:00
|
|
|
cboreDiameter=self.hs_joint_corner_cbore_diam,
|
|
|
|
cboreDepth=self.hs_joint_corner_cbore_depth)
|
2024-06-23 22:27:15 -07:00
|
|
|
)
|
2024-07-04 12:03:38 -07:00
|
|
|
# Creates a plane parallel to the holes but shifted to the base
|
2024-06-23 22:27:15 -07:00
|
|
|
plane = result.faces(">Z").workplane(offset=-self.hs_joint_base_thickness)
|
2024-07-04 12:03:38 -07:00
|
|
|
|
2024-06-23 22:27:15 -07:00
|
|
|
for i, (px, py) in enumerate(conn):
|
|
|
|
(
|
|
|
|
plane
|
2024-07-04 12:03:38 -07:00
|
|
|
.pushPoints([(px, py)])
|
2024-06-23 22:27:15 -07:00
|
|
|
.circle(1, forConstruction='True')
|
|
|
|
.edges()
|
|
|
|
.tag(f"h{i}")
|
|
|
|
)
|
|
|
|
result = (
|
|
|
|
result
|
2024-06-22 13:40:06 -07:00
|
|
|
.faces(">Z")
|
|
|
|
.workplane()
|
2024-07-04 12:03:38 -07:00
|
|
|
.union(hirth, tol=0.1)
|
2024-06-22 13:40:06 -07:00
|
|
|
.clean()
|
|
|
|
)
|
2024-06-24 11:05:03 -07:00
|
|
|
result = (
|
|
|
|
result.faces("<Z")
|
|
|
|
.workplane()
|
|
|
|
.cboreHole(
|
|
|
|
diameter=self.hs_joint_axis_diam,
|
|
|
|
cboreDiameter=self.hs_joint_axis_cbore_diam,
|
|
|
|
cboreDepth=self.hs_joint_axis_cbore_depth,
|
|
|
|
)
|
|
|
|
.clean()
|
|
|
|
)
|
2024-06-23 22:27:15 -07:00
|
|
|
result.faces("<Z").tag("base")
|
2024-06-22 13:40:06 -07:00
|
|
|
return result
|
|
|
|
|
2024-07-07 21:45:10 -07:00
|
|
|
@assembly()
|
|
|
|
def harness_assembly(self) -> Cq.Assembly:
|
|
|
|
harness = self.harness()
|
|
|
|
result = (
|
|
|
|
Cq.Assembly()
|
|
|
|
.add(harness, name="base", color=Material.WOOD_BIRCH.color)
|
|
|
|
.constrain("base", "Fixed")
|
|
|
|
)
|
|
|
|
for name in ["l1", "l2", "l3", "r1", "r2", "r3"]:
|
|
|
|
j = self.hs_joint_parent()
|
|
|
|
(
|
|
|
|
result
|
|
|
|
.add(j, name=name, color=Role.PARENT.color)
|
|
|
|
.constrain("base?mount", f"{name}?base", "Axis")
|
|
|
|
)
|
|
|
|
for i in range(4):
|
|
|
|
result.constrain(f"base?{name}_{i}", f"{name}?h{i}", "Point")
|
|
|
|
result.solve()
|
|
|
|
return result
|
|
|
|
|
2024-07-07 21:01:40 -07:00
|
|
|
#@target(name="wing/joining-plate", kind=TargetKind.DXF)
|
|
|
|
#def joining_plate(self) -> Cq.Workplane:
|
|
|
|
# return self.wing_joining_plate.plate()
|
|
|
|
|
2024-07-09 22:22:48 -07:00
|
|
|
@target(name="wing/root")
|
2024-07-04 01:11:16 -07:00
|
|
|
def wing_root(self) -> Cq.Assembly:
|
2024-06-28 20:07:37 -07:00
|
|
|
"""
|
|
|
|
Generate the wing root which contains a Hirth joint at its base and a
|
|
|
|
rectangular opening on its side, with the necessary interfaces.
|
|
|
|
"""
|
2024-07-06 16:41:13 -07:00
|
|
|
return MW.wing_root(
|
|
|
|
joint=self.hs_hirth_joint,
|
2024-07-12 23:16:04 -07:00
|
|
|
shoulder_attach_dist=self.shoulder_joint.attach_dist,
|
|
|
|
shoulder_attach_diam=self.shoulder_joint.attach_diam,
|
2024-07-06 16:41:13 -07:00
|
|
|
wall_thickness=self.wing_root_wall_thickness,
|
2024-07-09 21:13:16 -07:00
|
|
|
conn_height=self.wing_profile.shoulder_height,
|
2024-07-07 12:15:47 -07:00
|
|
|
conn_thickness=self.wing_s0_thickness,
|
2024-07-06 16:41:13 -07:00
|
|
|
)
|
|
|
|
|
2024-07-09 22:22:48 -07:00
|
|
|
@target(name="wing/proto-shoulder-joint-parent", prototype=True)
|
|
|
|
def proto_shoulder_joint_parent(self):
|
2024-07-12 23:16:04 -07:00
|
|
|
return self.shoulder_joint.torsion_joint.track()
|
2024-07-09 22:22:48 -07:00
|
|
|
@target(name="wing/proto-shoulder-joint-child", prototype=True)
|
|
|
|
def proto_shoulder_joint_child(self):
|
2024-07-12 23:16:04 -07:00
|
|
|
return self.shoulder_joint.torsion_joint.rider()
|
2024-07-08 21:46:35 -07:00
|
|
|
@assembly()
|
2024-07-12 23:16:04 -07:00
|
|
|
def shoulder_assembly(self):
|
|
|
|
return self.shoulder_joint.assembly(
|
|
|
|
wing_root_wall_thickness=self.wing_root_wall_thickness,
|
|
|
|
lip_height=self.wing_s1_thickness,
|
|
|
|
hole_dist=self.wing_s1_shoulder_spacer_hole_dist,
|
|
|
|
spacer_hole_diam=self.wing_s1_spacer_hole_diam,
|
2024-07-08 21:46:35 -07:00
|
|
|
)
|
2024-07-12 23:16:04 -07:00
|
|
|
@assembly()
|
|
|
|
def elbow_assembly(self):
|
|
|
|
return self.elbow_joint.assembly()
|
|
|
|
@assembly()
|
|
|
|
def wrist_assembly(self):
|
|
|
|
return self.wrist_joint.assembly()
|
|
|
|
|
2024-07-08 21:46:35 -07:00
|
|
|
|
2024-07-07 21:01:40 -07:00
|
|
|
@target(name="wing/s1-spacer", kind=TargetKind.DXF)
|
|
|
|
def wing_s1_spacer(self) -> Cq.Workplane:
|
2024-06-20 23:29:18 -07:00
|
|
|
result = (
|
2024-07-07 21:01:40 -07:00
|
|
|
Cq.Workplane('XZ')
|
|
|
|
.sketch()
|
|
|
|
.rect(self.wing_s1_spacer_width, self.wing_s1_thickness)
|
|
|
|
.finalize()
|
|
|
|
.extrude(self.wing_s1_spacer_thickness)
|
2024-06-20 23:29:18 -07:00
|
|
|
)
|
2024-07-09 19:57:54 -07:00
|
|
|
result.faces("<Z").tag("weld1")
|
|
|
|
result.faces(">Z").tag("weld2")
|
2024-07-07 21:01:40 -07:00
|
|
|
result.faces(">Y").tag("dir")
|
2024-06-20 23:29:18 -07:00
|
|
|
return result
|
|
|
|
|
2024-07-08 21:46:35 -07:00
|
|
|
@target(name="wing/s1-shoulder-spacer", kind=TargetKind.DXF)
|
2024-07-09 19:57:54 -07:00
|
|
|
def wing_s1_shoulder_spacer(self) -> Cq.Workplane:
|
2024-07-08 22:32:49 -07:00
|
|
|
"""
|
2024-07-12 23:16:04 -07:00
|
|
|
Creates a rectangular spacer. This could be cut from acrylic.
|
|
|
|
|
|
|
|
There are two holes on the top of the spacer. With the holes
|
2024-07-08 22:32:49 -07:00
|
|
|
"""
|
2024-07-08 21:46:35 -07:00
|
|
|
dx = self.wing_s1_shoulder_spacer_hole_dist
|
2024-07-09 19:57:54 -07:00
|
|
|
h = self.wing_s1_spacer_thickness
|
2024-07-12 23:16:04 -07:00
|
|
|
length = self.wing_s1_shoulder_spacer_width
|
|
|
|
hole_diam = self.wing_s1_spacer_hole_diam
|
|
|
|
assert dx + hole_diam < length / 2
|
2024-07-08 21:46:35 -07:00
|
|
|
result = (
|
2024-07-12 23:16:04 -07:00
|
|
|
Cq.Workplane('XY')
|
2024-07-08 21:46:35 -07:00
|
|
|
.sketch()
|
2024-07-12 23:16:04 -07:00
|
|
|
.rect(length, self.wing_s1_thickness)
|
2024-07-08 21:46:35 -07:00
|
|
|
.push([
|
|
|
|
(0, 0),
|
|
|
|
(dx, 0),
|
|
|
|
])
|
2024-07-12 23:16:04 -07:00
|
|
|
.circle(hole_diam / 2, mode='s')
|
2024-07-08 21:46:35 -07:00
|
|
|
.finalize()
|
2024-07-09 19:57:54 -07:00
|
|
|
.extrude(h)
|
2024-07-08 21:46:35 -07:00
|
|
|
)
|
|
|
|
# Tag the mating surfaces to be glued
|
2024-07-12 23:16:04 -07:00
|
|
|
result.faces("<Y").workplane().moveTo(length / 2, h).tagPlane("left")
|
|
|
|
result.faces(">Y").workplane().moveTo(-length / 2, h).tagPlane("right")
|
2024-07-08 21:46:35 -07:00
|
|
|
|
|
|
|
# Tag the directrix
|
2024-07-12 23:16:04 -07:00
|
|
|
result.faces(">Z").tag("dir")
|
2024-07-08 21:46:35 -07:00
|
|
|
|
|
|
|
# Tag the holes
|
2024-07-12 23:16:04 -07:00
|
|
|
plane = result.faces(">Z").workplane()
|
2024-07-08 21:46:35 -07:00
|
|
|
# Side closer to the parent is 0
|
2024-07-12 23:16:04 -07:00
|
|
|
plane.moveTo(dx, 0).tagPlane("conn0")
|
2024-07-08 22:32:49 -07:00
|
|
|
plane.tagPlane("conn1")
|
2024-07-08 21:46:35 -07:00
|
|
|
return result
|
2024-07-12 23:16:04 -07:00
|
|
|
def assembly_insert_shoulder_spacer(
|
|
|
|
self,
|
|
|
|
assembly,
|
|
|
|
spacer,
|
|
|
|
point_tag: str,
|
|
|
|
front_tag: str = "panel_front",
|
|
|
|
back_tag: str = "panel_back",
|
|
|
|
flipped: bool = False,
|
|
|
|
):
|
|
|
|
"""
|
|
|
|
For a child joint facing up, front panel should be on the right, back
|
|
|
|
panel on the left
|
|
|
|
"""
|
|
|
|
site_front, site_back = "right", "left"
|
|
|
|
if flipped:
|
|
|
|
site_front, site_back = site_back, site_front
|
|
|
|
angle = 0
|
|
|
|
(
|
|
|
|
assembly
|
|
|
|
.add(spacer,
|
|
|
|
name=f"{point_tag}_spacer",
|
|
|
|
color=self.material_bracket.color)
|
|
|
|
.constrain(f"{front_tag}?{point_tag}",
|
|
|
|
f"{point_tag}_spacer?{site_front}", "Plane")
|
|
|
|
.constrain(f"{back_tag}?{point_tag}",
|
|
|
|
f"{point_tag}_spacer?{site_back}", "Plane")
|
|
|
|
.constrain(f"{point_tag}_spacer?dir", f"{front_tag}?{point_tag}_dir",
|
|
|
|
"Axis", param=angle)
|
|
|
|
)
|
2024-07-08 21:46:35 -07:00
|
|
|
|
2024-07-07 21:01:40 -07:00
|
|
|
@target(name="wing/r1s1", kind=TargetKind.DXF)
|
|
|
|
def wing_r1s1_profile(self) -> Cq.Sketch:
|
2024-07-12 23:16:04 -07:00
|
|
|
"""
|
|
|
|
FIXME: Output individual segment profiles
|
|
|
|
"""
|
2024-07-11 16:02:54 -07:00
|
|
|
return self.wing_profile.profile()
|
2024-07-07 21:01:40 -07:00
|
|
|
|
|
|
|
def wing_r1s1_panel(self, front=True) -> Cq.Workplane:
|
2024-07-12 23:16:04 -07:00
|
|
|
return self.wing_profile.surface_s1(
|
|
|
|
thickness=self.panel_thickness,
|
|
|
|
shoulder_joint_child_height=self.shoulder_joint.child_height,
|
|
|
|
front=front,
|
|
|
|
)
|
|
|
|
def wing_r1s2_panel(self, front=True) -> Cq.Workplane:
|
|
|
|
return self.wing_profile.surface_s2(
|
|
|
|
thickness=self.panel_thickness,
|
|
|
|
front=front,
|
|
|
|
)
|
|
|
|
def wing_r1s3_panel(self, front=True) -> Cq.Workplane:
|
|
|
|
return self.wing_profile.surface_s3(
|
|
|
|
thickness=self.panel_thickness,
|
|
|
|
front=front,
|
2024-06-20 23:45:24 -07:00
|
|
|
)
|
2024-06-25 06:11:48 -07:00
|
|
|
|
2024-07-07 21:45:10 -07:00
|
|
|
@assembly()
|
2024-07-07 21:01:40 -07:00
|
|
|
def wing_r1s1_assembly(self) -> Cq.Assembly:
|
|
|
|
result = (
|
|
|
|
Cq.Assembly()
|
|
|
|
.add(self.wing_r1s1_panel(front=True), name="panel_front",
|
|
|
|
color=self.material_panel.color)
|
2024-07-08 22:32:49 -07:00
|
|
|
.constrain("panel_front", "Fixed")
|
2024-07-07 21:01:40 -07:00
|
|
|
.add(self.wing_r1s1_panel(front=False), name="panel_back",
|
|
|
|
color=self.material_panel.color)
|
|
|
|
.constrain("panel_front@faces@>Z", "panel_back@faces@<Z", "Point",
|
|
|
|
param=self.wing_s1_thickness)
|
|
|
|
)
|
2024-07-12 23:16:04 -07:00
|
|
|
for t in ["shoulder_bot", "shoulder_top", "elbow_bot", "elbow_top"]:
|
|
|
|
is_top = t.endswith("_top")
|
|
|
|
is_parent = t.startswith("shoulder")
|
|
|
|
self.assembly_insert_shoulder_spacer(
|
|
|
|
result,
|
|
|
|
self.wing_s1_shoulder_spacer(),
|
|
|
|
point_tag=t,
|
|
|
|
flipped=is_top == is_parent,
|
|
|
|
)
|
|
|
|
return result.solve()
|
|
|
|
@assembly()
|
|
|
|
def wing_r1s2_assembly(self) -> Cq.Assembly:
|
|
|
|
result = (
|
|
|
|
Cq.Assembly()
|
|
|
|
.add(self.wing_r1s2_panel(front=True), name="panel_front",
|
|
|
|
color=self.material_panel.color)
|
|
|
|
.constrain("panel_front", "Fixed")
|
|
|
|
.add(self.wing_r1s2_panel(front=False), name="panel_back",
|
|
|
|
color=self.material_panel.color)
|
|
|
|
# FIXME: Use s2 thickness
|
|
|
|
.constrain("panel_front@faces@>Z", "panel_back@faces@<Z", "Point",
|
|
|
|
param=self.wing_s1_thickness)
|
|
|
|
)
|
|
|
|
for t in ["elbow_bot", "elbow_top", "wrist_bot", "wrist_top"]:
|
|
|
|
is_top = t.endswith("_top")
|
|
|
|
is_parent = t.startswith("elbow")
|
|
|
|
self.assembly_insert_shoulder_spacer(
|
|
|
|
result,
|
|
|
|
self.wing_s1_shoulder_spacer(),
|
|
|
|
point_tag=t,
|
|
|
|
flipped=is_top == is_parent,
|
|
|
|
)
|
|
|
|
return result.solve()
|
|
|
|
@assembly()
|
|
|
|
def wing_r1s3_assembly(self) -> Cq.Assembly:
|
|
|
|
result = (
|
|
|
|
Cq.Assembly()
|
|
|
|
.add(self.wing_r1s3_panel(front=True), name="panel_front",
|
|
|
|
color=self.material_panel.color)
|
|
|
|
.constrain("panel_front", "Fixed")
|
|
|
|
.add(self.wing_r1s3_panel(front=False), name="panel_back",
|
|
|
|
color=self.material_panel.color)
|
|
|
|
# FIXME: Use s2 thickness
|
|
|
|
.constrain("panel_front@faces@>Z", "panel_back@faces@<Z", "Point",
|
|
|
|
param=self.wing_s1_thickness)
|
|
|
|
)
|
|
|
|
for t in ["wrist_bot", "wrist_top"]:
|
|
|
|
self.assembly_insert_shoulder_spacer(
|
|
|
|
result,
|
|
|
|
self.wing_s1_shoulder_spacer(),
|
|
|
|
point_tag=t
|
2024-07-07 21:01:40 -07:00
|
|
|
)
|
2024-07-08 22:32:49 -07:00
|
|
|
return result.solve()
|
2024-07-07 21:01:40 -07:00
|
|
|
|
|
|
|
|
2024-07-07 21:45:10 -07:00
|
|
|
@assembly()
|
2024-07-12 23:16:04 -07:00
|
|
|
def wing_r1_assembly(
|
|
|
|
self,
|
|
|
|
parts=["s0", "shoulder", "s1", "elbow", "s2", "wrist", "s3"],
|
|
|
|
) -> Cq.Assembly:
|
2024-07-06 16:41:13 -07:00
|
|
|
result = (
|
|
|
|
Cq.Assembly()
|
|
|
|
)
|
2024-07-12 23:16:04 -07:00
|
|
|
if "s0" in parts:
|
2024-07-08 22:32:49 -07:00
|
|
|
(
|
|
|
|
result
|
2024-07-12 23:16:04 -07:00
|
|
|
.add(self.wing_root(), name="s0")
|
|
|
|
.constrain("s0/scaffold", "Fixed")
|
2024-07-08 22:32:49 -07:00
|
|
|
)
|
|
|
|
if "shoulder" in parts:
|
|
|
|
result.add(self.shoulder_assembly(), name="shoulder")
|
|
|
|
|
2024-07-12 23:16:04 -07:00
|
|
|
if "s0" in parts and "shoulder" in parts:
|
2024-07-08 22:32:49 -07:00
|
|
|
(
|
|
|
|
result
|
2024-07-12 23:16:04 -07:00
|
|
|
.constrain("s0/scaffold?conn_top0", "shoulder/parent_top?conn0", "Plane")
|
|
|
|
.constrain("s0/scaffold?conn_top1", "shoulder/parent_top?conn1", "Plane")
|
|
|
|
.constrain("s0/scaffold?conn_bot0", "shoulder/parent_bot?conn0", "Plane")
|
|
|
|
.constrain("s0/scaffold?conn_bot1", "shoulder/parent_bot?conn1", "Plane")
|
2024-07-08 22:32:49 -07:00
|
|
|
)
|
|
|
|
|
|
|
|
if "s1" in parts:
|
|
|
|
result.add(self.wing_r1s1_assembly(), name="s1")
|
|
|
|
|
|
|
|
if "s1" in parts and "shoulder" in parts:
|
|
|
|
(
|
|
|
|
result
|
|
|
|
.constrain("shoulder/child/lip_bot?conn0",
|
|
|
|
"s1/shoulder_bot_spacer?conn0",
|
|
|
|
"Plane")
|
|
|
|
.constrain("shoulder/child/lip_bot?conn1",
|
|
|
|
"s1/shoulder_bot_spacer?conn1",
|
|
|
|
"Plane")
|
|
|
|
.constrain("shoulder/child/lip_top?conn0",
|
|
|
|
"s1/shoulder_top_spacer?conn0",
|
|
|
|
"Plane")
|
|
|
|
.constrain("shoulder/child/lip_top?conn1",
|
|
|
|
"s1/shoulder_top_spacer?conn1",
|
|
|
|
"Plane")
|
|
|
|
)
|
2024-07-12 23:16:04 -07:00
|
|
|
if "elbow" in parts:
|
|
|
|
result.add(self.elbow_assembly(), name="elbow")
|
|
|
|
|
|
|
|
if "s2" in parts:
|
|
|
|
result.add(self.wing_r1s2_assembly(), name="s2")
|
|
|
|
|
|
|
|
if "s1" in parts and "elbow" in parts:
|
|
|
|
(
|
|
|
|
result
|
|
|
|
.constrain("elbow/parent_upper/top?conn1",
|
|
|
|
"s1/elbow_top_spacer?conn1",
|
|
|
|
"Plane")
|
|
|
|
.constrain("elbow/parent_upper/top?conn0",
|
|
|
|
"s1/elbow_top_spacer?conn0",
|
|
|
|
"Plane")
|
|
|
|
.constrain("elbow/parent_upper/bot?conn1",
|
|
|
|
"s1/elbow_bot_spacer?conn1",
|
|
|
|
"Plane")
|
|
|
|
.constrain("elbow/parent_upper/bot?conn0",
|
|
|
|
"s1/elbow_bot_spacer?conn0",
|
|
|
|
"Plane")
|
|
|
|
)
|
|
|
|
|
|
|
|
if "s2" in parts and "elbow" in parts:
|
|
|
|
(
|
|
|
|
result
|
|
|
|
.constrain("elbow/child/bot?conn0",
|
|
|
|
"s2/elbow_bot_spacer?conn0",
|
|
|
|
"Plane")
|
|
|
|
.constrain("elbow/child/bot?conn1",
|
|
|
|
"s2/elbow_bot_spacer?conn1",
|
|
|
|
"Plane")
|
|
|
|
.constrain("elbow/child/top?conn0",
|
|
|
|
"s2/elbow_top_spacer?conn0",
|
|
|
|
"Plane")
|
|
|
|
.constrain("elbow/child/top?conn1",
|
|
|
|
"s2/elbow_top_spacer?conn1",
|
|
|
|
"Plane")
|
|
|
|
)
|
2024-07-13 12:57:17 -07:00
|
|
|
if len(parts) > 1:
|
|
|
|
result.solve()
|
|
|
|
return result
|
2024-07-06 16:41:13 -07:00
|
|
|
|
2024-07-07 21:45:10 -07:00
|
|
|
@assembly()
|
2024-07-06 16:41:13 -07:00
|
|
|
def wings_assembly(self) -> Cq.Assembly:
|
2024-07-04 12:03:38 -07:00
|
|
|
"""
|
|
|
|
Assembly of harness with all the wings
|
|
|
|
"""
|
|
|
|
a_tooth = self.hs_hirth_joint.tooth_angle
|
|
|
|
|
|
|
|
result = (
|
|
|
|
Cq.Assembly()
|
|
|
|
.add(self.harness_assembly(), name="harness", loc=Cq.Location((0, 0, 0)))
|
|
|
|
.add(self.wing_root(), name="w0_r1")
|
|
|
|
.add(self.wing_root(), name="w0_l1")
|
|
|
|
.constrain("harness/base", "Fixed")
|
|
|
|
.constrain("w0_r1/joint?mate", "harness/r1?mate", "Plane")
|
2024-07-08 22:32:49 -07:00
|
|
|
.constrain("w0_r1/joint?dir", "harness/r1?dir",
|
2024-07-04 12:03:38 -07:00
|
|
|
"Axis", param=7 * a_tooth)
|
|
|
|
.constrain("w0_l1/joint?mate", "harness/l1?mate", "Plane")
|
2024-07-08 22:32:49 -07:00
|
|
|
.constrain("w0_l1/joint?dir", "harness/l1?dir",
|
2024-07-04 12:03:38 -07:00
|
|
|
"Axis", param=-1 * a_tooth)
|
|
|
|
.solve()
|
|
|
|
)
|
|
|
|
return result
|
2024-07-03 23:15:39 -07:00
|
|
|
|
2024-07-07 21:45:10 -07:00
|
|
|
@assembly(collision_check=False)
|
|
|
|
def trident_assembly(self) -> Cq.Assembly:
|
|
|
|
"""
|
|
|
|
Disable collision check since the threads may not align.
|
|
|
|
"""
|
|
|
|
return MT.trident_assembly(self.trident_handle)
|
|
|
|
|
|
|
|
|
2024-07-03 23:15:39 -07:00
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
p = Parameters()
|
|
|
|
p.build_all()
|