"""Ball screw end support, one solid. BK and BF: rectangular, foot on the XY plane, screw along Y at height h, shaft end towards -Y. FK and FF: round with a square flange, flange's face on the XY plane, screw along Z. The bearings aren't modelled. Dimensions in the README.""" import math import cadquery as cq from steve import Model designation = "BK10" # Support unit detail = "full" # full: with the mounting and retainer holes; simple: outline and bore only # TBI Ball Screw Support Units, Anaheim Automation sheets L011175 (BK), L011178 (BF), L011176 (FK), L011179 (FF). # BK: (d1, d2, L, L1, L2, L3, C1, C2, B, H, b, h, B1, H1, E, P, X, Y, Z) BK = { "BK10": (10, 5.5, 25, 5, 29, 5, 13, 6, 60, 39, 30, 22, 34, 32.5, 15, 46, 6.6, 10.8, 5), "BK12": (12, 5.5, 25, 5, 29, 5, 13, 6, 60, 43, 30, 25, 34, 32.5, 18, 46, 6.6, 10.8, 1.5), "BK15": (15, 5.5, 27, 6, 32, 6, 15, 6, 70, 48, 35, 28, 40, 38, 18, 54, 6.6, 11, 6.5), "BK17": (17, 6.6, 35, 9, 44, 7, 19, 8, 86, 64, 43, 39, 50, 55, 28, 68, 9, 14, 8.5), "BK20": (20, 6.6, 35, 8, 43, 8, 19, 8, 88, 60, 44, 34, 52, 50, 22, 70, 9, 14, 8.5), "BK25": (25, 9.0, 42, 12, 54, 9, 22, 10, 106, 80, 53, 48, 64, 70, 33, 85, 11, 17.5, 11), "BK30": (30, 11, 45, 14, 61, 9, 23, 11, 128, 89, 64, 51, 76, 78, 33, 102, 14, 20, 13), "BK35": (35, 11, 50, 14, 67, 12, 26, 12, 140, 96, 70, 52, 88, 79, 35, 114, 14, 20, 13), "BK40": (40, 14, 61, 18, 76, 15, 33, 14, 160, 110, 80, 60, 100, 90, 37, 130, 18, 26, 17.5), } # BF: (d1, L, B, H, b, h, B1, H1, E, P, d2, X, Y, Z) BF = { "BF10": (8, 20, 60, 39, 30, 22, 34, 32.5, 15, 46, 5.5, 6.6, 10.8, 5), "BF12": (10, 20, 60, 43, 30, 25, 34, 32.5, 18, 46, 5.5, 6.6, 10.8, 1.5), "BF15": (15, 20, 70, 48, 35, 28, 40, 38, 18, 54, 5.5, 6.6, 11, 6.5), "BF17": (17, 23, 86, 64, 43, 39, 50, 55, 28, 68, 6.6, 9, 14, 8.5), "BF20": (20, 26, 88, 60, 44, 34, 52, 50, 22, 70, 6.6, 9, 14, 8.5), "BF25": (25, 30, 106, 80, 53, 48, 64, 70, 33, 85, 9, 11, 17.5, 11), "BF30": (30, 32, 128, 89, 64, 51, 76, 78, 33, 102, 11, 14, 20, 13), "BF35": (35, 32, 140, 96, 70, 52, 88, 79, 35, 114, 11, 14, 20, 13), "BF40": (40, 37, 160, 110, 80, 60, 100, 90, 37, 130, 14, 18, 26, 17.5), } # FK: (d1, L, H, F, E, D, A, PCD, B, L1, T1, X, Y, Z) FK = { "FK8": (8, 23, 9, 14, 26, 28, 43, 35, 35, 7, 4, 3.4, 6.5, 4), "FK10": (10, 27, 10, 17, 29.5, 34, 52, 42, 42, 7.5, 5, 4.5, 8, 4), "FK12": (12, 27, 10, 17, 29.5, 36, 54, 44, 44, 7.5, 5, 4.5, 8, 4), "FK15": (15, 32, 15, 17, 36, 40, 63, 50, 52, 10, 6, 5.5, 9.5, 6), "FK20": (20, 52, 22, 30, 50, 57, 85, 70, 68, 8, 10, 6.6, 11, 10), "FK25": (25, 57, 27, 30, 60, 63, 98, 80, 79, 13, 10, 9, 15, 13), "FK30": (30, 62, 30, 32, 61, 75, 117, 95, 93, 11, 12, 11, 17.5, 15), } # FF: (d1, L, H, F, D, A, PCD, B, X, Y, Z) FF = { "FF6": (6, 10, 6, 4, 22, 36, 28, 28, 3.4, 6.5, 4), "FF10": (8, 12, 7, 5, 28, 43, 35, 35, 3.4, 6.5, 4), "FF12": (10, 15, 7, 8, 34, 52, 42, 42, 4.5, 8, 4), "FF15": (15, 17, 9, 8, 40, 63, 50, 52, 5.5, 9.5, 5.5), "FF20": (20, 20, 11, 9, 57, 85, 70, 68, 6.6, 11, 6.5), "FF25": (25, 24, 14, 10, 63, 98, 80, 79, 9, 14, 8.5), "FF30": (30, 27, 18, 9, 75, 117, 95, 93, 11, 17.5, 11), } def rectangular(d1, L, B, H, h, B1, H1, E, P, d2, X, Y, Z, collar): """The wings to H1 and the centre block to H, extruded from y = 0 to L, with a shaft-end collar towards -Y when collar > 0.""" outline = [(-B / 2, 0), (B / 2, 0), (B / 2, H1), (B1 / 2, H1), (B1 / 2, H), (-B1 / 2, H), (-B1 / 2, H1), (-B / 2, H1)] body = cq.Workplane("XZ").polyline(outline).close().extrude(-L) if collar: body = body.union(cq.Workplane("XZ").center(0, h).circle(0.8 * d1 + 2).extrude(collar), clean=False) body = body.cut(cq.Workplane("XZ").workplane(offset=collar + 1).center(0, h).circle(d1 / 2).extrude(-(L + collar + 2))) if detail == "full": low = (H1 - E) / 2 # the pair of wing holes is centred on the wing, for looks: the sheet gives E between them, not their height for x in (-P / 2, P / 2): for z in (low, low + E): body = body.cut(cq.Workplane("XZ").workplane(offset=1).center(x, z).circle(d2 / 2).extrude(-(L + 2))) reach = B1 / 2 - Y / 2 - 0.5 # the block's four counterbored holes: X, Y and Z are the sheet's, their places a proportion, for looks for x in (-reach, reach): for z in (h - reach, h + reach): if z + Y / 2 < H and z - Y / 2 > 0: body = body.cut(cq.Workplane("XZ").workplane(offset=1).center(x, z).circle(X / 2).extrude(-(L + 2))) body = body.cut(cq.Workplane("XZ").workplane(offset=-L + Z).center(x, z).circle(Y / 2).extrude(-(Z + 1))) return body def round_unit(d1, L, H, D, A, PCD, B, X, Y, Z, collar): """The flange (the square B cut by the circle A) from z = 0 to H, the body D to L, and a shaft-end collar below when collar > 0.""" flange = cq.Workplane("XY").rect(B, B).extrude(H).intersect(cq.Workplane("XY").circle(A / 2).extrude(H)) body = flange.union(cq.Workplane("XY").circle(D / 2).extrude(L), clean=False) if collar: body = body.union(cq.Workplane("XY").workplane(offset=-collar).circle(0.8 * d1 + 2).extrude(collar), clean=False) body = body.cut(cq.Workplane("XY").workplane(offset=-collar - 1).circle(d1 / 2).extrude(L + collar + 2)) if detail == "full": at = PCD / 2 / math.sqrt(2) for x in (-at, at): for y in (-at, at): body = body.cut(cq.Workplane("XY").workplane(offset=-1).center(x, y).circle(X / 2).extrude(H + 2)) body = body.cut(cq.Workplane("XY").workplane(offset=H - Z).center(x, y).circle(Y / 2).extrude(Z + 1)) return body model = Model() if designation in BK: d1, d2, L, L1, L2, L3, C1, C2, B, H, b, h, B1, H1, E, P, X, Y, Z = BK[designation] shape = rectangular(d1, L, B, H, h, B1, H1, E, P, d2, X, Y, Z, L1) elif designation in BF: d1, L, B, H, b, h, B1, H1, E, P, d2, X, Y, Z = BF[designation] shape = rectangular(d1, L, B, H, h, B1, H1, E, P, d2, X, Y, Z, 0) elif designation in FK: d1, L, H, F, E, D, A, PCD, B, L1, T1, X, Y, Z = FK[designation] shape = round_unit(d1, L, H, D, A, PCD, B, X, Y, Z, L1) else: d1, L, H, F, D, A, PCD, B, X, Y, Z = FF[designation] shape = round_unit(d1, L, H, D, A, PCD, B, X, Y, Z, 0) model.add("body", shape, name="Support unit") model.material("steel-generic", color="#26282b") result = model.result()