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?lip", "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?lip", "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?lip", "s2?mate1", "Plane", param=0) .add(handle.insertion(), name="i3", color=mat_i.color) .constrain("s2?mate2", "i3?lip", "Plane", param=0) ) return assembly.solve()