"""Oldham shaft coupling, clamping type: two hubs and a spacer. Axis along Z, the first hub's end face on the XY plane, bore d1 in the first hub, bore d2 in the second. Fit dimensions from MISUMI's table; see the README.""" import cadquery as cq from steve import Model size = 20 # Coupling number d1 = 6 # mm Bore 1 (d1 <= d2) d2 = 8 # mm Bore 2 detail = "full" # full: hubs, spacer, slits and clamp screw holes; simple: one solid with the bores # number: (hub D, spacer D1, spacer bore d3, L, hub length l, screw offset A, screw from the end F, clamp screw M, bores offered). # MISUMI Couplings catalogue, Oldham Couplings, Clamping, MCOC table, https://de.misumi-ec.com/files/images/products/docs/flexibleshaftcouplings.pdf, PDF p. 16. SIZES = { 15: (14.5, 15, 5.0, 18.4, 6.6, 4.5, 3.2, 2.5, (4, 5, 6)), 17: (16.8, 17.5, 7.2, 24.4, 9, 5, 4, 3, (5, 6, 6.35)), 20: (20, 21, 8.2, 27.2, 10, 7, 4.5, 3, (6, 6.35, 7, 8, 9.53, 10)), 26: (26, 27, 12.0, 30.4, 11.5, 8.4, 5, 4, (6, 6.35, 7, 8, 9.53, 10, 11, 12)), } D, D1, d3, L, hub, A, F, screw, bores = SIZES[size] if d1 not in bores or d2 not in bores or d1 > d2: raise ValueError(f"The number {size} Oldham coupling offers bores {bores}, with d1 <= d2.") SLIT = 0.05 * D # the slit's width, for looks def half(z0, bore): shape = cq.Workplane("XY").workplane(offset=z0).circle(D / 2).extrude(hub) shape = shape.cut(cq.Workplane("XY").workplane(offset=z0 - 1).circle(bore / 2).extrude(hub + 2)) shape = shape.cut(cq.Workplane("XY").workplane(offset=z0 - 1).center(D / 4 + 0.5, 0).rect(D / 2 + 1, SLIT).extrude(hub + 2)) return shape model = Model() if detail == "simple": body = cq.Workplane("XY").circle(D / 2).extrude(L).union(cq.Workplane("XY").workplane(offset=hub).circle(D1 / 2).extrude(L - 2 * hub), clean=False) 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.add("body", body, name="Oldham coupling") model.material("steel-generic", color="#9a9da3") else: first, second = half(0, d1), half(L - hub, d2) for z in (F, L - F): cross = cq.Workplane("YZ").center(A, z).circle(screw / 2).extrude(D, both=True) first, second = first.cut(cross), second.cut(cross) spacer = cq.Workplane("XY").workplane(offset=hub).circle(D1 / 2).circle(d3 / 2).extrude(L - 2 * hub) model.add("hub_1", first, op="new", body="hub_1_body", name="Hub, d1") model.add("hub_2", second, op="new", body="hub_2_body", name="Hub, d2") model.add("spacer", spacer, op="new", body="spacer_body", name="Spacer") model.material("steel-generic", bodies=["hub_1_body", "hub_2_body"], color="#9a9da3") model.material("pa6", bodies=["spacer_body"], color="#26282b") result = model.result()