fix: One sided connector

This commit is contained in:
Leni Aniva 2024-07-02 19:59:09 -07:00
parent 1710f0db36
commit 2af1499bd5
Signed by: aniva
GPG Key ID: 4D9B1C8D10EA4C50
3 changed files with 20 additions and 6 deletions

View File

@ -36,7 +36,7 @@ class Handle:
# Length for the rim on the female connector # Length for the rim on the female connector
rim_length: float = 5 rim_length: float = 5
insertion_length: float = 60 insertion_length: float = 30
# Amount by which the connector goes into the segment # Amount by which the connector goes into the segment
connector_length: float = 60 connector_length: float = 60
@ -174,12 +174,15 @@ class Handle:
) )
return result return result
def one_side_connector(self): def one_side_connector(self, height=None):
if height is None:
height = self.rim_length
result = ( result = (
Cq.Workplane('XY') Cq.Workplane('XY')
.cylinder( .cylinder(
radius=self.diam / 2, radius=self.diam / 2,
height=self.rim_length, height=height,
centered=(True, True, False)
) )
) )
result.faces(">Z").tag("mate") result.faces(">Z").tag("mate")
@ -197,7 +200,7 @@ class Handle:
result result
.union( .union(
thread thread
.located(Cq.Location((0, 0, self.connector_length / 2)))) .located(Cq.Location((0, 0, height))))
) )
return result return result

View File

@ -223,7 +223,7 @@ def comma_assembly():
) )
return result return result
@dataclass(frozen=True) @dataclass
class TorsionJoint: class TorsionJoint:
""" """
This jonit consists of a rider puck on a track puck. IT is best suited if This jonit consists of a rider puck on a track puck. IT is best suited if
@ -260,6 +260,7 @@ class TorsionJoint:
assert self.groove_radius_outer > self.groove_radius_inner assert self.groove_radius_outer > self.groove_radius_inner
assert self.groove_radius_inner > self.radius_spring assert self.groove_radius_inner > self.radius_spring
assert self.spring_height > self.groove_depth, "Groove is too deep" assert self.spring_height > self.groove_depth, "Groove is too deep"
assert self.radius_spring > self.radius_axle
@property @property
def total_height(self): def total_height(self):

View File

@ -5,9 +5,17 @@ from nhf.handle import Handle
def trident_assembly( def trident_assembly(
handle: Handle, handle: Handle,
handle_segment_length: float = 24*25.4): handle_segment_length: float = 24*25.4,
terminal_height=100):
def segment(): def segment():
return handle.segment(handle_segment_length) 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_i = Material.PLASTIC_PLA mat_i = Material.PLASTIC_PLA
mat_s = Material.ACRYLIC_BLACK mat_s = Material.ACRYLIC_BLACK
assembly = ( assembly = (
@ -28,5 +36,7 @@ def trident_assembly(
.constrain("s2?mate2", "i3?rim", "Plane", param=0) .constrain("s2?mate2", "i3?rim", "Plane", param=0)
.add(handle.one_side_connector(), name="head", color=mat_i.color) .add(handle.one_side_connector(), name="head", color=mat_i.color)
.constrain("i3?mate", "head?mate", "Plane") .constrain("i3?mate", "head?mate", "Plane")
.add(terminal, name="terminal", color=mat_i.color)
.constrain("i0?mate", "terminal?mate", "Plane")
) )
return assembly.solve() return assembly.solve()