"""Surface-mount coin cell retainer clip (Multicomp BC-2001, for 20 mm cells such as CR2032): a formed 0.3 mm phosphor bronze strap whose top plate holds the cell down onto a board pad, standing on two feet with location holes. Centred on the origin in X and Y with the board on the XY plane, the feet along X. The cell and the board's centre pad aren't part of it. Dimensions from the maker's drawing; see the README.""" from steve import Model part_number = "BC-2001" # Multicomp part number # Multicomp BC-2001 drawing M10002761 rev A (released 10/12/11), sheet 1 of 1, via farnell.com/datasheets/1505853.pdf, mm, +/-0.05 unless stated: # material 0.3 phosphor bronze, nickel plate; overall 30.5 x 19.8 x 3.85; legs 21.1 apart (outside), bent 90 +/-0.1 deg; feet 5.1 wide with # 2.35 holes 25.9 apart, 10.5 from the plate's straight edge; plate 15.8 high at its sides, 19.8 over the lobes, its straight edge 7.5 long. CLIPS = { "BC-2001": (30.5, 19.8, 3.85, 0.3, 21.1, 5.1, 2.35, 25.9, 10.5, 15.8, 7.5), } # Proportions, for looks only (the drawing is not to scale and gives no figure for them): where the plate's slanted lower edges meet its sides # (CORNER_Y), the shape of the two lobes and the dip between them along the top edge (TOP_EDGE), and the feet lying centred on their holes (the # drawing shows them so). Not modelled: the two spring tongues and the dimples under the plate, whose places in plan aren't dimensioned. CORNER_Y = 5.0 TOP_EDGE = ((10.2, 17.9), (9.2, 19.3), (7.8, 19.8), (6.6, 19.6), (5.0, 18.8), (2.5, 18.1), (0.0, 17.9)) length, depth, top, sheet, legs, foot_width, hole, hole_pitch, hole_y, side_height, flat = CLIPS[part_number] y0 = -depth / 2 # the plate's straight edge foot_y = y0 + hole_y # the feet and their holes half = legs / 2 # outside face of each leg right = [(flat / 2, y0), (half, y0 + CORNER_Y), (half, y0 + side_height)] + [(x, y0 + y) for x, y in TOP_EDGE] outline = right + [(-x, y) for x, y in reversed(right) if x > 0] model = Model() model.plane("plate_plane", on="XY", offset=top - sheet, name="Plate") with model.sketch("plate_sketch", on="plate_plane", name="Plate") as sk: sk.polyline("plate_outline", outline, closed=True) model.extrude("plate", "plate_sketch", distance=sheet, op="new", body="clip_body", name="Plate") with model.sketch("legs_sketch", on="XY", name="Legs") as sk: sk.rect("leg_right", (half - sheet, foot_y - foot_width / 2), (half, foot_y + foot_width / 2)) sk.rect("leg_left", (-half, foot_y - foot_width / 2), (-half + sheet, foot_y + foot_width / 2)) model.extrude("legs", "legs_sketch", distance=top, op="join", body="clip_body", name="Legs") with model.sketch("feet_sketch", on="XY", name="Feet") as sk: sk.rect("foot_right", (half - sheet, foot_y - foot_width / 2), (length / 2, foot_y + foot_width / 2)) sk.rect("foot_left", (-length / 2, foot_y - foot_width / 2), (-half + sheet, foot_y + foot_width / 2)) model.extrude("feet", "feet_sketch", distance=sheet, op="join", body="clip_body", name="Feet") with model.sketch("holes_sketch", on="XY", name="Location holes") as sk: sk.circle("hole_right", (hole_pitch / 2, foot_y), hole / 2) sk.circle("hole_left", (-hole_pitch / 2, foot_y), hole / 2) model.extrude("holes", "holes_sketch", distance=sheet, op="cut", body="clip_body", name="Location holes") # Phosphor bronze, nickel plated (the plating isn't modelled). model.material("bronze", bodies=["clip_body"], color="#c9ccd1") result = model.result()