"""Shielded high-current SMD power inductor, Würth WE-HCI sizes. Centred on the origin, sitting on the XY plane, with the two terminal tabs at the -Y and +Y ends, centred on X. Dimensions from the Würth datasheet for one order code of the size named by `size`; see the README.""" from steve import Model size = "7040" # WE-HCI size code # size: (body along X, body along Y, height, terminal tab length from the end, tab width), ranges (min, max), mm. Würth Elektronik WE-HCI datasheets, page # 1, Dimensions, one per size (order code, revision, all dated 2019-04-03): 5040 744316470 001.002; 7040 744311100 002.006; 7050 744314200 003.006; 1030 # 744323100 002.006; 1040 7443552100 008.006; 1050 744325330 003.006; 1890 7443556450 004.007; 2212 74435580330 001.001. SIZES = { "5040": ((5.0, 5.6), (5.3, 5.9), (3.7, 4.3), (0.9, 1.5), (0.7, 1.3)), "7040": ((6.6, 7.2), (6.7, 7.3), (3.5, 4.0), (1.5, 2.1), (0.9, 1.5)), "7050": ((6.6, 7.2), (6.7, 7.3), (4.5, 5.0), (1.5, 2.1), (0.9, 1.5)), "1030": ((10.3, 10.9), (10.2, 11.0), (2.5, 3.1), (2.3, 2.9), (1.5, 2.5)), "1040": ((9.7, 10.7), (10.0, 11.0), (3.8, 4.2), (1.5, 2.5), (1.5, 3.0)), "1050": ((9.7, 10.7), (9.5, 11.5), (4.4, 5.0), (2.0, 4.0), (1.7, 2.7)), "1890": ((17.7, 18.7), (17.3, 19.3), (8.6, 9.2), (3.5, 5.5), (3.7, 4.7)), "2212": ((21.0, 23.0), (21.5, 23.5), (11.6, 12.4), (4.5, 6.5), (2.5, 4.5)), } PAD_T = 0.1 # tab thickness under the body: a proportion, for looks def mid(pair): return (pair[0] + pair[1]) / 2 X, Y, H, T, B = SIZES[size] along_x, along_y, top, tab_l, tab_w = mid(X), mid(Y), mid(H), mid(T), mid(B) 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", (-along_x / 2, -along_y / 2), (along_x / 2, along_y / 2)) model.extrude("body", "body_sketch", distance=top - PAD_T, name="Body") with model.sketch("tabs_sketch", on="XY", name="Terminals") as sk: sk.rect("tab_low", (-tab_w / 2, -along_y / 2), (tab_w / 2, -along_y / 2 + tab_l)) sk.rect("tab_high", (-tab_w / 2, along_y / 2 - tab_l), (tab_w / 2, along_y / 2)) model.extrude("tabs", "tabs_sketch", distance=PAD_T + 0.05, name="Terminals") model.material("pla", color="#3a3c40") result = model.result()