"""Linear bushing block, SC series (also sold as SCS): a block with a linear bushing inside, base on the XY plane, shaft along Y at height J. detail = "simple" leaves out the bushing's end and the top holes. Fit dimensions come from THK's table; see the README.""" from steve import Model designation = "SC8UU" # Block detail = "full" # full: top holes and the bushing's end shown; simple: a block with the shaft bore # type: (shaft d, height M, width W, length L, hole pitch B, hole pitch C, tap S, tap depth l, centre height J). # THK General Catalog, Linear Bushing, Models SC6 to 30 dimension table, (515-1E): https://tech.thk.com/en/products/pdfs/en_a04_094.pdf # d: the model number. S and l are the tap. BLOCKS = { "SC6UU": (6, 18, 30, 25, 20, 15, 4, 8, 9), "SC8UU": (8, 22, 34, 30, 24, 18, 4, 8, 11), "SC10UU": (10, 26, 40, 35, 28, 21, 5, 12, 13), "SC12UU": (12, 29, 42, 36, 30.5, 26, 5, 12, 15), "SC13UU": (13, 30, 44, 39, 33, 26, 5, 12, 15), "SC16UU": (16, 38.5, 50, 44, 36, 34, 5, 12, 19), "SC20UU": (20, 42, 54, 50, 40, 40, 6, 12, 21), "SC25UU": (25, 51.5, 76, 67, 54, 50, 8, 18, 26), "SC30UU": (30, 59.5, 78, 72, 58, 58, 8, 18, 30), } # type: linear bushing outside diameter, the same catalogue's LM table as this library's linear-bushing part. BUSHING = {"SC6UU": 12, "SC8UU": 15, "SC10UU": 19, "SC12UU": 21, "SC13UU": 23, "SC16UU": 28, "SC20UU": 32, "SC25UU": 40, "SC30UU": 45} d, M, W, L, B, C, S, depth, J = BLOCKS[designation] model = Model() with model.sketch("body_sketch", on="XY", name="Block") as sk: sk.rect("body", (-W / 2, -L / 2), (W / 2, L / 2)) model.extrude("body", "body_sketch", distance=M, name="Block") with model.sketch("bore_sketch", on="XZ", name="Shaft bore") as sk: sk.circle("bore_circle", (0, J), d / 2) model.extrude("bore", "bore_sketch", distance=L + 1, both=True, op="cut", name="Shaft bore") if detail == "full": # the bushing's end in the bore: its outside diameter and a shallow step, which the block is known by; the step's depth is for looks for end, side in (("front", -1), ("back", 1)): model.plane(f"{end}_plane", on="XZ", offset=side * L / 2, name=f"{end} face") with model.sketch(f"{end}_sketch", on=f"{end}_plane", name="Bushing end") as sk: sk.circle(f"{end}_outer", (0, J), BUSHING[designation] / 2) sk.circle(f"{end}_inner", (0, J), (BUSHING[designation] + d) / 4) model.extrude(f"{end}_step", f"{end}_sketch", distance=-side * 0.03 * L, op="cut", name="Bushing end") model.plane("top_plane", on="XY", offset=M, name="Top") with model.sketch("taps_sketch", on="top_plane", name="Top holes") as sk: for i, (x, y) in enumerate(((-B / 2, -C / 2), (B / 2, -C / 2), (-B / 2, C / 2), (B / 2, C / 2))): sk.circle(f"tap_{i}", (x, y), S / 2) model.extrude("taps", "taps_sketch", distance=-min(depth, M - J - d / 2 - 1), op="cut", name="Top holes") model.material("aluminum-generic", color="#c4c7cc") result = model.result()