-
Notifications
You must be signed in to change notification settings - Fork 1
/
isolFooting.py
324 lines (238 loc) · 14.5 KB
/
isolFooting.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
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
import ezdxf
from ezdxf.tools.standards import linetypes
from ezdxf.enums import TextEntityAlignment
from package.config import Settings
import numpy as np
from math import ceil
class Footing():
footing_list = []
def __init__(self, title, origin, cob, sideX, sideY, h0, h1, df, pX, pY, reinforcement_x, reinforcement_y):
self.title = title
self.origin = origin
self.cob = cob
self.sideX = sideX
self.sideY = sideY
self.h0 = h0
self.h1 = h1
self.df = df
self.pX = pX
self.pY = pY
self.reinforcement_x = reinforcement_x #[diameter, spacing]
self.reinforcement_y = reinforcement_y #[diameter, spacing]
Footing.footing_list.append(self)
def __str__(self):
return self.title
def steel_table(self):
#Horizontal
if (self.sideY * 100) % self.reinforcement_x[1] == 0:
quantBars_x = (self.sideY * 100) / self.reinforcement_x[1]
else:
quantBars_x = ceil((self.sideY * 100) / self.reinforcement_x[1])
middleLength_x = self.sideX - 2 * self.cob
flapLength_x = self.h0 - 2 * self.cob
lengthTotal_un_x = middleLength_x + 2 * flapLength_x
#Vertical
if (self.sideX * 100) % self.reinforcement_y[1] == 0:
quantBars_y = (self.sideX * 100) / self.reinforcement_y[1]
else:
quantBars_y = ceil((self.sideX * 100) / self.reinforcement_y[1])
middleLength_y = self.sideY - 2 * self.cob
flapLength_y = self.h0 - 2 * self.cob
lengthTotal_un_y = middleLength_y + 2 * flapLength_y
dictReinforcement = {
'quantBars_x': quantBars_x,
'middleLength_x': middleLength_x,
'flapLength_x': flapLength_x,
'lengthTotal_un_x': lengthTotal_un_x,
'quantBars_y': quantBars_y,
'middleLength_y': middleLength_y,
'flapLength_y': flapLength_y,
'lengthTotal_un_y': lengthTotal_un_y
}
return dictReinforcement
def add_isolFooting(self, path):
doc = ezdxf.new()
msp = doc.modelspace()
#Text
doc.styles.new("Title_01", dxfattribs={"font" : "Arial.ttf"})
doc.styles.new("Subtitle_01", dxfattribs={"font" : "Arial.ttf"})
#linetypes
for name, desc, pattern in Settings.my_line_types:
if name not in doc.linetypes:
doc.linetypes.add(
name=name,
pattern=pattern,
description=desc,
)
#Layers Creation
doc.layers.new(name='STRUCT_FOOTING_0', dxfattribs={'color': 3})
doc.layers.new(name='STRUCT_FOOTING_1', dxfattribs={'color': 3, 'linetype': 'DASHED'})
doc.layers.new(name='STRUCT_FOOTING_2', dxfattribs={'color': 3, 'linetype': 'DOTTED'})
doc.layers.new(name='STRUCT_FOOTING_3', dxfattribs={'color': 5})
#Insertion of texts in the drawing
msp.add_text(
self.title,
height=0.1,
dxfattribs={"style": "Title_01", 'color': 3}
).set_placement((self.origin[0], self.origin[1] + self.sideY + 0.40), align=TextEntityAlignment.LEFT)
msp.add_text(
'PLANTA',
height=0.05,
dxfattribs={"style": "Subtitle_01", 'color': 3}
).set_placement((self.origin[0], self.origin[1] + self.sideY + 0.30), align=TextEntityAlignment.LEFT)
msp.add_text(
str(round(self.sideX * 100, 0)) + ' x ' + str(round(self.sideY * 100, 0)),
height=0.05,
dxfattribs={"style": "Subtitle_01", 'color': 3}
).set_placement((self.origin[0], self.origin[1] + self.sideY + 0.20), align=TextEntityAlignment.LEFT)
#Plant insertion
#Fotting Points
bottomLeftPoint_plant = np.array(self.origin)
bottomRightPoint_plant = bottomLeftPoint_plant + np.array([self.sideX, 0])
topRightPoint_plant = bottomRightPoint_plant + np.array([0, self.sideY])
topLeftPoint_plant = topRightPoint_plant + np.array([-self.sideX, 0])
msp.add_line(bottomLeftPoint_plant, bottomRightPoint_plant, dxfattribs={'layer': 'STRUCT_FOOTING_0',})
msp.add_line(bottomRightPoint_plant, topRightPoint_plant, dxfattribs={'layer': 'STRUCT_FOOTING_0',})
msp.add_line(topRightPoint_plant, topLeftPoint_plant, dxfattribs={'layer': 'STRUCT_FOOTING_0',})
msp.add_line(topLeftPoint_plant, bottomLeftPoint_plant, dxfattribs={'layer': 'STRUCT_FOOTING_0',})
#Pillar Points
bottomLeftPoint_plant_pillar = bottomLeftPoint_plant + np.array([(self.sideX / 2) - (self.pX / 2), (self.sideY / 2) - (self.pY / 2)])
bottomRightPoint_plant_pillar = bottomLeftPoint_plant_pillar + np.array([self.pX, 0])
topRightPoint_plant_pillar = bottomRightPoint_plant_pillar + np.array([0, self.pY])
topLeftPoint_plant_pillar = topRightPoint_plant_pillar + np.array([- self.pX, 0])
msp.add_line(bottomLeftPoint_plant_pillar, bottomRightPoint_plant_pillar, dxfattribs={'layer': 'STRUCT_FOOTING_0',})
msp.add_line(bottomRightPoint_plant_pillar, topRightPoint_plant_pillar, dxfattribs={'layer': 'STRUCT_FOOTING_0',})
msp.add_line(topRightPoint_plant_pillar, topLeftPoint_plant_pillar, dxfattribs={'layer': 'STRUCT_FOOTING_0',})
msp.add_line(topLeftPoint_plant_pillar, bottomLeftPoint_plant_pillar, dxfattribs={'layer': 'STRUCT_FOOTING_0',})
#Chamfer
if self.h0 != self.h1:
msp.add_line(bottomLeftPoint_plant, bottomLeftPoint_plant_pillar, dxfattribs={'layer': 'STRUCT_FOOTING_0',})
msp.add_line(bottomRightPoint_plant, bottomRightPoint_plant_pillar, dxfattribs={'layer': 'STRUCT_FOOTING_0',})
msp.add_line(topRightPoint_plant, topRightPoint_plant_pillar, dxfattribs={'layer': 'STRUCT_FOOTING_0',})
msp.add_line(topLeftPoint_plant, topLeftPoint_plant_pillar, dxfattribs={'layer': 'STRUCT_FOOTING_0',})
#reinforcement in plan
dict_results = Footing.steel_table(self)
flapLength = self.h0 - 2 * self.cob
pointOneBottom_reinforced_90 = bottomRightPoint_plant + np.array([0.1, self.cob])
pointTwoBottom_reinforced_90 = pointOneBottom_reinforced_90 + np.array([flapLength, 0])
pointOneTop_reinforced_90 = pointOneBottom_reinforced_90 + np.array([0, self.sideY - 2 * self.cob])
pointTwoTop_reinforced_90 = pointOneTop_reinforced_90 + np.array([flapLength, 0])
msp.add_line(pointOneBottom_reinforced_90, pointTwoBottom_reinforced_90, dxfattribs={'layer': 'STRUCT_FOOTING_3',})
msp.add_line(pointTwoBottom_reinforced_90, pointTwoTop_reinforced_90, dxfattribs={'layer': 'STRUCT_FOOTING_3',})
msp.add_line(pointTwoTop_reinforced_90, pointOneTop_reinforced_90, dxfattribs={'layer': 'STRUCT_FOOTING_3',})
msp.add_text(
f"{dict_results['quantBars_y']} N2 %%C {self.reinforcement_y[0]} c/{self.reinforcement_y[1]} C={ceil(100 * dict_results['lengthTotal_un_y'])}",
height=0.05,
dxfattribs={"style": "Subtitle_01", 'color': 3, 'rotation': 90}
).set_placement((self.origin[0] + self.sideX + 0.1 + flapLength + 0.025, self.origin[1] + self.sideY / 2), align=TextEntityAlignment.TOP_CENTER)
msp.add_text(
ceil(100 * dict_results['middleLength_y']),
height=0.05,
dxfattribs={"style": "Subtitle_01", 'color': 3, 'rotation': 90}
).set_placement((self.origin[0] + self.sideX + 0.1 + flapLength -0.015, self.origin[1] + self.sideY / 2), align=TextEntityAlignment.BOTTOM_CENTER)
pointOneTop_reinforced_0 = bottomLeftPoint_plant + np.array([self.cob, - 0.1])
pointTwoTop_reinforced_0 = pointOneTop_reinforced_0 + np.array([self.sideX - 2 * self.cob, 0])
pointOneBottom_reinforced_0 = pointOneTop_reinforced_0 + np.array([0, - flapLength])
pointTwoBottom_reinforced_0 = pointTwoTop_reinforced_0 + np.array([0, - flapLength])
msp.add_line(pointOneTop_reinforced_0, pointOneBottom_reinforced_0, dxfattribs={'layer': 'STRUCT_FOOTING_3',})
msp.add_line(pointTwoTop_reinforced_0, pointTwoBottom_reinforced_0, dxfattribs={'layer': 'STRUCT_FOOTING_3',})
msp.add_line(pointOneBottom_reinforced_0, pointTwoBottom_reinforced_0, dxfattribs={'layer': 'STRUCT_FOOTING_3',})
msp.add_text(
f"{dict_results['quantBars_x']} N1 %%C {self.reinforcement_x[0]} c/{self.reinforcement_x[1]} C={ceil(100 * dict_results['lengthTotal_un_x'])}",
height=0.05,
dxfattribs={"style": "Subtitle_01", 'color': 3, 'rotation': 0}
).set_placement((bottomLeftPoint_plant[0] + (self.sideX / 2), pointOneBottom_reinforced_0[1] - 0.025), align=TextEntityAlignment.TOP_CENTER)
msp.add_text(
ceil(100 * dict_results['middleLength_x']),
height=0.05,
dxfattribs={"style": "Subtitle_01", 'color': 3, 'rotation': 0}
).set_placement((bottomLeftPoint_plant[0] + (self.sideX / 2), pointOneBottom_reinforced_0[1] + 0.015), align=TextEntityAlignment.BOTTOM_CENTER)
#Foundation cut
msp.add_text(
'CORTE',
height=0.06,
dxfattribs={"style": "Subtitle_01", 'color': 3}
).set_placement((topRightPoint_plant[0] + 2 * self.h0, topRightPoint_plant[1] + 0.2), align=TextEntityAlignment.LEFT)
dottedLineTop_one = pointTwoTop_reinforced_90 + np.array([self.h0, self.cob])
dottedLineTop_two = dottedLineTop_one + np.array([2 * self.h0 + self.sideX, 0])
dottedLineBottom_one = dottedLineTop_one + np.array([0, - self.df])
dottedLineBottom_two = dottedLineTop_two + np.array([0, - self.df])
msp.add_line(dottedLineTop_one, dottedLineTop_two, dxfattribs={'layer': 'STRUCT_FOOTING_2',})
msp.add_line(dottedLineBottom_one, dottedLineBottom_two, dxfattribs={'layer': 'STRUCT_FOOTING_2',})
cutBottomPoint_one = dottedLineBottom_one + np.array([self.h0, 0])
cutBottomPoint_two = cutBottomPoint_one + np.array([self.sideX, 0])
cutTopPoint_one = cutBottomPoint_one + np.array([0, self.h0])
cutTopPoint_two = cutBottomPoint_two + np.array([0, self.h0])
cutPillarPoint_one = dottedLineTop_one + np.array([self.h0 + (self.sideX / 2) - (self.pX / 2), 0])
cutPillarPoint_two = cutPillarPoint_one + np.array([self.pX, 0])
cutH1Point_one = cutPillarPoint_one + np.array([0, - self.df + self.h1])
cutH1Point_two = cutPillarPoint_two + np.array([0, - self.df + self.h1])
msp.add_line(cutPillarPoint_one, cutPillarPoint_two, dxfattribs={'layer': 'STRUCT_FOOTING_0',})
msp.add_line(cutPillarPoint_one, cutH1Point_one, dxfattribs={'layer': 'STRUCT_FOOTING_0',})
msp.add_line(cutPillarPoint_two, cutH1Point_two, dxfattribs={'layer': 'STRUCT_FOOTING_0',})
msp.add_line(cutH1Point_one, cutTopPoint_one, dxfattribs={'layer': 'STRUCT_FOOTING_0',})
msp.add_line(cutH1Point_two, cutTopPoint_two, dxfattribs={'layer': 'STRUCT_FOOTING_0',})
msp.add_line(cutTopPoint_two, cutBottomPoint_two, dxfattribs={'layer': 'STRUCT_FOOTING_0',})
msp.add_line(cutTopPoint_one, cutBottomPoint_one, dxfattribs={'layer': 'STRUCT_FOOTING_0',})
msp.add_line(cutBottomPoint_one, cutBottomPoint_two, dxfattribs={'layer': 'STRUCT_FOOTING_0',})
#reinforcement in cut
pointOneTop_reinforced_cut = cutBottomPoint_one + np.array([self.cob, self.cob + flapLength])
pointTwoTop_reinforced_cut = pointOneTop_reinforced_cut + np.array([self.sideX - 2 * self.cob, 0])
pointOneBottom_reinforced_cut = pointOneTop_reinforced_cut + np.array([0, - flapLength])
pointTwoBottom_reinforced_cut = pointTwoTop_reinforced_cut + np.array([0, - flapLength])
msp.add_line(pointOneTop_reinforced_cut, pointOneBottom_reinforced_cut, dxfattribs={'layer': 'STRUCT_FOOTING_3',})
msp.add_line(pointTwoTop_reinforced_cut, pointTwoBottom_reinforced_cut, dxfattribs={'layer': 'STRUCT_FOOTING_3',})
msp.add_line(pointOneBottom_reinforced_cut, pointTwoBottom_reinforced_cut, dxfattribs={'layer': 'STRUCT_FOOTING_3',})
path_save = path + self.title + '.dxf'
doc.saveas(path_save)
def list_footing():
for footing in Footing.footing_list:
print(footing)
def volume(self):
if self.h0 == self.h1:
bottomVol = self.sideX * self.sideY * self.h0
pillarVol = (self.df - self.h0) * self.pX * self.pY
totalVol = bottomVol + pillarVol
else:
straightPartVol = self.sideX * self.sideY * self.h0 #Straigth Part Volume
sB = self.sideX * self.sideY #larger base area
sb = self.pX * self.pY #smaller base area
heightPyrTrunk = self.h1 - self.h0 #height of pyramid trunk
pyramidTrunk = (heightPyrTrunk / 3) * (sB + ((sB * sb) ** (1 / 2)) + sb)
bottomVol = straightPartVol + pyramidTrunk
pillarVol = (self.df - self.h1) * self.pX * self.pY
totalVol = bottomVol + pillarVol
return [round(bottomVol, 2), round(pillarVol, 2), round(totalVol, 2)]
def formwork(self):
side = 2 * (self.sideX * self.h0) + 2 * (self.sideY * self.h0)
return side
#Testes e métodos desenvolvidos - roteiro para README.MD futuro.
#Cria Sapata
#Medidas em metro.
'''
title
origin
cob
sideX
sideY
h0
h1
df
pX
pY
reinforcement_horizontal [bit(mm), esp (cm)]
reinforcement_vertical [bit(mm), esp (cm)]
'''
sapata1 = Footing('S1', [1, 1], 0.05 ,0.85, 1.10, 0.25, 0.40, 1.75, 0.14, 0.40, [10.0, 10], [10, 10])
sapata2 = Footing('S2', [0, 0], 0.05 ,1.8, 2.20, 0.25, 0.45, 1.50, 0.30, 0.60, [10.0, 10], [10, 10])
sapata3 = Footing('S3', [0, 0], 0.045 ,2.15, 2.30, 0.30, 0.60, 2.20, 0.35, 0.50, [10.0, 10], [10, 10])
#Lista todas as sapatas já criadas.
#Footing.list_footing()
#Desenha a sapata - precisa entrar com o caminho da pasta onde quer salvar
sapata3.add_isolFooting('./examples/')
#Fornece uma lista [Volume da parte inferior (reta ou com chanfro), volume da parte do pilar, volume total]
#sapata3.volume()
#Fornece o valor das fôrmas por m2. As fôrmas contabilizam somente a parte lateral.
#sapata3.formwork()
#Fornece os valores para tabela de aço.
#sapata3.steel_table()