"""Tab washer (lock washer with tabs), flat as delivered: DIN 93 (one long tab) or DIN 463 (a long and a short tab at right angles), M3 to M52. A disc of outside diameter d2 with the hole d1 and thickness s; the long tab of width b reaches l (DIN 93) or l1 (DIN 463) from the hole's centre along +X, DIN 463's short tab l2 along +Y. The tabs' corner radius r is not modelled. The washer lies on the XY plane at the origin, its thickness along +Z. """ from steve import Model standard = "DIN 93" # Standard size = "M10" # Thread size material = "steel" # Material # DIN 93:1974-07 table (https://fasten.it/norms/norm/din_93; https://www.fasteners.eu/standards/DIN/93/ for M4 to M39). size: (d1, d2, b, l, s) DIN_93 = { "M3": (3.2, 12.0, 4.0, 13.0, 0.38), "M3.5": (3.7, 12.0, 4.0, 13.0, 0.38), "M4": (4.3, 14.0, 5.0, 14.0, 0.38), "M5": (5.3, 17.0, 6.0, 16.0, 0.5), "M6": (6.4, 19.0, 7.0, 18.0, 0.5), "M7": (7.4, 19.0, 7.0, 18.0, 0.5), "M8": (8.4, 22.0, 8.0, 20.0, 0.75), "M10": (10.5, 26.0, 10.0, 22.0, 0.75), "M12": (13.0, 30.0, 12.0, 28.0, 1.0), "M14": (15.0, 33.0, 12.0, 28.0, 1.0), "M16": (17.0, 36.0, 15.0, 32.0, 1.0), "M18": (19.0, 40.0, 18.0, 36.0, 1.0), "M20": (21.0, 42.0, 18.0, 36.0, 1.0), "M22": (23.0, 50.0, 20.0, 42.0, 1.0), "M24": (25.0, 50.0, 20.0, 42.0, 1.0), "M27": (28.0, 58.0, 23.0, 48.0, 1.6), "M30": (31.0, 63.0, 26.0, 52.0, 1.6), "M33": (34.0, 68.0, 28.0, 56.0, 1.6), "M36": (37.0, 75.0, 30.0, 60.0, 1.6), "M39": (40.0, 82.0, 32.0, 64.0, 1.6), "M42": (43.0, 88.0, 35.0, 70.0, 1.6), "M45": (46.0, 95.0, 38.0, 75.0, 1.6), "M48": (50.0, 100.0, 40.0, 80.0, 1.6), "M52": (54.0, 105.0, 44.0, 85.0, 1.6), } # DIN 463:1974-07 table (https://fasten.it/norms/norm/din_463; https://www.fasteners.eu/standards/DIN/463/ for M4 to M39, without d2). size: (d1, d2, b, l1, l2, s) DIN_463 = { "M3": (3.2, 7.0, 4.0, 13.0, 5.0, 0.38), "M3.5": (3.7, 8.0, 4.0, 13.0, 5.5, 0.38), "M4": (4.3, 9.0, 5.0, 14.0, 6.5, 0.38), "M5": (5.3, 10.0, 6.0, 16.0, 8.0, 0.5), "M6": (6.4, 12.5, 7.0, 18.0, 9.0, 0.5), "M7": (7.4, 14.0, 7.0, 18.0, 10.0, 0.5), "M8": (8.4, 17.0, 8.0, 20.0, 11.0, 0.75), "M10": (10.5, 21.0, 10.0, 22.0, 13.0, 0.75), "M12": (13.0, 24.0, 12.0, 28.0, 15.0, 1.0), "M14": (15.0, 28.0, 12.0, 28.0, 16.0, 1.0), "M16": (17.0, 30.0, 15.0, 32.0, 18.0, 1.0), "M18": (19.0, 34.0, 18.0, 36.0, 20.0, 1.0), "M20": (21.0, 37.0, 18.0, 36.0, 21.0, 1.0), "M22": (23.0, 39.0, 20.0, 42.0, 23.0, 1.0), "M24": (25.0, 44.0, 20.0, 42.0, 25.0, 1.0), "M27": (28.0, 50.0, 23.0, 48.0, 29.0, 1.6), "M30": (31.0, 56.0, 26.0, 52.0, 32.0, 1.6), "M33": (34.0, 60.0, 28.0, 56.0, 34.0, 1.6), "M36": (37.0, 66.0, 30.0, 60.0, 38.0, 1.6), "M39": (40.0, 72.0, 32.0, 64.0, 41.0, 1.6), "M42": (43.0, 78.0, 35.0, 70.0, 44.0, 1.6), "M45": (46.0, 85.0, 38.0, 75.0, 48.0, 1.6), "M48": (50.0, 92.0, 40.0, 80.0, 50.0, 1.6), "M52": (54.0, 98.0, 44.0, 85.0, 53.0, 1.6), } # material choice: (STEVE material library id, appearance colour) MATERIALS = { "steel": ("steel-dc01", "#b4b7bb"), # soft (formable) steel "stainless-a2": ("stainless-304", "#c9ccd0"), } table = DIN_93 if standard == "DIN 93" else DIN_463 if size not in table: raise ValueError(f"{standard} has no size {size}") row = table[size] d1, d2, b = row[0], row[1], row[2] long_tab = row[3] short_tab = row[4] if standard == "DIN 463" else 0 s = row[-1] material_id, colour = MATERIALS[material] model = Model() with model.sketch("disc_sketch", on="XY", name="Disc") as sk: sk.circle("disc", (0, 0), d2 / 2) model.extrude("disc", "disc_sketch", distance=s, name="Disc") with model.sketch("long_tab_sketch", on="XY", name="Long tab") as sk: sk.rect("long_tab_outline", (0, -b / 2), (long_tab, b / 2)) model.extrude("long_tab", "long_tab_sketch", distance=s, name="Long tab") if standard == "DIN 463": with model.sketch("short_tab_sketch", on="XY", name="Short tab") as sk: sk.rect("short_tab_outline", (-b / 2, 0), (b / 2, short_tab)) model.extrude("short_tab", "short_tab_sketch", distance=s, name="Short tab") with model.sketch("hole_sketch", on="XY", name="Hole") as sk: sk.circle("hole", (0, 0), d1 / 2) model.extrude("hole", "hole_sketch", distance=s, op="cut", name="Hole") model.material(material_id, color=colour) result = model.result()