/
integratedProject.py
135 lines (99 loc) · 2.87 KB
/
integratedProject.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
#! /usr/bin/env python
# -*- coding: UTF-8 -*-
from __future__ import division
import os
import sys
import re
from solid import *
import solid.utils
import math
SEGMENTS = 480
import GliderV2
import subprocess
import Menu
# Program Constants
noOfIterations = 10000
if __name__ == '__main__':
out_dir = sys.argv[1] if len(sys.argv) > 1 else os.curdir
out_dir = '/Users/vishakhkumar/Desktop/.'
file_out = os.path.join(out_dir, 'test.scad')
subprocess.call(['clear'], shell=True)
#Use only when program is complete
#Menu.startUpMenu()
# Simple command
subprocess.call(['clear'], shell=True)
subprocess.call('echo "Running the program"', shell=True)
# subprocess.call('say "Running the program"', shell=True)
#defining the required values of all wings
parts = [
GliderV2.wing({"rootChord":3,
"tipChord":3,
"span":8,
"rootAngle":0,
"tipAngle":10,
"sweepAngle":2,
"dihedralAngle":10,
"attackAngle":5,
"velocity":[0,-4,0],
"airDensity": 1,
"pos":[0,0,0],
"flip":False,
"thickness":1/16,
"density":0.5}),
GliderV2.wing({"rootChord":3,
"tipChord":3,
"span":8,
"rootAngle":0,
"tipAngle":0,
"sweepAngle":2,
"dihedralAngle":10,
"attackAngle":5,
"velocity":[0,-4,0],
"airDensity": 1,
"pos":[0,0,0],
"flip":True,
"thickness":1/16,
"density":0.5}),
GliderV2.wing({"rootChord":2,
"tipChord":1,
"span":3,
"rootAngle":0,
"tipAngle":0,
"sweepAngle":2,
"dihedralAngle":10,
"attackAngle":5,
"velocity":[0,-4,0],
"airDensity": 1,
"pos":[0,7,0],
"flip":False,
"thickness":1/16,
"density":0.5}),
GliderV2.wing({"rootChord":2,
"tipChord":1,
"span":3,
"rootAngle":0,
"tipAngle":0,
"sweepAngle":2,
"dihedralAngle":10,
"attackAngle":5,
"velocity":[0,-4,0],
"airDensity": 1,
"pos":[0,7,0],
"flip":True,
"thickness":1/16,
"density":0.5}),
]
# converting into GliderV2 wing objects
final = GliderV2.glider(parts)
print((final.components[0]).velocity)
print((final.components[0]).pos)
print('\n\n')
scad_render_to_file(final.OpenSCAD_obj, file_out)
#subprocess.call("/Applications/OpenSCAD.app/Contents/MacOS/OpenSCAD "+file_out, shell=True)
actualFinal = final.OpenSCAD_obj
scad_render_to_file(actualFinal, file_out)
print((final.components[0]).velocity)
print((final.components[0]).pos)
#print("%(__file__)s: SCAD file written to: \n%(file_out)s" % vars())
subprocess.call("/Applications/OpenSCAD.app/Contents/MacOS/OpenSCAD "+file_out, shell=True)
Menu.endProgram()