forked from tazjel/declaracad
-
Notifications
You must be signed in to change notification settings - Fork 0
/
exhaust_flange.enaml
42 lines (39 loc) · 1.3 KB
/
exhaust_flange.enaml
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
from enaml.core.api import Looper
from declaracad.occ.api import (
Part, Fillet, Cut, Cylinder, Box
)
enamldef Assembly(Part):
name = "Exhaust Flange"
# Example showing some parametric properties
Cut:
material = 'steel'
attr padding = 4
attr ports = 4
Fillet:
Box: flange:
dx = 20
dy = 100
dz = 5
# Bolt holes
Looper:
iterable << [
(padding,padding),
(padding,flange.dy-padding),
(flange.dx-padding,flange.dy-padding),
(flange.dx-padding,padding),
]
Cylinder:
position << (loop_item[0],loop_item[1],0)
height := flange.dz
radius = 1
# Exhaust holes
attr port_radius << (min(flange.dx,flange.dy)-padding)/2.0
Looper:
iterable << [
(flange.dx/2.0,i*flange.dy/(float(ports))+port_radius+padding)
for i in range(ports)
]
Cylinder:
position << (loop_item[0],loop_item[1],0)
height := flange.dz
radius << port_radius