"""Cotter pin (split pin), simplified as step.parts' published models draw it: two round legs side by side and a round cross bar for the eye, nominal sizes 1 to 5 mm, any length. The legs (diameter d, the nominal size) run along +Z from z = 0 to the length l, their axes at x = +-e; the eye is a round bar of diameter d along X, 2d long, centred on the origin. There is no eye loop, no half-round wire and no point: see the README. """ from steve import Model size = "2" # Nominal size d (mm) length = 32 # mm Length l material = "steel" # Material # mm, measured on step.parts' models iso_1234_cotter_pin_d_l_simple (every face read: the legs' and the bar's # cylinder radii and axes): {d: (leg and bar diameter, leg axis offset e from the centre, bar length)} SIZES = { "1": (1.0, 0.35, 2.0), "1.6": (1.6, 0.56, 3.2), "2": (2.0, 0.7, 4.0), "2.5": (2.5, 0.875, 5.0), "3.2": (3.2, 1.12, 6.4), "4": (4.0, 1.4, 8.0), "5": (5.0, 1.75, 10.0), } MATERIALS = {"steel": ("steel-generic", "#9da2a8"), "stainless": ("stainless-304", "#c9ccd0")} d, e, bar = SIZES[size] material_id, colour = MATERIALS[material] model = Model() model.cylinder("leg_1", d / 2, length, at=(e, 0, 0), name="Leg") model.cylinder("leg_2", d / 2, length, at=(-e, 0, 0), op="join", name="Leg") model.cylinder("eye", d / 2, bar, at=(-bar / 2, 0, 0), direction=(1, 0, 0), op="join", name="Eye") model.material(material_id, color=colour) result = model.result()