cosplay: Touhou/Houjuu Nue #4

Open
aniva wants to merge 189 commits from touhou/houjuu-nue into main
4 changed files with 17 additions and 11 deletions
Showing only changes of commit 3adb887ef5 - Show all commits

View File

@ -54,6 +54,7 @@ class MountingBox(Model):
generate_side_tags: bool = True generate_side_tags: bool = True
# Determines the position of side tags
flip_y: bool = False flip_y: bool = False
@target(kind=TargetKind.DXF) @target(kind=TargetKind.DXF)

View File

@ -62,16 +62,15 @@ class Parameters(Model):
wing_l1: MW.WingL = field(default_factory=lambda: MW.WingL( wing_l1: MW.WingL = field(default_factory=lambda: MW.WingL(
name="l1", name="l1",
wrist_angle=-45.0, wrist_angle=-45.0,
shoulder_joint=MJ.ShoulderJoint(directrix_id=1),
)) ))
wing_l2: MW.WingL = field(default_factory=lambda: MW.WingL( wing_l2: MW.WingL = field(default_factory=lambda: MW.WingL(
name="l2", name="l2",
wrist_angle=-30.0, wrist_angle=-30.0,
shoulder_joint=MJ.ShoulderJoint(directrix_id=1),
)) ))
wing_l3: MW.WingL = field(default_factory=lambda: MW.WingL( wing_l3: MW.WingL = field(default_factory=lambda: MW.WingL(
name="l3", name="l3",
wrist_angle=0.0, wrist_angle=0.0,
shoulder_joint=MJ.ShoulderJoint(directrix_id=1),
)) ))
trident: MT.Trident = field(default_factory=lambda: MT.Trident()) trident: MT.Trident = field(default_factory=lambda: MT.Trident())

View File

@ -570,7 +570,7 @@ class DiskJoint(Model):
@dataclass(kw_only=True) @dataclass(kw_only=True)
class ElbowJoint: class ElbowJoint(Model):
""" """
Creates the elbow and wrist joints. Creates the elbow and wrist joints.
@ -629,6 +629,7 @@ class ElbowJoint:
r = self.parent_arm_radius r = self.parent_arm_radius
return [r - dx, r + dx] return [r - dx, r + dx]
@target(name="child")
def child_joint(self) -> Cq.Assembly: def child_joint(self) -> Cq.Assembly:
angle = -self.disk_joint.tongue_span / 2 angle = -self.disk_joint.tongue_span / 2
dz = self.disk_joint.disk_thickness / 2 dz = self.disk_joint.disk_thickness / 2
@ -646,9 +647,11 @@ class ElbowJoint:
) )
return result return result
@target(name="parent-lower")
def parent_joint_lower(self) -> Cq.Workplane: def parent_joint_lower(self) -> Cq.Workplane:
return self.disk_joint.housing_lower() return self.disk_joint.housing_lower()
@target(name="parent-upper")
def parent_joint_upper(self): def parent_joint_upper(self):
axial_offset = Cq.Location((self.parent_arm_radius, 0, 0)) axial_offset = Cq.Location((self.parent_arm_radius, 0, 0))
housing_dz = self.disk_joint.housing_upper_dz housing_dz = self.disk_joint.housing_upper_dz
@ -683,6 +686,7 @@ class ElbowJoint:
) )
return result return result
@assembly()
def assembly(self, angle: float = 0) -> Cq.Assembly: def assembly(self, angle: float = 0) -> Cq.Assembly:
result = ( result = (
Cq.Assembly() Cq.Assembly()

View File

@ -635,6 +635,10 @@ class WingProfile(Model):
result = ( result = (
Cq.Assembly() Cq.Assembly()
) )
tag_top, tag_bot = "top", "bot"
if self.flip:
tag_top, tag_bot = tag_bot, tag_top
if "s0" in parts: if "s0" in parts:
result.add(self.assembly_s0(), name="s0") result.add(self.assembly_s0(), name="s0")
if "shoulder" in parts: if "shoulder" in parts:
@ -642,20 +646,18 @@ class WingProfile(Model):
if "s0" in parts and "shoulder" in parts: if "s0" in parts and "shoulder" in parts:
( (
result result
.constrain("s0/shoulder?conn_top0", "shoulder/parent_top/lip?conn0", "Plane") .constrain(f"s0/shoulder?conn_top0", f"shoulder/parent_{tag_top}/lip?conn0", "Plane")
#.constrain("s0/shoulder?conn_top1", "shoulder/parent_top/lip?conn1", "Plane") .constrain(f"s0/shoulder?conn_bot0", f"shoulder/parent_{tag_bot}/lip?conn0", "Plane")
.constrain("s0/shoulder?conn_bot0", "shoulder/parent_bot/lip?conn0", "Plane")
#.constrain("s0/shoulder?conn_bot1", "shoulder/parent_bot/lip?conn1", "Plane")
) )
if "s1" in parts: if "s1" in parts:
result.add(self.assembly_s1(), name="s1") result.add(self.assembly_s1(), name="s1")
if "s1" in parts and "shoulder" in parts: if "s1" in parts and "shoulder" in parts:
( (
result result
.constrain("s1/shoulder_top?conn0", "shoulder/child/lip_top?conn0", "Plane") .constrain("s1/shoulder_top?conn0", f"shoulder/child/lip_{tag_top}?conn0", "Plane")
.constrain("s1/shoulder_top?conn1", "shoulder/child/lip_top?conn1", "Plane") .constrain("s1/shoulder_top?conn1", f"shoulder/child/lip_{tag_top}?conn1", "Plane")
.constrain("s1/shoulder_bot?conn0", "shoulder/child/lip_bot?conn0", "Plane") .constrain("s1/shoulder_bot?conn0", f"shoulder/child/lip_{tag_bot}?conn0", "Plane")
.constrain("s1/shoulder_bot?conn1", "shoulder/child/lip_bot?conn1", "Plane") .constrain("s1/shoulder_bot?conn1", f"shoulder/child/lip_{tag_bot}?conn1", "Plane")
) )
if "elbow" in parts: if "elbow" in parts:
result.add(self.elbow_joint.assembly(angle=angle_elbow_wrist), name="elbow") result.add(self.elbow_joint.assembly(angle=angle_elbow_wrist), name="elbow")