"""Linear bushing (linear ball bearing) for round shafts, LM series: straight (LM), round flange (LMF) or square flange (LMK), metric shaft diameters 3 to 60 mm. Envelope model for assemblies: the outer sleeve (outside diameter D, length L) around the shaft bore dr; the straight type has its two retaining-ring grooves (width L2, groove diameter D0, outer edges L1 apart, centred); flanged types have the flange (diameter D1, for LMK cut to a square K across flats; width H) at one end with four mounting holes d1 on the PCD, counterbored d2 x h from the flange face. Balls, retainer and seals are not modelled. Axis along Z, from z = 0 (flange face) to z = L. """ import math from steve import Model size = "8" # Shaft diameter (size code) style = "LM" # Type # THK General Catalog, Linear Bushing (515-1E), model LM, pages A4-42/43 (https://tech.thk.com/en/products/pdfs/en_a04_042.pdf). # size: (inscribed bore dr, outside diameter D, length L, groove span L1, groove width L2, groove diameter D0) # (L1, L2, D0 are None where the catalogue gives no grooves.) LM = { "3": (3, 7, 10, None, None, None), "4": (4, 8, 12, None, None, None), "5": (5, 10, 15, 10.2, 1.1, 9.6), "6": (6, 12, 19, 13.5, 1.1, 11.5), "8S": (8, 15, 17, 11.5, 1.1, 14.3), "8": (8, 15, 24, 17.5, 1.1, 14.3), "10": (10, 19, 29, 22, 1.3, 18), "12": (12, 21, 30, 23, 1.3, 20), "13": (13, 23, 32, 23, 1.3, 22), "16": (16, 28, 37, 26.5, 1.6, 27), "20": (20, 32, 42, 30.5, 1.6, 30.5), "25": (25, 40, 59, 41, 1.85, 38), "30": (30, 45, 64, 44.5, 1.85, 43), "35": (35, 52, 70, 49.5, 2.1, 49), "40": (40, 60, 80, 60.5, 2.1, 57), "50": (50, 80, 100, 74, 2.6, 76.5), "60": (60, 90, 110, 85, 3.15, 86.5), } # THK models LMF (A4-52/53) and LMK (A4-60/61): same dr, D, L as LM. # size: (flange diameter D1, square K (LMK), flange width H, PCD, hole d1, counterbore d2, counterbore depth h) FLANGES = { "6": (28, 22, 5, 20, 3.4, 6.5, 3.3), "8S": (32, 25, 5, 24, 3.4, 6.5, 3.3), "8": (32, 25, 5, 24, 3.4, 6.5, 3.3), "10": (39, 30, 6, 29, 4.5, 8, 4.4), "12": (42, 32, 6, 32, 4.5, 8, 4.4), "13": (43, 34, 6, 33, 4.5, 8, 4.4), "16": (48, 37, 6, 38, 4.5, 8, 4.4), "20": (54, 42, 8, 43, 5.5, 9.2, 5.4), "25": (62, 50, 8, 51, 5.5, 9.2, 5.4), "30": (74, 58, 10, 60, 6.6, 11, 6.5), "35": (82, 64, 10, 67, 6.6, 11, 6.5), "40": (96, 75, 13, 78, 9, 14, 8.6), "50": (116, 92, 13, 98, 9, 14, 8.6), "60": (134, 106, 18, 112, 11, 17.5, 10.8), } if style != "LM" and size not in FLANGES: raise ValueError(f"{style}{size}: not made with a flange; flanged sizes: {', '.join(FLANGES)}.") dr, D, L, L1, L2, D0 = LM[size] model = Model() with model.sketch("sleeve_sketch", on="XY", name="Sleeve") as sk: sk.circle("outside", (0, 0), D / 2) sk.circle("bore", (0, 0), dr / 2) model.extrude("sleeve", "sleeve_sketch", distance=L, name="Sleeve") if style == "LM" and L1 is not None: model.plane("groove_1_plane", on="XY", offset=(L - L1) / 2, name="Groove 1") with model.sketch("groove_1_sketch", on="groove_1_plane", name="Groove 1") as sk: sk.circle("groove_out", (0, 0), D / 2 + 1) sk.circle("groove_in", (0, 0), D0 / 2) model.extrude("groove_1", "groove_1_sketch", distance=L2, op="cut", name="Groove 1") model.plane("groove_2_plane", on="XY", offset=(L + L1) / 2 - L2, name="Groove 2") with model.sketch("groove_2_sketch", on="groove_2_plane", name="Groove 2") as sk: sk.circle("groove_out", (0, 0), D / 2 + 1) sk.circle("groove_in", (0, 0), D0 / 2) model.extrude("groove_2", "groove_2_sketch", distance=L2, op="cut", name="Groove 2") if style != "LM": D1, K, H, PCD, d1, d2, h = FLANGES[size] if style == "LMK": # Square flange K across flats with its corners on the circle D1: four flats joined by four arcs. r = D1 / 2 c = K / 2 s = math.sqrt(r * r - c * c) t = math.degrees(math.atan2(s, c)) # where a flat meets the circle, from the x axis with model.sketch("flange_sketch", on="XY", name="Flange") as sk: sk.line("flat_right", (c, -s), (c, s)) sk.arc("corner_1", (0, 0), r, t, 90 - t) sk.line("flat_top", (s, c), (-s, c)) sk.arc("corner_2", (0, 0), r, 90 + t, 180 - t) sk.line("flat_left", (-c, s), (-c, -s)) sk.arc("corner_3", (0, 0), r, 180 + t, 270 - t) sk.line("flat_bottom", (-s, -c), (s, -c)) sk.arc("corner_4", (0, 0), r, 270 + t, 360 - t) sk.circle("flange_in", (0, 0), D / 2) a = PCD / 2 * math.sqrt(0.5) # holes on the diagonals b = a else: with model.sketch("flange_sketch", on="XY", name="Flange") as sk: sk.circle("flange_out", (0, 0), D1 / 2) sk.circle("flange_in", (0, 0), D / 2) a = PCD / 2 # holes on the axes b = 0.0 model.extrude("flange", "flange_sketch", distance=H, name="Flange") with model.sketch("holes_sketch", on="XY", name="Mounting holes") as sk: sk.circle("hole_1", (a, b), d1 / 2) sk.circle("hole_2", (-b, a), d1 / 2) sk.circle("hole_3", (-a, -b), d1 / 2) sk.circle("hole_4", (b, -a), d1 / 2) model.extrude("holes", "holes_sketch", distance=H, op="cut", name="Mounting holes") with model.sketch("cbore_sketch", on="XY", name="Counterbores") as sk: sk.circle("cbore_1", (a, b), d2 / 2) sk.circle("cbore_2", (-b, a), d2 / 2) sk.circle("cbore_3", (-a, -b), d2 / 2) sk.circle("cbore_4", (b, -a), d2 / 2) model.extrude("cbores", "cbore_sketch", distance=h, op="cut", name="Counterbores") model.material("steel-generic", color="#b9bdc2") result = model.result()