"""19-inch rack panel: a flat aluminium blank panel, 1U to 4U, with four open mounting slots at its ends, from Hammond Manufacturing's PBPA series drawings (EIA-310 rack). The panel lies on the XY plane, its back face down and its front face up (+Z): its width along X, centred on the origin, and its height along Y, the bottom edge on the X axis. Dimensions are in the README.""" from steve import Model units = "1U" # Rack units (panel height) finish = "black" # Finish INCH = 25.4 # Each entry: (Hammond part number, panel height, first slot below the top edge, slot spacing), inches. # Hammond Manufacturing dimensional drawings PBPA19001, PBPA19003, PBPA19005 and PBPA19007 (no revision shown), front view, copies # hosted by AutomationDirect at cdn.automationdirect.com/static/drawings/PBPA19001BK.pdf (and ...19003BK, 19005BK, 19007BK): # 1U 1.72 high, slots .23 below the top and 1.25 apart; 2U 3.47, .23, 3.00; 3U 5.22, 1.48, 2.25; 4U 6.97, 1.48, 4.00. UNITS = { "1U": ("PBPA19001", 1.72, 0.23, 1.25), "2U": ("PBPA19003", 3.47, 0.23, 3.00), "3U": ("PBPA19005", 5.22, 1.48, 2.25), "4U": ("PBPA19007", 6.97, 1.48, 4.00), } # The same drawings, every size: width 19.00, slot centres 18.19 apart, 4X 0.250 x 0.531 slot (open at the end edge, 0.531 deep, a # 0.250 wide slot with a round end), material 0.125" aluminium (notes), inches. WIDTH = 19.00 SLOT_CENTRES = 18.19 SLOT_WIDTH = 0.250 SLOT_DEPTH = 0.531 THICKNESS = 0.125 # Finish: the drawings' part-number suffixes (BK2 painted black, CG2 RAL 7032 grey, GY2 ASA 61 grey, LG2 RAL 7035 grey, UNF unfinished); # AutomationDirect's PBPA19001BK cut sheet names the alloy 5052-H32. Colours are for looks only. FINISHES = { "black": ("BK2", "#1d1e20"), "ral7032-gray": ("CG2", "#b5b39a"), "asa61-gray": ("GY2", "#8e9294"), "ral7035-gray": ("LG2", "#c8cac7"), "unfinished": ("UNF", "#d4d7db"), } if units not in UNITS: raise ValueError(f"no size {units!r}: {', '.join(UNITS)}") if finish not in FINISHES: raise ValueError(f"no finish {finish!r}: {', '.join(FINISHES)}") _, height_in, first_in, pitch_in = UNITS[units] W, H, t = WIDTH * INCH, height_in * INCH, THICKNESS * INCH r = SLOT_WIDTH * INCH / 2 # The slot's round end: its centre is SLOT_DEPTH - radius in from the end edge, which puts the left and right centres # 19.00 - 2 x 0.406 = 18.19 apart, the drawing's centre distance. inset = SLOT_DEPTH * INCH - r slot_y = [H - first_in * INCH, H - (first_in + pitch_in) * INCH] model = Model() with model.sketch("panel_sketch", on="XY", name="Panel") as sk: sk.rect("panel_rect", (-W / 2, 0), (W / 2, H)) model.extrude("panel", "panel_sketch", distance=t, op="new", body="panel_body", name="Panel") # The slots, cut in two steps (the straight part from the end edge, then the round end) so that no sketch has overlapping shapes. with model.sketch("slot_sketch", on="XY", name="Mounting slots") as sk: for i, y in enumerate(slot_y): for side, sx in (("left", -1), ("right", 1)): x_edge, x_centre = sx * (W / 2 + 1), sx * (W / 2 - inset) sk.rect(f"slot_{side}_{i}_rect", (min(x_edge, x_centre), y - r), (max(x_edge, x_centre), y + r)) model.extrude("slots", "slot_sketch", distance=t, op="cut", body="panel_body", name="Mounting slots") with model.sketch("slot_end_sketch", on="XY", name="Slot ends") as sk: for i, y in enumerate(slot_y): for side, sx in (("left", -1), ("right", 1)): sk.circle(f"slot_{side}_{i}_end", (sx * (W / 2 - inset), y), r) model.extrude("slot_ends", "slot_end_sketch", distance=t, op="cut", body="panel_body", name="Slot ends") # Material: 5052-H32 aluminium (the cut sheet), painted in the chosen finish. model.material("aluminum-5052-h32", bodies=["panel_body"], color=FINISHES[finish][1]) result = model.result()