-
Notifications
You must be signed in to change notification settings - Fork 912
Expand file tree
/
Copy pathbenchmark_02_circular_flange.py
More file actions
50 lines (41 loc) · 1.67 KB
/
Copy pathbenchmark_02_circular_flange.py
File metadata and controls
50 lines (41 loc) · 1.67 KB
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
from math import tau
from build123d import Align, BuildPart, Cylinder, Location, Locations, Mode
from benchmark_common import circular_edges, polar_point, safe_fillet
OUTER_DIAMETER = 80.0
THICKNESS = 10.0
CENTRAL_BORE_DIAMETER = 30.0
BOLT_HOLE_COUNT = 6
BOLT_HOLE_DIAMETER = 6.0
BOLT_CIRCLE_DIAMETER = 60.0
OUTER_FILLET = 1.5
def gen_step():
"""Return the circular flange benchmark model in millimeters."""
with BuildPart() as flange:
Cylinder(
radius=OUTER_DIAMETER / 2.0,
height=THICKNESS,
align=(Align.CENTER, Align.CENTER, Align.MIN),
)
with Locations(Location((0.0, 0.0, -1.0))):
Cylinder(
radius=CENTRAL_BORE_DIAMETER / 2.0,
height=THICKNESS + 2.0,
align=(Align.CENTER, Align.CENTER, Align.MIN),
mode=Mode.SUBTRACT,
)
for index in range(BOLT_HOLE_COUNT):
x_pos, y_pos = polar_point(BOLT_CIRCLE_DIAMETER / 2.0, tau * index / BOLT_HOLE_COUNT)
with Locations(Location((x_pos, y_pos, -1.0))):
Cylinder(
radius=BOLT_HOLE_DIAMETER / 2.0,
height=THICKNESS + 2.0,
align=(Align.CENTER, Align.CENTER, Align.MIN),
mode=Mode.SUBTRACT,
)
part = flange.part
edges = []
edges.extend(circular_edges(part, radius=OUTER_DIAMETER / 2.0, axis="z", coordinate=0.0))
edges.extend(circular_edges(part, radius=OUTER_DIAMETER / 2.0, axis="z", coordinate=THICKNESS))
part = safe_fillet(part, edges, radius=OUTER_FILLET)
part.label = "benchmark_02_circular_flange_bolt_pattern"
return part