"""Wire-wound shielded SMD power inductor, Sunlord SWPA series sizes. Centred on the origin, sitting on the XY plane, with the two bottom terminals at the -X and +X sides. Dimensions from Sunlord's SWPA datasheet table for the size named by `series`; see the README.""" from steve import Model series = "SWPA4030S" # Sunlord SWPA size code # size: (drawing, A along the terminals' spacing, B, C height max, D terminal length, E terminal width, F gap between the terminals), ranges (min, max), # mm. Sunlord "Wire Wound SMD Power Inductors - SWPA Series", Revised 2019/04/01, Shape and Dimensions table (page 2). SIZES = { "SWPA252010S": ("Fig.1", (2.4, 2.6), (1.9, 2.1), 1.0, (1.8, 2.2), (0.6, 1), (0.6, 1)), "SWPA252012S": ("Fig.1", (2.4, 2.6), (1.9, 2.1), 1.2, (1.8, 2.2), (0.6, 1), (0.6, 1)), "SWPA3010S": ("Fig.2", (2.8, 3.2), (2.8, 3.2), 1.0, (2.3, 2.7), (0.55, 0.95), (1.3, 1.7)), "SWPA3012S": ("Fig.2", (2.8, 3.2), (2.8, 3.2), 1.2, (2.3, 2.7), (0.55, 0.95), (1.3, 1.7)), "SWPA3015S": ("Fig.2", (2.8, 3.2), (2.8, 3.2), 1.5, (2.3, 2.7), (0.55, 0.95), (1.3, 1.7)), "SWPA4010S": ("Fig.2", (3.8, 4.2), (3.8, 4.2), 1.0, (3.1, 3.5), (0.75, 1.15), (1.9, 2.3)), "SWPA4012S": ("Fig.2", (3.8, 4.2), (3.8, 4.2), 1.2, (3.1, 3.5), (0.75, 1.15), (1.9, 2.3)), "SWPA4018S": ("Fig.2", (3.8, 4.2), (3.8, 4.2), 1.8, (3.1, 3.5), (0.75, 1.15), (1.9, 2.3)), "SWPA4020S": ("Fig.2", (3.8, 4.2), (3.8, 4.2), 2.0, (3.1, 3.5), (0.75, 1.15), (1.9, 2.3)), "SWPA4026S": ("Fig.2", (3.8, 4.2), (3.8, 4.2), 2.6, (3.1, 3.5), (0.75, 1.15), (1.9, 2.3)), "SWPA4030S": ("Fig.2", (3.8, 4.2), (3.8, 4.2), 3.0, (3.1, 3.5), (0.75, 1.15), (1.9, 2.3)), "SWPA5012S": ("Fig.3", (4.8, 5.2), (4.8, 5.2), 1.2, (3.8, 4.2), (1.05, 1.45), (2.3, 2.7)), "SWPA5020S": ("Fig.3", (4.8, 5.2), (4.8, 5.2), 2.0, (3.8, 4.2), (1.05, 1.45), (2.3, 2.7)), "SWPA5040S": ("Fig.3", (4.8, 5.2), (4.8, 5.2), 4.0, (3.8, 4.2), (1.05, 1.45), (2.3, 2.7)), "SWPA5045S": ("Fig.3", (4.8, 5.2), (4.8, 5.2), 4.5, (3.8, 4.2), (1.1, 1.5), (2.3, 2.7)), "SWPA6020S": ("Fig.2", (5.7, 6.3), (5.7, 6.3), 2.0, (4.6, 5.2), (1.25, 1.85), (2.6, 3.2)), "SWPA6028S": ("Fig.2", (5.7, 6.3), (5.7, 6.3), 2.8, (4.6, 5.2), (1.25, 1.85), (2.6, 3.2)), "SWPA6040S": ("Fig.2", (5.7, 6.3), (5.7, 6.3), 4.0, (4.6, 5.2), (1.25, 1.85), (2.6, 3.2)), "SWPA6045S": ("Fig.2", (5.7, 6.3), (5.7, 6.3), 4.5, (4.6, 5.2), (1.25, 1.85), (2.6, 3.2)), "SWPA8040S": ("Fig.2", (7.7, 8.3), (7.7, 8.3), 4.2, (6, 6.6), (1.7, 2.3), (3.7, 4.3)), "SWPA8050S": ("Fig.3", (7.7, 8.3), (7.7, 8.3), 5.0, (6, 6.6), (1.7, 2.3), (3.7, 4.3)), "SWPA8060S": ("Fig.3", (7.7, 8.3), (7.7, 8.3), 6.0, (6, 6.6), (1.7, 2.3), (3.7, 4.3)), "SWPA8065S": ("Fig.3", (7.7, 8.3), (7.7, 8.3), 6.5, (6, 6.6), (1.7, 2.3), (3.7, 4.3)), } PAD_T = 0.1 # terminal thickness under the body: a proportion, for looks def mid(pair): return (pair[0] + pair[1]) / 2 fig, A, B, top, D, E, F = SIZES[series] along, across, term_l, term_w, gap = mid(A), mid(B), mid(D), mid(E), mid(F) 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 / 2, -across / 2), (along / 2, across / 2)) model.extrude("body", "body_sketch", distance=top - PAD_T, name="Body") outer = min(gap / 2 + term_w, along / 2) # SWPA5045S's nominal E + F + E is 5.1 against A 5.0: the terminals stop at the body's side with model.sketch("terms_sketch", on="XY", name="Terminals") as sk: sk.rect("term_left", (-outer, -term_l / 2), (-gap / 2, term_l / 2)) sk.rect("term_right", (gap / 2, -term_l / 2), (outer, term_l / 2)) model.extrude("terms", "terms_sketch", distance=PAD_T + 0.05, name="Terminals") model.material("pla", color="#3a3c40") result = model.result()