"""Molded SMD power inductor, Sunlord MWSA-S series sizes. Centred on the origin, sitting on the XY plane, with the two terminals at the -X and +X ends. Dimensions from Sunlord's MWSA-S datasheet table for the size named by `series`; see the README.""" from steve import Model series = "MWSA0603S" # Sunlord MWSA-S size code e_mm = "5.0" # terminal width E for MWSA1204S, MWSA1205S and MWSA1206S, which have two, set by inductance value (see TERMINAL_E); other sizes ignore it # size: (A width, B length, C height, D terminal length, E terminal width), each (min, max), mm. Sunlord "Molded SMD Power Inductors - MWSA-S Series", # Revised 2023/1/11, Shape and Dimensions table (page 2). Values printed as "Max" are entered as (max, max). E of None: see TERMINAL_E. SIZES = { "MWSA0412S": ((3.95, 4.45), (4.05, 4.75), (0.8, 1.2), (0.5, 1.1), (1.7, 2.3)), "MWSA0402S": ((3.95, 4.45), (4.05, 4.75), (1.6, 2.0), (0.5, 1.1), (1.7, 2.3)), "MWSA0518S": ((5.0, 5.4), (5.05, 5.75), (1.4, 1.8), (1.0, 1.4), (1.9, 2.5)), "MWSA0503S": ((5.0, 5.4), (5.05, 5.75), (2.6, 3.0), (1.0, 1.4), (1.9, 2.5)), "MWSA0615S": ((6.4, 6.8), (6.7, 7.3), (1.1, 1.5), (1.3, 1.9), (2.7, 3.3)), "MWSA0618S": ((6.4, 6.8), (6.7, 7.3), (1.4, 1.8), (1.3, 1.9), (2.7, 3.3)), "MWSA0602S": ((6.4, 6.8), (6.7, 7.3), (1.6, 2.0), (1.3, 1.9), (2.7, 3.3)), "MWSA0624S": ((6.4, 6.8), (6.7, 7.3), (2.0, 2.4), (1.3, 1.9), (2.7, 3.3)), "MWSA0603S": ((6.4, 6.8), (6.7, 7.3), (2.6, 3.0), (1.3, 1.9), (2.7, 3.3)), "MWSA0604S": ((6.4, 6.8), (6.7, 7.3), (3.6, 4.0), (1.3, 1.9), (2.7, 3.3)), "MWSA0605S": ((6.4, 6.8), (6.7, 7.3), (4.6, 5.0), (1.3, 1.9), (2.7, 3.3)), "MWSA0804S": ((8.4, 9.2), (7.9, 8.5), (3.6, 4.0), (1.1, 1.7), (4.7, 5.3)), "MWSA1003S": ((9.7, 10.3), (11.5, 11.5), (2.6, 3.0), (1.5, 2.5), (2.7, 3.3)), "MWSA1004S": ((9.7, 10.3), (10.5, 11.5), (3.6, 4.0), (1.5, 2.5), (2.5, 3.5)), "MWSA1005S": ((9.7, 10.3), (11.5, 11.5), (4.6, 5.0), (1.5, 2.5), (2.5, 3.5)), "MWSA1204S": ((12.3, 13.3), (13.1, 13.8), (4.0, 4.0), (1.5, 2.5), None), "MWSA1205S": ((12.3, 12.9), (13.1, 13.8), (4.6, 5.0), (1.5, 2.5), None), "MWSA1206S": ((12.3, 12.9), (13.1, 13.8), (5.6, 6.0), (1.5, 2.5), None), "MWSA1265S": ((12.3, 12.9), (13.1, 13.8), (6.5, 6.5), (1.5, 2.5), (4.7, 5.3)), "MWSA1707S": ((17.15, 17.15), (16.8, 17.5), (6.4, 7.0), (2.0, 3.0), (11.7, 12.3)), "MWSA2213S": ((21.7, 22.3), (23.0, 24.0), (12.2, 13.0), (4.6, 5.4), (18.7, 19.3)), } # The same datasheet's Remarks table (page 3): E by inductance code for the three sizes that have two terminal widths. TERMINAL_E = { "MWSA1204S": {"3.85": ("R22", "R47"), "5.0": ("R68", "R82", "1R0", "1R5", "2R2", "3R3", "4R7", "6R8", "100", "150", "220")}, "MWSA1205S": {"3.85": ("R22", "R36", "R50", "R68", "R82", "1R0", "1R5", "2R2"), "5.0": ("3R3", "4R7", "6R8", "100", "150", "220", "330", "470")}, "MWSA1206S": {"3.85": ("R68", "1R5", "2R2"), "5.0": ("3R3", "4R7", "5R6", "6R8", "8R2", "100", "120", "150", "180", "220", "270", "330", "470", "680", "101", "121", "151")}, } E_RANGE = {"3.85": (3.35, 4.35), "5.0": (4.7, 5.3)} PAD_T = 0.1 # terminal thickness under the body: a proportion, for looks def mid(pair): return (pair[0] + pair[1]) / 2 A, B, C, D, E = SIZES[series] width, length, height, term_l = mid(A), mid(B), mid(C), mid(D) term_w = mid(E if E is not None else E_RANGE[e_mm]) model = Model() model.plane("body_plane", on="XY", offset=PAD_T, name="Body") with model.sketch("body_sketch", on="body_plane", name="Body") as sk: sk.rect("body_rect", (-length / 2, -width / 2), (length / 2, width / 2)) model.extrude("body", "body_sketch", distance=height - PAD_T, name="Body") with model.sketch("terms_sketch", on="XY", name="Terminals") as sk: sk.rect("term_left", (-length / 2, -term_w / 2), (-length / 2 + term_l, term_w / 2)) sk.rect("term_right", (length / 2 - term_l, -term_w / 2), (length / 2, term_w / 2)) model.extrude("terms", "terms_sketch", distance=PAD_T + 0.05, name="Terminals") model.material("pla", color="#3a3c40") result = model.result()