"""PCB card guide and board retaining clip, boards 1 to 2.4 mm thick, any length: as step.parts' published models draw them. A rectangular bar along X (centred on the origin, base on the XY plane) with a board slot along its top: - guide: the slot runs the full length; - retain-clip: the slot stops short of the +X end, and an end lip stands above the bar there, overhanging the end. See the README. """ from steve import Model kind = "guide" # Kind: guide or retain-clip board = "1.6" # Board thickness (mm) length = 100 # mm Length material = "unspecified" # Material # mm, measured on step.parts' models pcb_card_guide_boardmm_l and pcb_board_retain_clip_... (every planar # face read): the same body for every board and length BODY = { "width": 8.0, # across (Y) "height": 6.0, # bar top (Z) "floor": 1.8, # slot floor above the base "lip_top": 6.6, # clip: lip top "lip_inset": 1.0, # clip: the slot stops this far from the +X end; the lip starts there "lip_overhang": 1.0, # clip: the lip overhangs the +X end by this } # board thickness: slot width (board + 0.3 in every model) SLOTS = {"1": 1.3, "1.2": 1.5, "1.6": 1.9, "2": 2.3, "2.4": 2.7} # material choice: (STEVE material library id, appearance colour); the models name no material MATERIALS = {"unspecified": (None, None), "nylon": ("pa6", "#ece9e1"), "pom": ("pom-copolymer", "#f2f2ee")} b = BODY slot = SLOTS[board] material_id, colour = MATERIALS[material] end = length / 2 model = Model() model.box("bar", length, b["width"], b["height"], at=(0, 0, b["height"] / 2), name="Bar") slot_end = end if kind == "guide" else end - b["lip_inset"] model.box("slot", slot_end + end, slot, b["height"], at=((slot_end - end) / 2, 0, b["floor"] + b["height"] / 2), op="cut", name="Board slot") if kind == "retain-clip": lip_len = b["lip_inset"] + b["lip_overhang"] lip_h = b["lip_top"] - b["floor"] model.box("lip", lip_len, b["width"], lip_h, at=(end - b["lip_inset"] + lip_len / 2, 0, b["floor"] + lip_h / 2), op="join", name="End lip") if material_id: model.material(material_id, color=colour) result = model.result()