diff --git a/boxes/__init__.py b/boxes/__init__.py index f5bdf7bd..b7844ff0 100755 --- a/boxes/__init__.py +++ b/boxes/__init__.py @@ -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': @@ -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 diff --git a/boxes/edges.py b/boxes/edges.py index f2eb92ed..82359f3f 100644 --- a/boxes/edges.py +++ b/boxes/edges.py @@ -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'])