civil-tools-v 0.0.1__py3-none-any.whl → 0.0.3__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- CivilTools/Const/CAD.py +2 -0
- CivilTools/Const/Concrete.py +144 -0
- CivilTools/Const/Steel.py +21 -0
- CivilTools/Const/__init__.py +3 -0
- CivilTools/DXFGenerator/BasicDXF.py +238 -1
- CivilTools/DXFGenerator/DetailDXF.py +324 -0
- CivilTools/DXFGenerator/DrawingAttribs.py +45 -0
- CivilTools/DXFGenerator/LayerManager.py +37 -0
- CivilTools/DXFGenerator/__init__.py +3 -0
- CivilTools/FigureGenerator/BasicPNGPlotter.py +28 -25
- CivilTools/FigureGenerator/BasicPltPlotter.py +115 -1
- CivilTools/FigureGenerator/SeismicReport/ShearMassRatio.py +73 -0
- CivilTools/FigureGenerator/SeismicReport/ShearMoment.py +71 -0
- CivilTools/FigureGenerator/SeismicReport/__init__.py +2 -0
- CivilTools/FigureGenerator/StairCalculationSheetPNGPlotter.py +2 -8
- CivilTools/ReportGenerator/BasicGenerator.py +109 -83
- CivilTools/ReportGenerator/DocParagraph.py +3 -5
- CivilTools/ReportGenerator/DocPicture.py +7 -8
- CivilTools/ReportGenerator/DocTable.py +11 -11
- CivilTools/ReportGenerator/SeismicReport.py +302 -143
- CivilTools/ReportGenerator/SeismicReportTemplate.py +523 -202
- CivilTools/ReportGenerator/StairCalculationReport.py +249 -185
- CivilTools/ReportGenerator/UtilFunctions.py +108 -104
- CivilTools/ReportGenerator/__init__.py +2 -2
- CivilTools/YDBLoader/BuildingDefine/Beam/Beam.py +12 -15
- CivilTools/YDBLoader/BuildingDefine/Column/Column.py +5 -5
- CivilTools/YDBLoader/BuildingDefine/ComponentType.py +1 -1
- CivilTools/YDBLoader/BuildingDefine/Geometry/Grid.py +8 -12
- CivilTools/YDBLoader/BuildingDefine/Geometry/Joint.py +11 -10
- CivilTools/YDBLoader/BuildingDefine/Geometry/StandFloor.py +1 -1
- CivilTools/YDBLoader/BuildingDefine/GlobalResult/BasicResult.py +44 -24
- CivilTools/YDBLoader/BuildingDefine/GlobalResult/SeismicResult.py +168 -54
- CivilTools/YDBLoader/BuildingDefine/Section/Section.py +26 -31
- CivilTools/YDBLoader/BuildingDefine/Section/ShapeEnum.py +9 -9
- CivilTools/YDBLoader/BuildingDefine/Slab/Slab.py +1 -1
- CivilTools/YDBLoader/BuildingDefine/StairPart/LoadDefine.py +16 -10
- CivilTools/YDBLoader/BuildingDefine/StairPart/StairComponent.py +41 -37
- CivilTools/YDBLoader/BuildingDefine/StairPart/StairPart.py +133 -78
- CivilTools/YDBLoader/SQLiteConnector/Connector.py +16 -8
- CivilTools/YDBLoader/SQLiteConnector/RowDataFactory.py +19 -17
- CivilTools/YDBLoader/SQLiteConnector/YDBTableName.py +31 -20
- CivilTools/YDBLoader/YDBLoader.py +128 -110
- {civil_tools_v-0.0.1.dist-info → civil_tools_v-0.0.3.dist-info}/METADATA +88 -5
- civil_tools_v-0.0.3.dist-info/RECORD +60 -0
- {civil_tools_v-0.0.1.dist-info → civil_tools_v-0.0.3.dist-info}/WHEEL +1 -1
- civil_tools_v-0.0.1.dist-info/RECORD +0 -50
- {civil_tools_v-0.0.1.dist-info → civil_tools_v-0.0.3.dist-info}/LICENSE +0 -0
- {civil_tools_v-0.0.1.dist-info → civil_tools_v-0.0.3.dist-info}/top_level.txt +0 -0
@@ -3,6 +3,7 @@ from docx.oxml.ns import qn, nsdecls
|
|
3
3
|
from CivilTools.YDBLoader.BuildingDefine.StairPart import StairPart, Component
|
4
4
|
import numpy as np
|
5
5
|
|
6
|
+
|
6
7
|
# 网上找的代码,有点东西
|
7
8
|
# https://stackoverflow.com/questions/33069697/how-to-setup-cell-borders-with-python-docx
|
8
9
|
# 这个是github上的讨论帖,在讨论帖中找到的
|
@@ -26,14 +27,14 @@ def set_cell_border(cell, **kwargs):
|
|
26
27
|
# check for tag existnace, if none found, then create one
|
27
28
|
tc_borders = tc_pr.first_child_found_in("w:tcBorders")
|
28
29
|
if tc_borders is None:
|
29
|
-
tc_borders = BaseOxmlElement(
|
30
|
+
tc_borders = BaseOxmlElement("w:tcBorders")
|
30
31
|
tc_pr.append(tc_borders)
|
31
32
|
|
32
33
|
# list over all available tags
|
33
|
-
for edge in (
|
34
|
+
for edge in ("start", "top", "end", "bottom", "insideH", "insideV"):
|
34
35
|
edge_data = kwargs.get(edge)
|
35
36
|
if edge_data:
|
36
|
-
tag =
|
37
|
+
tag = "w:{}".format(edge)
|
37
38
|
|
38
39
|
# check for tag existnace, if none found, then create one
|
39
40
|
element = tc_borders.find(qn(tag))
|
@@ -44,9 +45,10 @@ def set_cell_border(cell, **kwargs):
|
|
44
45
|
# looks like order of attributes is important
|
45
46
|
for key in ["sz", "val", "color", "space", "shadow"]:
|
46
47
|
if key in edge_data:
|
47
|
-
element.set(qn(
|
48
|
-
|
49
|
-
|
48
|
+
element.set(qn("w:{}".format(key)), str(edge_data[key]))
|
49
|
+
|
50
|
+
|
51
|
+
def analysis_sub_and_super_script(context: str):
|
50
52
|
"""根据字符串中的'_'与'^'标志的上下标(上下标需要被{}包围起来),将字符串分隔并返回上下标结果
|
51
53
|
返回的sub_or_super列表中,0代表常规字符,1代表下标,2代表上标,3代表highlighted
|
52
54
|
Args:
|
@@ -58,168 +60,170 @@ def analysis_sub_and_super_script(context:str):
|
|
58
60
|
j = 0
|
59
61
|
length = len(context)
|
60
62
|
flag = False
|
61
|
-
index_for_flag = {
|
62
|
-
|
63
|
-
"^" : 2,
|
64
|
-
"*" : 3
|
65
|
-
}
|
66
|
-
|
63
|
+
index_for_flag = {"_": 1, "^": 2, "*": 3}
|
64
|
+
|
67
65
|
for c in context:
|
68
|
-
if (c in index_for_flag.keys()) and (j <length and context[j+1] ==
|
66
|
+
if (c in index_for_flag.keys()) and (j < length and context[j + 1] == "{"):
|
69
67
|
flag = True
|
70
68
|
contexts.append(context[i:j])
|
71
69
|
sub_or_super.append(index_for_flag[c])
|
72
|
-
i = j
|
70
|
+
i = j + 2
|
73
71
|
if flag and c == "}":
|
74
72
|
contexts.append(context[i:j])
|
75
73
|
sub_or_super.append(0)
|
76
|
-
i = j+1
|
74
|
+
i = j + 1
|
77
75
|
flag = False
|
78
|
-
j+=1
|
76
|
+
j += 1
|
79
77
|
contexts.append(context[i:j])
|
80
78
|
return contexts, sub_or_super
|
81
79
|
|
82
|
-
|
80
|
+
|
81
|
+
def add_comma_in_num_str(num: int):
|
83
82
|
if not isinstance(num, int):
|
84
83
|
raise ValueError("Only int number can be added.")
|
85
84
|
num_str = str(num)[::-1]
|
86
85
|
result = ""
|
87
86
|
for i in range(len(num_str)):
|
88
|
-
if i>0 and i%3 == 0 and num_str[i] !="-":
|
87
|
+
if i > 0 and i % 3 == 0 and num_str[i] != "-":
|
89
88
|
result = "," + result
|
90
89
|
result = num_str[i] + result
|
91
90
|
return result
|
92
91
|
|
93
92
|
|
94
93
|
class MatrixSolver:
|
95
|
-
def __init__(self,stair: StairPart):
|
94
|
+
def __init__(self, stair: StairPart):
|
96
95
|
self.stair = stair
|
97
96
|
self.cut_point = 0.5
|
98
|
-
|
99
|
-
def set_load(self, q1,q2,q3):
|
97
|
+
|
98
|
+
def set_load(self, q1, q2, q3):
|
100
99
|
self.q1 = q1
|
101
100
|
self.q2 = q2
|
102
101
|
self.q3 = q3
|
103
|
-
|
102
|
+
|
104
103
|
def pre_analysis(self):
|
105
104
|
concrete_e = 30000
|
106
105
|
uniform_b = 1000
|
107
|
-
top_y =
|
106
|
+
top_y = (
|
107
|
+
self.stair.position.higher_elevation - self.stair.position.lower_elevation
|
108
|
+
)
|
108
109
|
if self.stair.stair_type == "AT":
|
109
110
|
self.point_num = 3
|
110
|
-
self.boundary = np.array([
|
111
|
-
|
112
|
-
point1 = [0,0]
|
113
|
-
point2 = [self.stair.total_horizental_length,top_y]
|
114
|
-
point_middle = self.calculate_middle_point(point1,point2,self.cut_point)
|
115
|
-
comp1 = Component(point1,point_middle)
|
116
|
-
comp2 = Component(point_middle,point2)
|
111
|
+
self.boundary = np.array([0, 0, 1, 1, 1, 1, 0, 0, 1])
|
112
|
+
|
113
|
+
point1 = [0, 0]
|
114
|
+
point2 = [self.stair.total_horizental_length, top_y]
|
115
|
+
point_middle = self.calculate_middle_point(point1, point2, self.cut_point)
|
116
|
+
comp1 = Component(point1, point_middle)
|
117
|
+
comp2 = Component(point_middle, point2)
|
117
118
|
comp1.set_vertical_q(self.q2)
|
118
|
-
comp1.set_comp_attr(concrete_e,uniform_b,self.stair.main_thick)
|
119
|
+
comp1.set_comp_attr(concrete_e, uniform_b, self.stair.main_thick)
|
119
120
|
comp2.set_vertical_q(self.q2)
|
120
|
-
comp2.set_comp_attr(concrete_e,uniform_b,self.stair.main_thick)
|
121
|
-
self.comp_list = [comp1,comp2]
|
121
|
+
comp2.set_comp_attr(concrete_e, uniform_b, self.stair.main_thick)
|
122
|
+
self.comp_list = [comp1, comp2]
|
122
123
|
|
123
124
|
elif self.stair.stair_type == "BT":
|
124
125
|
self.point_num = 4
|
125
|
-
self.q_list = [self.q1,self.q2,self.q2]
|
126
|
-
self.boundary = np.array([
|
127
|
-
point0 = [0,0]
|
128
|
-
point1 = [self.stair.left_extend_length,0]
|
129
|
-
point2 = [self.stair.total_horizental_length,top_y]
|
130
|
-
point_middle = self.calculate_middle_point(point1,point2,self.cut_point)
|
131
|
-
comp1 = Component(point0,point1)
|
132
|
-
comp2 = Component(point1,point_middle)
|
133
|
-
comp3 = Component(point_middle,point2)
|
126
|
+
self.q_list = [self.q1, self.q2, self.q2]
|
127
|
+
self.boundary = np.array([0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1])
|
128
|
+
point0 = [0, 0]
|
129
|
+
point1 = [self.stair.left_extend_length, 0]
|
130
|
+
point2 = [self.stair.total_horizental_length, top_y]
|
131
|
+
point_middle = self.calculate_middle_point(point1, point2, self.cut_point)
|
132
|
+
comp1 = Component(point0, point1)
|
133
|
+
comp2 = Component(point1, point_middle)
|
134
|
+
comp3 = Component(point_middle, point2)
|
134
135
|
comp1.set_vertical_q(self.q1)
|
135
|
-
comp1.set_comp_attr(concrete_e,uniform_b,self.stair.left_thick)
|
136
|
+
comp1.set_comp_attr(concrete_e, uniform_b, self.stair.left_thick)
|
136
137
|
comp2.set_vertical_q(self.q2)
|
137
|
-
comp2.set_comp_attr(concrete_e,uniform_b,self.stair.main_thick)
|
138
|
+
comp2.set_comp_attr(concrete_e, uniform_b, self.stair.main_thick)
|
138
139
|
comp3.set_vertical_q(self.q2)
|
139
|
-
comp3.set_comp_attr(concrete_e,uniform_b,self.stair.main_thick)
|
140
|
-
self.comp_list = [comp1,comp2,comp3]
|
141
|
-
|
140
|
+
comp3.set_comp_attr(concrete_e, uniform_b, self.stair.main_thick)
|
141
|
+
self.comp_list = [comp1, comp2, comp3]
|
142
|
+
|
142
143
|
elif self.stair.stair_type == "CT":
|
143
144
|
self.point_num = 4
|
144
|
-
self.q_list = [self.q2,self.q2,self.q3]
|
145
|
-
self.boundary = np.array([
|
146
|
-
|
147
|
-
point1 = [0,0]
|
148
|
-
point2 = [
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
145
|
+
self.q_list = [self.q2, self.q2, self.q3]
|
146
|
+
self.boundary = np.array([0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1])
|
147
|
+
|
148
|
+
point1 = [0, 0]
|
149
|
+
point2 = [
|
150
|
+
self.stair.total_horizental_length - self.stair.right_extend_length,
|
151
|
+
top_y,
|
152
|
+
]
|
153
|
+
point3 = [self.stair.total_horizental_length, top_y]
|
154
|
+
point_middle = self.calculate_middle_point(point1, point2, self.cut_point)
|
155
|
+
comp1 = Component(point1, point_middle)
|
156
|
+
comp2 = Component(point_middle, point2)
|
157
|
+
comp3 = Component(point2, point3)
|
154
158
|
comp1.set_vertical_q(self.q2)
|
155
|
-
comp1.set_comp_attr(concrete_e,uniform_b,self.stair.main_thick)
|
156
|
-
|
159
|
+
comp1.set_comp_attr(concrete_e, uniform_b, self.stair.main_thick)
|
160
|
+
|
157
161
|
comp2.set_vertical_q(self.q2)
|
158
|
-
comp2.set_comp_attr(concrete_e,uniform_b,self.stair.main_thick)
|
159
|
-
|
162
|
+
comp2.set_comp_attr(concrete_e, uniform_b, self.stair.main_thick)
|
163
|
+
|
160
164
|
comp3.set_vertical_q(self.q3)
|
161
|
-
comp3.set_comp_attr(concrete_e,uniform_b,self.stair.right_thick)
|
162
|
-
self.comp_list = [comp1,comp2,comp3]
|
163
|
-
|
164
|
-
|
165
|
+
comp3.set_comp_attr(concrete_e, uniform_b, self.stair.right_thick)
|
166
|
+
self.comp_list = [comp1, comp2, comp3]
|
167
|
+
|
165
168
|
else:
|
166
169
|
self.point_num = 5
|
167
|
-
self.q_list = [self.q1,self.q2,self.q2,self.q3]
|
170
|
+
self.q_list = [self.q1, self.q2, self.q2, self.q3]
|
168
171
|
self.boundary = np.array([0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1])
|
169
|
-
|
170
|
-
point0 = [0,0]
|
171
|
-
point1 = [self.stair.left_extend_length,0]
|
172
|
-
point2 = [
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
172
|
+
|
173
|
+
point0 = [0, 0]
|
174
|
+
point1 = [self.stair.left_extend_length, 0]
|
175
|
+
point2 = [
|
176
|
+
self.stair.total_horizental_length - self.stair.right_extend_length,
|
177
|
+
top_y,
|
178
|
+
]
|
179
|
+
point3 = [self.stair.total_horizental_length, top_y]
|
180
|
+
point_middle = self.calculate_middle_point(point1, point2, self.cut_point)
|
181
|
+
comp1 = Component(point0, point1)
|
182
|
+
comp2 = Component(point1, point_middle)
|
183
|
+
comp3 = Component(point_middle, point2)
|
184
|
+
comp4 = Component(point2, point3)
|
179
185
|
|
180
186
|
comp1.set_vertical_q(self.q1)
|
181
|
-
comp1.set_comp_attr(concrete_e,uniform_b,self.stair.left_thick)
|
187
|
+
comp1.set_comp_attr(concrete_e, uniform_b, self.stair.left_thick)
|
182
188
|
comp2.set_vertical_q(self.q2)
|
183
|
-
comp2.set_comp_attr(concrete_e,uniform_b,self.stair.main_thick)
|
189
|
+
comp2.set_comp_attr(concrete_e, uniform_b, self.stair.main_thick)
|
184
190
|
comp3.set_vertical_q(self.q2)
|
185
|
-
comp3.set_comp_attr(concrete_e,uniform_b,self.stair.main_thick)
|
191
|
+
comp3.set_comp_attr(concrete_e, uniform_b, self.stair.main_thick)
|
186
192
|
comp4.set_vertical_q(self.q3)
|
187
|
-
comp4.set_comp_attr(concrete_e,uniform_b,self.stair.right_thick)
|
188
|
-
self.comp_list = [comp1,comp2,comp3,comp4]
|
189
|
-
|
190
|
-
def calculate_middle_point(self, p1, p2,cut_point):
|
191
|
-
x = p1[0] + (p2[0]-p1[0])*cut_point
|
192
|
-
y = p1[1] + (p2[1]-p1[1])*cut_point
|
193
|
-
return [x,y]
|
194
|
-
|
193
|
+
comp4.set_comp_attr(concrete_e, uniform_b, self.stair.right_thick)
|
194
|
+
self.comp_list = [comp1, comp2, comp3, comp4]
|
195
|
+
|
196
|
+
def calculate_middle_point(self, p1, p2, cut_point):
|
197
|
+
x = p1[0] + (p2[0] - p1[0]) * cut_point
|
198
|
+
y = p1[1] + (p2[1] - p1[1]) * cut_point
|
199
|
+
return [x, y]
|
200
|
+
|
195
201
|
def submit_problem(self):
|
196
202
|
self.pre_analysis()
|
197
203
|
comp_num = len(self.comp_list)
|
198
|
-
total_k = np.zeros((comp_num*3+3,comp_num*3+3))
|
199
|
-
total_f = np.zeros((comp_num*3+3,1))
|
204
|
+
total_k = np.zeros((comp_num * 3 + 3, comp_num * 3 + 3))
|
205
|
+
total_f = np.zeros((comp_num * 3 + 3, 1))
|
200
206
|
for i in range(len(self.comp_list)):
|
201
207
|
comp = self.comp_list[i]
|
202
208
|
temp_k = comp.create_k()
|
203
209
|
temp_f = comp.create_f()
|
204
|
-
total_k[i*3:i*3+6,i*3:i*3+6] += temp_k
|
205
|
-
total_f[i*3:i*3+6
|
210
|
+
total_k[i * 3 : i * 3 + 6, i * 3 : i * 3 + 6] += temp_k
|
211
|
+
total_f[i * 3 : i * 3 + 6, :] += temp_f
|
206
212
|
# 生成缩减矩阵并计算
|
207
|
-
new_k = np.delete(total_k,np.nonzero(self.boundary == 0),axis=0)
|
208
|
-
new_k = np.delete(new_k,np.nonzero(self.boundary == 0),axis=1)
|
209
|
-
new_f = np.delete(total_f,np.nonzero(self.boundary == 0),axis=0)
|
210
|
-
new_u = np.dot(np.linalg.inv(new_k),new_f)
|
211
|
-
|
212
|
-
total_u = self.boundary.copy().reshape(-1,1).astype(float)
|
213
|
+
new_k = np.delete(total_k, np.nonzero(self.boundary == 0), axis=0)
|
214
|
+
new_k = np.delete(new_k, np.nonzero(self.boundary == 0), axis=1)
|
215
|
+
new_f = np.delete(total_f, np.nonzero(self.boundary == 0), axis=0)
|
216
|
+
new_u = np.dot(np.linalg.inv(new_k), new_f)
|
217
|
+
|
218
|
+
total_u = self.boundary.copy().reshape(-1, 1).astype(float)
|
213
219
|
total_u[np.nonzero(total_u == 1)[0]] = new_u
|
214
|
-
|
220
|
+
|
215
221
|
# 计算每个构件端点的数据
|
216
222
|
for i in range(len(self.comp_list)):
|
217
223
|
comp = self.comp_list[i]
|
218
|
-
comp_u = total_u[i*3:i*3+6]
|
219
|
-
comp_f = np.dot(comp.create_k(),comp_u)
|
224
|
+
comp_u = total_u[i * 3 : i * 3 + 6]
|
225
|
+
comp_f = np.dot(comp.create_k(), comp_u)
|
220
226
|
comp_f -= comp.create_f()
|
221
|
-
comp.set_f(comp_f[0][0],comp_f[1][0],comp_f[3][0],comp_f[4][0])
|
222
|
-
comp.set_m(comp_f[2][0],comp_f[5][0])
|
227
|
+
comp.set_f(comp_f[0][0], comp_f[1][0], comp_f[3][0], comp_f[4][0])
|
228
|
+
comp.set_m(comp_f[2][0], comp_f[5][0])
|
223
229
|
return self.comp_list
|
224
|
-
|
225
|
-
|
@@ -1,7 +1,7 @@
|
|
1
1
|
from .BasicGenerator import BasicGenerator, PageSize
|
2
|
-
from .SeismicReport import SeismicReport
|
2
|
+
from .SeismicReport import SeismicReport, SeismicReportData
|
3
3
|
from .DocParagraph import DocParagraph
|
4
4
|
from .DocTable import DocTable
|
5
5
|
from .DocPicture import DocPicture
|
6
6
|
from .UtilFunctions import add_comma_in_num_str
|
7
|
-
from .StairCalculationReport import StairCalculationReport
|
7
|
+
from .StairCalculationReport import StairCalculationReport
|
@@ -1,26 +1,23 @@
|
|
1
|
-
from ..Section import Section,ShapeEnum
|
1
|
+
from ..Section import Section, ShapeEnum
|
2
2
|
from ..Geometry import Joint
|
3
3
|
|
4
|
+
|
4
5
|
class Beam:
|
5
|
-
def __init__(
|
6
|
-
self
|
7
|
-
id:int,
|
8
|
-
start_joint:Joint,
|
9
|
-
end_joint:Joint,
|
10
|
-
section:Section
|
11
|
-
):
|
12
|
-
self.id = id
|
6
|
+
def __init__(self, id: int, start_joint: Joint, end_joint: Joint, section: Section):
|
7
|
+
self.id = id
|
13
8
|
self.start_joint = start_joint
|
14
9
|
self.end_joint = end_joint
|
15
10
|
self.section = section
|
16
11
|
self.std_flr_id = self.start_joint.std_flr_id
|
17
|
-
|
18
|
-
|
12
|
+
|
19
13
|
def get_data_for_plot(self):
|
20
|
-
return [
|
21
|
-
|
14
|
+
return [
|
15
|
+
[self.start_joint.x, self.end_joint.x],
|
16
|
+
[self.start_joint.y, self.end_joint.y],
|
17
|
+
]
|
18
|
+
|
22
19
|
def __str__(self):
|
23
20
|
return f"Beam:{self.id}-{str(self.section)}"
|
24
|
-
|
21
|
+
|
25
22
|
def __repr__(self):
|
26
|
-
return self.__str__()
|
23
|
+
return self.__str__()
|
@@ -1,16 +1,16 @@
|
|
1
|
-
from ..Section import Section,ShapeEnum
|
1
|
+
from ..Section import Section, ShapeEnum
|
2
2
|
from ..Geometry import Joint
|
3
3
|
|
4
|
+
|
4
5
|
class Column:
|
5
|
-
def __init__(self,id:int,joint:Joint,section:Section):
|
6
|
+
def __init__(self, id: int, joint: Joint, section: Section):
|
6
7
|
self.id = id
|
7
8
|
self.joint = joint
|
8
9
|
self.std_flr_id = joint.std_flr_id
|
9
10
|
self.section = section
|
10
|
-
|
11
11
|
|
12
12
|
def __str__(self):
|
13
13
|
return f"Column:{self.id}-{str(self.section)}"
|
14
|
-
|
14
|
+
|
15
15
|
def __repr__(self):
|
16
|
-
return self.__str__()
|
16
|
+
return self.__str__()
|
@@ -1,21 +1,17 @@
|
|
1
|
-
|
2
1
|
from .Joint import Joint
|
3
2
|
|
3
|
+
|
4
4
|
class Grid:
|
5
|
-
def __init__(
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
if s_joint.std_flr_id!= e_joint.std_flr_id:
|
12
|
-
raise ValueError("The standard-floor-ids of two Joints is not same! " +
|
13
|
-
"Please check the data!")
|
5
|
+
def __init__(self, id: int, s_joint: Joint, e_joint: Joint):
|
6
|
+
if s_joint.std_flr_id != e_joint.std_flr_id:
|
7
|
+
raise ValueError(
|
8
|
+
"The standard-floor-ids of two Joints is not same! "
|
9
|
+
+ "Please check the data!"
|
10
|
+
)
|
14
11
|
self.id = id
|
15
12
|
self.start_joint = s_joint
|
16
13
|
self.end_joint = e_joint
|
17
14
|
self.std_flr_id = s_joint.std_flr_id
|
18
|
-
|
15
|
+
|
19
16
|
def get_length(self):
|
20
17
|
return self.start_joint.distance_to_joint(self.end_joint)
|
21
|
-
|
@@ -1,25 +1,26 @@
|
|
1
1
|
import math
|
2
2
|
|
3
|
+
|
3
4
|
class Joint:
|
4
|
-
def __init__(self,id:int,x:float,y:float,std_flr_id:int):
|
5
|
+
def __init__(self, id: int, x: float, y: float, std_flr_id: int):
|
5
6
|
self.id = id
|
6
7
|
self.x = x
|
7
8
|
self.y = y
|
8
9
|
self.std_flr_id = std_flr_id
|
9
10
|
|
10
|
-
def distance_to_joint(self,other)-> float:
|
11
|
+
def distance_to_joint(self, other) -> float:
|
11
12
|
if not isinstance(other, Joint):
|
12
13
|
raise ValueError("Input should be Joint")
|
13
|
-
dis_square = (self.x - other.x)**2 + (self.y - other.y)**2
|
14
|
+
dis_square = (self.x - other.x) ** 2 + (self.y - other.y) ** 2
|
14
15
|
return math.sqrt(dis_square)
|
15
|
-
|
16
|
+
|
16
17
|
def __str__(self):
|
17
18
|
return f"Joint(id:{self.id}):[x:{self.x:.4f},y:{self.y:.4f}]:stdFlrId:{self.std_flr_id}"
|
18
|
-
|
19
|
+
|
19
20
|
def __repr__(self):
|
20
|
-
return str(self)
|
21
|
-
|
22
|
-
|
21
|
+
return str(self)
|
22
|
+
|
23
|
+
|
23
24
|
if __name__ == "__main__":
|
24
|
-
j = Joint(1,3.1,36.6513246534313)
|
25
|
-
print(j)
|
25
|
+
j = Joint(1, 3.1, 36.6513246534313)
|
26
|
+
print(j)
|
@@ -1,2 +1,2 @@
|
|
1
1
|
class StandFloor:
|
2
|
-
pass
|
2
|
+
pass
|
@@ -1,45 +1,65 @@
|
|
1
1
|
from typing import List
|
2
2
|
|
3
|
+
|
3
4
|
class SingleMassResult:
|
4
|
-
def __init__(
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
5
|
+
def __init__(
|
6
|
+
self,
|
7
|
+
floor_num: int,
|
8
|
+
tower_num: int,
|
9
|
+
dead_load: float,
|
10
|
+
live_load: float,
|
11
|
+
slab_area: float,
|
10
12
|
):
|
11
13
|
self.floor_num = floor_num
|
12
14
|
self.tower_num = tower_num
|
13
|
-
self.dead_load = dead_load
|
14
|
-
"""
|
15
|
-
self.live_load = live_load
|
16
|
-
"""
|
17
|
-
self.slab_area = slab_area
|
18
|
-
"""
|
19
|
-
|
15
|
+
self.dead_load = round(dead_load, 4)
|
16
|
+
"""单层恒载,单位kN,没有折减"""
|
17
|
+
self.live_load = round(live_load, 4) * 2
|
18
|
+
"""单层活载,单位kN,没有折减"""
|
19
|
+
self.slab_area = round(slab_area)
|
20
|
+
"""单层楼板面积,单位m2"""
|
21
|
+
|
20
22
|
@property
|
21
|
-
def
|
23
|
+
def total_load(self):
|
22
24
|
"""单层质量,恒+0.5活"""
|
23
|
-
return self.dead_load + 0.5 * self.live_load
|
25
|
+
return round(self.dead_load + 0.5 * self.live_load, 4)
|
26
|
+
|
27
|
+
def to_json(self):
|
28
|
+
return {
|
29
|
+
"floor_num": self.floor_num,
|
30
|
+
"tower_num": self.tower_num,
|
31
|
+
"dead_load": self.dead_load,
|
32
|
+
"live_load": self.live_load,
|
33
|
+
}
|
34
|
+
|
24
35
|
|
25
36
|
class MassResult:
|
26
|
-
def __init__(self, mass_list:List[SingleMassResult]):
|
37
|
+
def __init__(self, mass_list: List[SingleMassResult]):
|
27
38
|
self.mass_list = mass_list
|
28
|
-
|
39
|
+
|
29
40
|
@property
|
30
41
|
def total_slab_area(self):
|
31
42
|
return sum([i.slab_area for i in self.mass_list])
|
32
|
-
|
43
|
+
|
33
44
|
@property
|
34
45
|
def total_dead_load(self):
|
35
46
|
return sum([i.dead_load for i in self.mass_list])
|
36
|
-
|
47
|
+
|
37
48
|
@property
|
38
49
|
def total_live_load(self):
|
39
50
|
return sum([i.live_load for i in self.mass_list])
|
40
|
-
|
51
|
+
|
41
52
|
@property
|
42
|
-
def
|
43
|
-
return sum([i.
|
44
|
-
|
45
|
-
|
53
|
+
def total_load(self):
|
54
|
+
return sum([i.total_load for i in self.mass_list])
|
55
|
+
|
56
|
+
@classmethod
|
57
|
+
def mock_data(cls):
|
58
|
+
mass_list = []
|
59
|
+
for i in range(5):
|
60
|
+
mass_list.append(SingleMassResult(i + 1, 1, 5000, 2000, 350))
|
61
|
+
|
62
|
+
return MassResult(mass_list)
|
63
|
+
|
64
|
+
def to_json(self):
|
65
|
+
return {"mass_list": [i.to_json() for i in self.mass_list]}
|