"""Rigid shaft coupling, split clamping type: two halves held by four screws. Axis along Z, an end face on the XY plane, bore d1 in the lower half of the length, bore d2 in the upper. The split is in the YZ plane. Fit dimensions from MISUMI's table; see the README.""" import cadquery as cq from steve import Model size = 20 # mm Outside diameter D d1 = 6 # mm Bore 1 (d1 <= d2) d2 = 8 # mm Bore 2 detail = "full" # full: two halves with screw holes; simple: one plain cylinder with the bores # D: (L, screw from the end F, screw offset A, clamp screw M, bores offered). # MISUMI Couplings catalogue, Rigid Couplings, Split, CPSR table, https://de.misumi-ec.com/files/images/products/docs/flexibleshaftcouplings.pdf, PDF p. 22. SIZES = {16: (16, 3.75, 5, 2.5, (5, 6)), 20: (20, 4.75, 6.5, 2.5, (6, 8)), 25: (25, 6, 9, 3, (8, 10)), 32: (32, 7.75, 11, 4, (10, 12, 14))} L, F, A, screw, bores = SIZES[size] if d1 not in bores or d2 not in bores or d1 > d2: raise ValueError(f"The {size} mm rigid coupling offers bores {bores}, with d1 <= d2.") R = size / 2 GAP = 0.02 * size # the split's width, for looks body = cq.Workplane("XY").circle(R).extrude(L) body = body.cut(cq.Workplane("XY").workplane(offset=-1).circle(d1 / 2).extrude(L / 2 + 1)) body = body.cut(cq.Workplane("XY").workplane(offset=L / 2).circle(d2 / 2).extrude(L / 2 + 1)) model = Model() if detail == "simple": model.add("body", body, name="Rigid coupling") model.material("aluminum-generic", color="#c9ccd1") else: for z in (F, L - F): for y in (-A, A): body = body.cut(cq.Workplane("YZ").center(y, z).circle(screw / 2).extrude(R + 1, both=True)) left = body.cut(cq.Workplane("XY").workplane(offset=-1).center(R, 0).rect(2 * R + GAP, 2 * R + 2).extrude(L + 2)) right = body.cut(cq.Workplane("XY").workplane(offset=-1).center(-R, 0).rect(2 * R + GAP, 2 * R + 2).extrude(L + 2)) model.add("half_1", left, op="new", body="half_1_body", name="Half") model.add("half_2", right, op="new", body="half_2_body", name="Half") model.material("aluminum-generic", bodies=["half_1_body", "half_2_body"], color="#c9ccd1") result = model.result()