-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcompute.py
158 lines (147 loc) · 4.4 KB
/
compute.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
155
156
157
158
import json
def compute_material_required(width: float, height: float):
# track
horizontal_track = width * 2 # 2 pcs
vertical_track = height * 2 # 2 pcs
total_track_length = 2 * (width + height) #Unit: mm
# framing
horizontal_frame = (width - 9)/2 # 1 piece of horizontal frame
handle_frame = height - 69
total_framing_length = 6 * (horizontal_frame + handle_frame) #Unit: mm
# glass
glass_area = ((horizontal_frame - 105) *
(handle_frame - 105)) * (0.00328084**2) #Unit: sq. ft
# mosquito net
mosquito_area = (horizontal_frame * handle_frame) * (0.00328084**2) #Unit: sq. ft
# glass pvc
glass_pvc_vertical_height = handle_frame * 4 #Unit: mm
glass_pvc_width = width * 2
# c chanel
c_chanel_height = handle_frame * 2 #Unit: mm
c_chanel_width = width
# track woolpile
woolpile_height = handle_frame * 9 # TODO: Correction
woolpile_width = horizontal_frame * 2 # TODO: Correction
return {
"Track - Top/Bottom": {
"per_piece": round(horizontal_track / 2, 3),
"total": horizontal_track,
"Unit": "mm",
"Pieces": "2"
},
"Track - Vertical": {
"per_piece": round(vertical_track / 2, 3),
"total": vertical_track ,
"Unit": "mm",
"Pieces": "2"
},
"Section - Top/Bottom" : {
"per_piece": round(horizontal_frame / 6, 3),
"total": horizontal_frame,
"Unit": "mm",
"Pieces": "6"
},
"Section - Handle": {
"per_piece": round(handle_frame / 6, 3),
"total": handle_frame,
"Unit": "mm",
"Pieces": "6"
},
"Glass": {
"per_piece": round(glass_area/2, 3),
"total": round(glass_area, 3),
"Unit": "sq. ft",
"Pieces": "2"
},
"Mosquito Net": {
"per_piece": round(mosquito_area, 3),
"total": round(mosquito_area, 3),
"Unit": "sq. ft",
"Pieces": "1"
},
"Glass PVC - Horizontal": {
"total": glass_pvc_width,
"Unit": "mm",
"Pieces": "4",
"per_piece": round(glass_pvc_width/4, 3)
},
"Glass PVC - Vertical": {
"total": glass_pvc_vertical_height,
"Unit": "mm",
"Pieces": "4",
"per_piece": round(glass_pvc_vertical_height/4, 3)
},
"C Chanel - Horizontal": {
"Unit": "mm",
"Pieces": "1",
"total": c_chanel_width,
"per_piece": c_chanel_width
},
"C Chanel - Vertical": {
"Unit": "mm",
"Pieces": "2",
"total": c_chanel_height,
"per_piece": round(c_chanel_height/2, 3)
},
"Woolpile - Horizontal": {
"Unit": "mm",
"Pieces": "2",
"total":woolpile_width,
"per_piece": round(woolpile_width / 2, 3)
},
"Woolpile - Vertical": {
"Unit": "mm",
"Pieces": "9",
"total":woolpile_height,
"per_piece": round(woolpile_height / 9, 3)
},
"Inter Lock Strip" : {
"Pieces": "3",
"Unit":"mm",
"per_piece":handle_frame,
"total":handle_frame * 3,
},
"Bearing" : {
"Pieces": "6",
"Unit":"",
"per_piece":"-",
"total":"-",
},
"Lock" : {
"Pieces": "2",
"Unit":"",
"per_piece":"-",
"total":"-",
},
"Aluminium Clit" : {
"Pieces": "20",
"Unit":"",
"per_piece":"-",
"total":"-",
},
"Corner Clit" : {
"Pieces": "24",
"Unit":"",
"per_piece":"-",
"total":"-",
},
"Male Female" : {
"Pieces": "6",
"Unit":"",
"per_piece":"-",
"total":"-",
},
"Long Cap" : {
"Pieces": "3",
"Unit":"",
"per_piece":"-",
"total":"-",
},
"Lock Guard" : {
"Pieces": "3",
"Unit":"",
"per_piece":"-",
"total":"-",
},
}
# print(json.dumps(compute_material_required(width=1524.0, height=1220.0), indent=4))