"""Clevis pin with head, ISO 2341 (DIN 1444), type A (plain) or type B (with split-pin hole), d 4 to 24 mm. Head of diameter dk and height k, shank of the nominal diameter d and length l under the head; type B has a cross hole d1 for a split pin whose axis is le (min) from the end. Head edge radius and end chamfer are not modelled. The head's bearing face is on the XY plane at the origin, the head above it, the shank along -Z; the cross hole runs along Y. """ from steve import Model diameter = 8 # mm Nominal diameter d length = 30 # mm Length l under the head pin_type = "B" # Type: A plain, B with split-pin hole material = "steel" # Material # ISO 2341:1986 table (https://www.globalfastener.com/standards/detail_252.html; https://www.fasteners.eu/standards/ISO/2341/). d: (head diameter dk, head height k, split-pin hole d1, hole axis to end le min) DIMENSIONS = { 4: (6.0, 1.0, 1.0, 2.2), 5: (8.0, 1.6, 1.2, 2.9), 6: (10.0, 2.0, 1.6, 3.2), 8: (14.0, 3.0, 2.0, 3.5), 10: (18.0, 4.0, 3.2, 4.5), 12: (20.0, 4.0, 3.2, 5.5), 14: (22.0, 4.0, 4.0, 6.0), 16: (25.0, 4.5, 4.0, 6.0), 18: (28.0, 5.0, 5.0, 7.0), 20: (30.0, 5.0, 5.0, 8.0), 22: (33.0, 5.5, 5.0, 8.0), 24: (36.0, 6.0, 6.3, 9.0), } # material choice: (STEVE material library id, appearance colour) MATERIALS = { "steel": ("steel-generic", "#b4b7bb"), "stainless-a2": ("stainless-304", "#c9ccd0"), } if diameter not in DIMENSIONS: raise ValueError(f"ISO 2341 has no diameter {diameter} mm") dk, k, d1, le = DIMENSIONS[diameter] if pin_type == "B" and length < le + d1: raise ValueError(f"a type B pin needs a length of at least {le + d1} mm for its split-pin hole") material_id, colour = MATERIALS[material] model = Model() with model.sketch("head_sketch", on="XY", name="Head") as sk: sk.circle("head_circle", (0, 0), dk / 2) model.extrude("head", "head_sketch", distance=k, name="Head") with model.sketch("shank_sketch", on="XY", name="Shank") as sk: sk.circle("shank_circle", (0, 0), diameter / 2) model.extrude("shank", "shank_sketch", distance=-length, name="Shank") if pin_type == "B": model.cylinder("split_pin_hole", d1 / 2, 2 * diameter, at=(0, -diameter, le - length), direction=(0, 1, 0), op="cut", name="Split-pin hole") model.material(material_id, color=colour) result = model.result()