-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
154 lines (98 loc) · 3.84 KB
/
main.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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
#Import Neccesary packages and libraries
import cadquery as cq
import math
import sys
import module
def basic(Volume,H_D):
#Get Volume and H:D Ratio
Volume = int(Volume)
H_D = float(H_D)
#Compute rest of the Dimensions
TotalVolume = int(10/8*Volume)*pow(10,6)
#Diameter = pow((4/math.pi)*TotalVolume,1/3)
Diameter=pow(24*TotalVolume/(5*math.pi),1/3)
Height = Diameter*H_D
Thickness = 2
BaseThickness = 2
Radius = Diameter/2
BaffleLen = Diameter/8
BaffleWid = BaffleLen/2
#Make Tank
Tank = module.dishedtank(Volume,H_D,Thickness)
#Compute Shaft Diameter
ShaftDiameter = Diameter / 100
if ShaftDiameter<5:
ShaftDiameter = 5
else :
ShaftDiameter = ShaftDiameter
center = Height/4
#Make Shaft
Shaft = module.Shaft(center,ShaftDiameter,Height)
#Baffle Parameters
Baffle_count=4
#Make Baffles
Baffles = module.Baffles(Baffle_count,Radius,BaffleLen,BaffleWid,Height)
#Join Tank with Baffles+Shaft
Tank = Tank.union(Baffles,clean=False)
#Impeller Parameters
Hub_Diameter=Diameter/12
Hub_Height=Hub_Diameter
Blade_Length=(Diameter*0.45)-Hub_Diameter
Blade_Angle=45
Blade_Thickness=2.0
Blade_Height=3/4*Hub_Height/math.sin(math.degrees(Blade_Angle))
Blade_Count=4
#Make Impeller
Impeller=module.Pitchblade(ShaftDiameter,Hub_Diameter,Blade_Length,Hub_Height,Blade_Angle,Blade_Thickness,Blade_Height,Blade_Count)
#Join Impeller With Shaft
Impeller = Impeller.translate((0,0,center)).union(Shaft)
#Join Reactor with Impeller
Reactor = Tank.union(Impeller,clean=0)
#Export as .stl
cq.exporters.export(Reactor,'Reactor.stl')
#Export as .STEP
cq.exporters.export(Reactor, 'Reactor.step')
def advanced(Volume,H_D,BaffleLen,BaffleWid,Thickness,BaseThickness,ShaftDiameter,Baffle_count,Hub_Diameter,Hub_Height,Blade_Length,Blade_Angle,Blade_Thickness,Blade_Count,impellertype,no_of_impellers):
#Compute rest of the Dimensions
TotalVolume = int(10/8*Volume)*pow(10,6)
#Diameter = pow((4/math.pi)*TotalVolume,1/3)
Diameter=pow(24*TotalVolume/(5*math.pi),1/3)
Height = Diameter*H_D
Radius = Diameter/2
ShaftLen= Height*3/4
#Make Tank
Tank = module.dishedtank(Volume,H_D,Thickness)
#Compute Shaft Diameter
if ShaftDiameter<5:
ShaftDiameter = 5
else :
ShaftDiameter = ShaftDiameter
center = Height/4
#Make Shaft
Shaft = module.Shaft(center,ShaftDiameter,Height)
#Make Baffles
Baffles = module.Baffles(Baffle_count,Radius,BaffleLen,BaffleWid,Height)
#Join Tank with Baffles
Tank = Tank.union(Baffles,clean=0)
#Impeller Parameters
Blade_Height=3/4*Hub_Height/math.sin(math.degrees(Blade_Angle))
#Make Impeller
for i in range(no_of_impellers):
if impellertype==0:
Impeller=module.Pitchblade(ShaftDiameter,Hub_Diameter,Blade_Length,Hub_Height,Blade_Angle,Blade_Thickness,Blade_Height,Blade_Count)
else:
Impeller=module.Rushtonblade(ShaftDiameter,Hub_Diameter,Blade_Length,Hub_Height,Blade_Thickness,Blade_Height,Blade_Count)
#Join Impeller With Shaft
if i==0:
Impellers=Impeller.translate((0,0,center))
elif i>0:
Impellers= Impeller.translate((0,0,center+((ShaftLen/no_of_impellers)*i))).union(Impellers)
Impellers = Shaft.union(Impellers)
#Join Reactor with Impeller
Reactor = Tank.union(Impellers,clean=0)
#Export as .stl
cq.exporters.export(Reactor,'Reactor.stl')
#Export as .STEP
cq.exporters.export(Reactor, 'Reactor.step')
advanced(5, 2, 24.618625546067406, 12.309312773033703, 3, 5, 5, 4, 16.412417030711605, 16.412417030711605, 72.21463493513106, 45, 2, 4, 0, 3)
#Note: if impellertype=0 then impeller is pitch blade, if its greater than 0 then its Rushton type