Skip to content

Commit

Permalink
Add extra_length parameter to latch()
Browse files Browse the repository at this point in the history
  • Loading branch information
florianfesti committed Mar 28, 2024
1 parent 43db7da commit 61f9e1d
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions boxes/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1035,15 +1035,15 @@ def _latchHole(self, length):
self.corner(-90)
self.edge(1.1 * self.thickness)

def _latchGrip(self, length):
def _latchGrip(self, length, extra_length=0.0):
"""
:param length:
"""
self.corner(90, self.thickness / 4.0)
self.grip(length / 2.0 - self.thickness / 2.0 - 0.2 * self.thickness, self.thickness / 2.0)
self.grip(length / 2.0 - self.thickness / 2.0 - 0.2 * self.thickness + extra_length, self.thickness / 2.0)
self.corner(90, self.thickness / 4.0)

def latch(self, length, positive=True, reverse=False):
def latch(self, length, positive=True, reverse=False, extra_length=0.0):
"""Latch to fix a flex box door to the box
:param length: length in mm
Expand All @@ -1058,12 +1058,12 @@ def latch(self, length, positive=True, reverse=False):
self.polyline(*poly)
else:
if reverse:
self._latchGrip(length)
self._latchGrip(length, extra_length)
else:
self.corner(90)
self._latchHole(length)
if not reverse:
self._latchGrip(length)
self._latchGrip(length, extra_length)
else:
self.corner(90)

Expand Down

0 comments on commit 61f9e1d

Please sign in to comment.