-
Notifications
You must be signed in to change notification settings - Fork 0
/
diode_1n4148.py
27 lines (24 loc) · 1010 Bytes
/
diode_1n4148.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import build123d as bd
def diode_1n4148(bent=True, leg_diameter=0.55) -> bd.Part:
if bent:
with bd.BuildPart() as prt:
bd.Cylinder(radius=1.6/2, height=3.9)
bd.fillet(prt.edges(), radius=0.2)
l = bd.Cylinder(radius=leg_diameter/2, height=3.9+2*2)
ends = l.faces().sort_by(bd.Axis.Z)
with bd.Locations(
ends[0].center().to_tuple(),
ends[-1].center().to_tuple()
):
bd.Sphere(radius=leg_diameter/2)
with bd.BuildSketch(bd.Plane.XZ):
with bd.GridLocations(0, l.bounding_box().size.Z, 1, 2):
bd.Circle(radius=leg_diameter/2)
bd.extrude(amount=5)
return prt.part
else:
with bd.BuildPart() as prt:
bd.Cylinder(radius=1.6/2, height=3.9)
bd.fillet(prt.edges(), radius=0.2)
bd.Cylinder(radius=leg_diameter/2, height=26*2+3.9)
return prt.part