56 lines
2.0 KiB
Python
56 lines
2.0 KiB
Python
import math
|
|
import cadquery as Cq
|
|
from nhf import Material, Role
|
|
from nhf.parts.handle import Handle
|
|
|
|
def trident_assembly(
|
|
handle: Handle,
|
|
handle_segment_length: float = 24*25.4,
|
|
terminal_height=100):
|
|
def segment():
|
|
return handle.segment(handle_segment_length)
|
|
|
|
terminal = (
|
|
handle
|
|
.one_side_connector(height=terminal_height)
|
|
.faces(">Z")
|
|
.hole(15, terminal_height + handle.insertion_length - 10)
|
|
)
|
|
mat_c = Material.PLASTIC_PLA
|
|
mat_i = Material.RESIN_TOUGH_1500
|
|
mat_s = Material.ACRYLIC_BLACK
|
|
role_i = Role.CONNECTION
|
|
role_c = Role.CONNECTION
|
|
role_s = Role.STRUCTURE
|
|
assembly = (
|
|
Cq.Assembly()
|
|
.addS(handle.insertion(), name="i0",
|
|
material=mat_i, role=role_i)
|
|
.constrain("i0", "Fixed")
|
|
.addS(segment(), name="s1",
|
|
material=mat_s, role=role_s)
|
|
.constrain("i0?rim", "s1?mate1", "Plane", param=0)
|
|
.addS(handle.insertion(), name="i1",
|
|
material=mat_i, role=role_i)
|
|
.addS(handle.connector(), name="c1",
|
|
material=mat_c, role=role_c)
|
|
.addS(handle.insertion(), name="i2",
|
|
material=mat_i, role=role_i)
|
|
.constrain("s1?mate2", "i1?rim", "Plane", param=0)
|
|
.constrain("i1?mate", "c1?mate1", "Plane")
|
|
.constrain("i2?mate", "c1?mate2", "Plane")
|
|
.addS(segment(), name="s2",
|
|
material=mat_s, role=role_s)
|
|
.constrain("i2?rim", "s2?mate1", "Plane", param=0)
|
|
.addS(handle.insertion(), name="i3",
|
|
material=mat_i, role=role_i)
|
|
.constrain("s2?mate2", "i3?rim", "Plane", param=0)
|
|
.addS(handle.one_side_connector(), name="head",
|
|
material=mat_c, role=role_c)
|
|
.constrain("i3?mate", "head?mate", "Plane")
|
|
.addS(terminal, name="terminal",
|
|
material=mat_c, role=role_c)
|
|
.constrain("i0?mate", "terminal?mate", "Plane")
|
|
)
|
|
return assembly.solve()
|