Cosplay/nhf/touhou/houjuu_nue/trident.py

33 lines
1.3 KiB
Python

import math
import cadquery as Cq
from nhf import Material
from nhf.handle import Handle
def trident_assembly(
handle: Handle,
handle_segment_length: float = 24*25.4):
def segment():
return handle.segment(handle_segment_length)
mat_i = Material.PLASTIC_PLA
mat_s = Material.ACRYLIC_BLACK
assembly = (
Cq.Assembly()
.add(handle.insertion(), name="i0", color=mat_i.color)
.constrain("i0", "Fixed")
.add(segment(), name="s1", color=mat_s.color)
.constrain("i0?rim", "s1?mate1", "Plane", param=0)
.add(handle.insertion(), name="i1", color=mat_i.color)
.add(handle.connector(), name="c1", color=mat_i.color)
.add(handle.insertion(), name="i2", color=mat_i.color)
.constrain("s1?mate2", "i1?rim", "Plane", param=0)
.constrain("i1?mate", "c1?mate1", "Plane")
.constrain("i2?mate", "c1?mate2", "Plane")
.add(segment(), name="s2", color=mat_s.color)
.constrain("i2?rim", "s2?mate1", "Plane", param=0)
.add(handle.insertion(), name="i3", color=mat_i.color)
.constrain("s2?mate2", "i3?rim", "Plane", param=0)
.add(handle.one_side_connector(), name="head", color=mat_i.color)
.constrain("i3?mate", "head?mate", "Plane")
)
return assembly.solve()