"""Shielded SMD flat-wire high-current inductor, Würth WE-HCM sizes. Centred on the origin, sitting on the XY plane, with the two flat-wire terminals 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 = "1050" # WE-HCM size code # size: (body along X, body along Y, along Y over the terminals, height, terminal length under the body from the end, terminal width), ranges (min, max), # mm. Würth Elektronik WE-HCM datasheets, page 1, A Dimensions, one per size (order code, revision and date): 7050 744302007 2.3 2015-03-04; 7070 744307012 # 2.3 2014-09-16; 1050 744303012 3.3 2014-09-16; 1052 744306020 2.3 2015-03-04; 1070 744308033 2.3 2014-09-16; 1190 744301033 2.3 2014-09-16; 1240 # 744304010 2.3 2014-09-16; 1350 744305033 2.3 2014-09-16; 1390 744309033 2.3 2014-09-16. A value drawn as a maximum only (7050 and 1050: body, # over-terminal length and height; 1240: over-terminal length) or as "ref" (7050 and 1050 terminals) is written (value, value) and used as drawn. SIZES = { "7050": ((7.0, 7.0), (7.0, 7.0), (7.15, 7.15), (5.0, 5.0), (1.52, 1.52), (2.5, 2.5)), "7070": ((6.2, 8.2), (6.2, 8.2), (6.4, 8.4), (6.8, 7.2), (1.6, 2.0), (1.8, 2.2)), "1050": ((7.0, 7.0), (10.0, 10.0), (10.2, 10.2), (5.0, 5.0), (1.52, 1.52), (2.5, 2.5)), "1052": ((9.3, 11.3), (9.3, 11.3), (9.5, 11.5), (4.5, 5.5), (1.8, 2.2), (2.3, 2.7)), "1070": ((6.6, 7.4), (9.5, 10.5), (9.6, 10.6), (6.6, 7.0), (2.4, 2.8), (1.4, 1.8)), "1190": ((10.5, 11.5), (10.0, 11.0), (10.8, 11.8), (8.4, 9.4), (2.7, 3.7), (2.0, 2.4)), "1240": ((10.8, 12.8), (9.0, 11.0), (11.5, 11.5), (3.6, 4.0), (1.4, 2.0), (3.5, 4.1)), "1350": ((12.3, 14.3), (12.3, 14.3), (12.5, 14.5), (4.8, 5.2), (1.8, 2.2), (4.8, 5.2)), "1390": ((12.5, 13.5), (12.0, 13.0), (13.5, 14.5), (8.5, 9.5), (1.5, 2.1), (4.3, 4.7)), } PAD_T = 0.1 # terminal thickness under the body: a proportion, for looks RISE = 0.55 # how far up the end faces the terminals run, as a share of the height: a proportion, for looks SPLIT = 0.2 # the line between the two core halves, just above the terminals: groove height and depth, a proportion, for looks def mid(pair): return (pair[0] + pair[1]) / 2 X, YB, YO, H, T, B = SIZES[size] along_x, body_y, over_y, top, tab_l, tab_w = mid(X), mid(YB), mid(YO), 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, -body_y / 2), (along_x / 2, body_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, -over_y / 2), (tab_w / 2, -over_y / 2 + tab_l)) sk.rect("tab_high", (-tab_w / 2, over_y / 2 - tab_l), (tab_w / 2, over_y / 2)) model.extrude("tabs", "tabs_sketch", distance=PAD_T + 0.05, name="Terminals") with model.sketch("ends_sketch", on="XY", name="Terminal ends") as sk: sk.rect("end_low", (-tab_w / 2, -over_y / 2), (tab_w / 2, -body_y / 2 + 0.05)) sk.rect("end_high", (-tab_w / 2, body_y / 2 - 0.05), (tab_w / 2, over_y / 2)) model.extrude("ends", "ends_sketch", distance=RISE * top, name="Terminal ends") model.plane("split_plane", on="XY", offset=RISE * top, name="Core split") with model.sketch("split_ends", on="split_plane", name="Core split") as sk: sk.rect("split_south", (-along_x / 2, -body_y / 2), (along_x / 2, -body_y / 2 + SPLIT)) sk.rect("split_north", (-along_x / 2, body_y / 2 - SPLIT), (along_x / 2, body_y / 2)) model.extrude("split_y", "split_ends", distance=SPLIT, op="cut", name="Core split") with model.sketch("split_sides", on="split_plane", name="Core split") as sk: sk.rect("split_west", (-along_x / 2, -body_y / 2), (-along_x / 2 + SPLIT, body_y / 2)) sk.rect("split_east", (along_x / 2 - SPLIT, -body_y / 2), (along_x / 2, body_y / 2)) model.extrude("split_x", "split_sides", distance=SPLIT, op="cut", name="Core split") model.material("pla", color="#3a3c40") result = model.result()