"""Box film capacitor (WIMA MKS 2, FKS 3 and MKS 4 cases), radial leads. Lead 1 is at the origin, lead 2 at +X by the pitch, the box standing on the XY plane centred between them, the leads down through the board. Case sizes from WIMA's data sheets in the README.""" from steve import Model series = "MKS4" # Series width = 4.0 # mm Box width W height = 9.0 # mm Box height H length = 13.0 # mm Box length L pitch = 10.0 # mm Lead pitch (PCM) detail = "full" # full: box and leads; simple: the box only # series: the case sizes offered, (W, H, L, PCM) in mm. WIMA data sheets, General Data tables: MKS 2 (e_WIMA_MKS_2.pdf), FKS 3 (e_WIMA_FKS_3.pdf), MKS 4 # (e_WIMA_MKS_4.pdf), https://www.wima.de/wp-content/uploads/media/. CASES = { "MKS2": ((2.5, 6.5, 7.2, 5), (3, 7.5, 7.2, 5), (3.5, 8.5, 7.2, 5), (4.5, 9.5, 7.2, 5), (5, 10, 7.2, 5), (5.5, 11.5, 7.2, 5), (7.2, 13, 7.2, 5), (8.5, 14, 7.2, 5), (11, 16, 7.2, 5), (11, 18, 7.2, 5)), "FKS3": ((3, 8.5, 10, 7.5), (3, 9, 13, 10), (4, 9.5, 13, 10), (5, 11, 13, 10), (6, 12, 13, 10), (6, 12.5, 18, 15), (7, 14, 18, 15), (8, 15, 18, 15), (9, 16, 18, 15)), "MKS4": ((2.5, 7, 10, 7.5), (3, 8.5, 10, 7.5), (4, 9, 10, 7.5), (4, 9, 13, 10), (4.5, 9.5, 10.3, 7.5), (5, 10.5, 10.3, 7.5), (5, 11, 13, 10), (5, 11, 18, 15), (5.7, 12.5, 10.3, 7.5), (6, 12, 13, 10), (6, 12.5, 18, 15), (6, 15, 26.5, 22.5), (7, 14, 18, 15), (7, 16.5, 26.5, 22.5), (8, 15, 18, 15), (8.5, 18.5, 26.5, 22.5), (9, 16, 18, 15), (9, 19, 31.5, 27.5), (10.5, 19, 26.5, 22.5), (11, 21, 26.5, 22.5), (11, 21, 31.5, 27.5), (13, 24, 31.5, 27.5), (13, 24, 41.5, 37.5), (15, 26, 31.5, 27.5), (15, 26, 41.5, 37.5), (17, 29, 31.5, 27.5), (17, 29, 41.5, 37.5), (17, 34.5, 31.5, 27.5), (19, 32, 41.5, 37.5), (20, 39.5, 31.5, 27.5), (20, 39.5, 41.5, 37.5), (24, 45.5, 41.5, 37.5), (25, 45, 57, 52.5), (31, 46, 41.5, 37.5), (35, 50, 41.5, 37.5), (35, 50, 57, 52.5), (40, 55, 41.5, 37.5)), } PIN_LENGTH = 6 # the data sheets' standard pin length, 6 -2 if (width, height, length, pitch) not in CASES[series]: raise ValueError(f"WIMA {series} has no {width} x {height} x {length} case at {pitch} mm pitch.") # lead diameter from the sheets' notes: 0.5 at 5 mm pitch and at W = 3 or less, 0.6 at 7.5 and 10, 0.8 at 15 to 27.5, 1.0 at 37.5 and over lead = 0.5 if pitch <= 5 or width <= 3 else 0.6 if pitch <= 10 else 0.8 if pitch <= 27.5 else 1.0 model = Model() with model.sketch("box_sketch", on="XY", name="Box") as sk: sk.rect("box_rect", (pitch / 2 - length / 2, -width / 2), (pitch / 2 + length / 2, width / 2)) model.extrude("box", "box_sketch", distance=height, name="Box") if detail == "full": model.plane("lead_plane", on="XY", offset=-PIN_LENGTH, name="Leads") with model.sketch("leads_sketch", on="lead_plane", name="Leads") as sk: sk.circle("lead_1", (0, 0), lead / 2) sk.circle("lead_2", (pitch, 0), lead / 2) model.extrude("leads", "leads_sketch", distance=PIN_LENGTH + 1, name="Leads") model.material("pla", color="#c8362e") result = model.result()