"""Metric spring and lock washers: DIN 137 form A curved spring washers and DIN 6797 form A external tooth lock washers. - curved (DIN 137 A): the annulus d1 x d2, s thick, curved about the X axis so that it stands h (max, the free height) tall: the region of the annulus between two coaxial cylinders (axis parallel to X) of radii R and R + s, with R chosen so that the inner surface rises h - s at the rim. Its lowest point is on the XY plane at the origin. - tooth (DIN 6797 A): envelope, the flat blank, an annulus d1 x d2, s thick, on the XY plane; the standard gives the number of teeth (6 or 8) and the overall height (at least 2 s) but not the teeth's shape, so they are not modelled. Centred on the origin. """ from steve import Model size = "M4" # Nominal size (screw) style = "curved" # Washer style material = "spring-steel" # Material # mm. DIN 137 (1985) form A, curved: (d1 min = nominal, d2 nominal, s nominal, h max) CURVED = {"M2": (2.2, 4.5, 0.3, 1.0), "M2.5": (2.8, 5.5, 0.3, 1.1), "M3": (3.2, 6, 0.4, 1.3), "M4": (4.3, 8, 0.5, 1.6), "M5": (5.3, 10, 0.5, 1.8), "M6": (6.4, 11, 0.5, 2.2), "M8": (8.4, 15, 0.5, 3.4), "M10": (10.5, 18, 0.8, 4.0)} # mm. DIN 6797:1988-07 form A, external teeth: (d1 min = nominal, d2 max = nominal, s nominal, number of teeth) TOOTH = {"M2": (2.2, 4.5, 0.3, 6), "M2.5": (2.7, 5.5, 0.4, 6), "M3": (3.2, 6, 0.4, 6), "M4": (4.3, 8, 0.5, 8), "M5": (5.3, 10, 0.6, 8), "M6": (6.4, 11, 0.7, 8), "M8": (8.4, 15, 0.8, 8)} MATERIALS = {"spring-steel": ("steel-generic", "#4a4c50"), "stainless": ("stainless-304", "#c9ccd0")} material_id, colour = MATERIALS[material] model = Model() if style == "curved": d1, d2, s, h = CURVED[size] r2, k = d2 / 2, h - s R = (r2 * r2 + k * k) / (2 * k) # inner surface radius: it rises k at y = +-d2/2 model.cylinder("blank", r2, h + 2, at=(0, 0, -1), name="Blank") model.cylinder("hole", d1 / 2, h + 2, at=(0, 0, -1), op="cut", name="Hole") model.cylinder("shell", R + s, 2 * d2, at=(-d2, 0, R + s), direction=(1, 0, 0), op="new", name="Shell") model.cylinder("shell_in", R, 2 * d2, at=(-d2, 0, R + s), direction=(1, 0, 0), op="cut", body="shell", name="Shell inside") model.combine("washer", "blank", ["shell"], op="intersect", name="Washer") else: d1, d2, s, teeth = TOOTH[size] with model.sketch("washer_sketch", on="XY", name="Washer") as sk: sk.circle("outside", (0, 0), d2 / 2) sk.circle("inside", (0, 0), d1 / 2) model.extrude("washer", "washer_sketch", distance=s, name="Washer") model.material(material_id, color=colour) result = model.result()