Skip to content

Commit

Permalink
Add settings for bed bolts
Browse files Browse the repository at this point in the history
  • Loading branch information
chrysn committed Feb 10, 2024
1 parent 36f6803 commit 0fa97e2
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 1 deletion.
5 changes: 4 additions & 1 deletion boxes/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,6 @@ def open(self):
if self.ctx is not None:
return

self.bedBoltSettings = (3, 5.5, 2, 20, 15) # d, d_nut, h_nut, l, l1
self.surface, self.ctx = self.formats.getSurface(self.format, self.output)

if self.format == 'svg_Ponoko':
Expand Down Expand Up @@ -644,6 +643,10 @@ def _buildObjects(self):
**self.edgesettings.get("Lid", {}))
self.lid = lids.Lid(self, self.lidSettings)

# Bed Bolts
bedbolt_settings = self.edgesettings.get("BedBolt") or edges.BedBoltSettings.absolute_params
self.bedBoltSettings = edges.BedBoltSettings.convert_settings_to_tuple(bedbolt_settings)

# Nuts
self.addPart(NutHole(self, None))
# Gears
Expand Down
26 changes: 26 additions & 0 deletions boxes/edges.py
Original file line number Diff line number Diff line change
Expand Up @@ -2657,3 +2657,29 @@ def __call__(self, length, **kw):

def margin(self) -> float:
return self.settings.height + self.extra_height * self.settings.thickness


class BedBoltSettings(Settings):
"""Settings for bed bolts
Values:
* absolute_params
* d : : Bore and slit diameter [mm] (eg. 4.0 for M4)
* d_nut : : Width of the nut [mm] (eg. 7.0 for M4)
* h_nut : : Height of the nut [mm] (not standardized, roughly 2.4 for M4)
* l : : Total slit length of the nut [mm] (eg. 17.0 for an M? x 20, accounting for 4mm thickness and giving 1mm tolerance)
* l1 : : Distance from the cut edge to the close edge of the nut [mm]
"""

absolute_params = {
"d": 3.0,
"d_nut": 5.5,
"h_nut": 2.0,
"l": 20.0,
"l1": 15.0,
}

@classmethod
def convert_settings_to_tuple(cls, args):
return (args['d'], args['d_nut'], args['h_nut'], args['l'], args['l1'])

0 comments on commit 0fa97e2

Please sign in to comment.