civil-tools-v 0.0.4__py3-none-any.whl → 0.0.6__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/Steel.py +3 -3
- CivilTools/FigureGenerator/BasicPNGPlotter.py +93 -5
- CivilTools/FigureGenerator/SeismicReport/Drift.py +28 -1
- CivilTools/FigureGenerator/StairCalculationSheetPNGPlotter.py +595 -5
- CivilTools/FigureGenerator/__init__.py +1 -0
- CivilTools/ReportGenerator/DocPicture.py +5 -2
- CivilTools/ReportGenerator/StairCalculationReport.py +346 -52
- CivilTools/ReportGenerator/UtilFunctions.py +91 -0
- CivilTools/YDBLoader/BuildingDefine/StairPart/LoadDefine.py +15 -7
- CivilTools/YDBLoader/BuildingDefine/StairPart/StairComponent.py +8 -0
- CivilTools/YDBLoader/BuildingDefine/StairPart/StairPart.py +66 -6
- CivilTools/__init__.py +3 -1
- {civil_tools_v-0.0.4.dist-info → civil_tools_v-0.0.6.dist-info}/METADATA +1 -1
- {civil_tools_v-0.0.4.dist-info → civil_tools_v-0.0.6.dist-info}/RECORD +17 -17
- {civil_tools_v-0.0.4.dist-info → civil_tools_v-0.0.6.dist-info}/LICENSE +0 -0
- {civil_tools_v-0.0.4.dist-info → civil_tools_v-0.0.6.dist-info}/WHEEL +0 -0
- {civil_tools_v-0.0.4.dist-info → civil_tools_v-0.0.6.dist-info}/top_level.txt +0 -0
@@ -1,10 +1,600 @@
|
|
1
1
|
from .BasicPNGPlotter import BasicPNGPlotter
|
2
|
+
from CivilTools.YDBLoader.BuildingDefine.StairPart import StairPart
|
3
|
+
import math
|
4
|
+
from typing import List
|
2
5
|
|
3
6
|
|
4
|
-
class
|
5
|
-
def __init__(self):
|
6
|
-
self.plotter = BasicPNGPlotter()
|
7
|
+
class StairCalculationSheetPNGPlotter:
|
8
|
+
def __init__(self, stair_part: StairPart):
|
9
|
+
self.plotter = BasicPNGPlotter(5000, 3500)
|
10
|
+
self.pen_width = 5
|
11
|
+
self.bold_pen_width = 15
|
12
|
+
self.current_stair = stair_part
|
13
|
+
self.start_x = 800
|
14
|
+
self.end_x = 4200
|
15
|
+
self.start_y = 2200
|
16
|
+
self.end_y = 750 if self.current_stair.stair_type == "CT" else 500
|
17
|
+
self.extend = 500
|
18
|
+
"""绘图时左右平台的宽度"""
|
19
|
+
self.__plot_basic_stair()
|
7
20
|
|
8
|
-
|
21
|
+
@property
|
22
|
+
def position_AT2(self):
|
23
|
+
return (self.start_x, self.start_y, self.end_x, self.end_y)
|
9
24
|
|
10
|
-
|
25
|
+
@property
|
26
|
+
def position_BT1(self):
|
27
|
+
return (self.start_x, self.start_y, self.start_x + self.extend, self.start_y)
|
28
|
+
|
29
|
+
@property
|
30
|
+
def position_BT2(self):
|
31
|
+
return (self.start_x + self.extend, self.start_y, self.end_x, self.end_y)
|
32
|
+
|
33
|
+
@property
|
34
|
+
def position_CT2(self):
|
35
|
+
return (self.start_x, self.start_y, self.end_x - self.extend, self.end_y)
|
36
|
+
|
37
|
+
@property
|
38
|
+
def position_CT3(self):
|
39
|
+
return (self.end_x - self.extend, self.end_y, self.end_x, self.end_y)
|
40
|
+
|
41
|
+
@property
|
42
|
+
def position_DT1(self):
|
43
|
+
return self.position_BT1
|
44
|
+
|
45
|
+
@property
|
46
|
+
def position_DT2(self):
|
47
|
+
return (
|
48
|
+
self.start_x + self.extend,
|
49
|
+
self.start_y,
|
50
|
+
self.end_x - self.extend,
|
51
|
+
self.end_y,
|
52
|
+
)
|
53
|
+
|
54
|
+
@property
|
55
|
+
def position_DT3(self):
|
56
|
+
return self.position_CT3
|
57
|
+
|
58
|
+
def plot_moment(self, moments: List[float]):
|
59
|
+
moment_max = max([abs(i) for i in moments])
|
60
|
+
# 用来确定弯矩最大值处的高度
|
61
|
+
moment_height = [m / moment_max * 400 for m in moments]
|
62
|
+
moment_height_1 = [0, moment_height[1] * 0.25, moment_height[1]]
|
63
|
+
moment_height_2 = [moment_height[1], moment_height[2], moment_height[3]]
|
64
|
+
moment_height_3 = [moment_height[3], moment_height[3] * 0.25, 0]
|
65
|
+
moment_1 = [0, moments[1] * 0.25, moments[1]]
|
66
|
+
moment_2 = [moments[1], moments[2], moments[3]]
|
67
|
+
moment_3 = [moments[3], moments[3] * 0.25, 0]
|
68
|
+
|
69
|
+
if self.current_stair.stair_type == "AT":
|
70
|
+
self.__draw_moment_curve(
|
71
|
+
*self.position_AT2, moment_height_2, moment_2, True
|
72
|
+
)
|
73
|
+
elif self.current_stair.stair_type == "BT":
|
74
|
+
self.__draw_moment_curve(
|
75
|
+
*self.position_BT1, moment_height_1, moment_1, False
|
76
|
+
)
|
77
|
+
self.__draw_moment_curve(
|
78
|
+
*self.position_BT2, moment_height_2, moment_2, True
|
79
|
+
)
|
80
|
+
elif self.current_stair.stair_type == "CT":
|
81
|
+
self.__draw_moment_curve(
|
82
|
+
*self.position_CT2, moment_height_2, moment_2, True
|
83
|
+
)
|
84
|
+
self.__draw_moment_curve(
|
85
|
+
*self.position_CT3, moment_height_3, moment_3, False
|
86
|
+
)
|
87
|
+
elif self.current_stair.stair_type == "DT":
|
88
|
+
self.__draw_moment_curve(
|
89
|
+
*self.position_DT1, moment_height_1, moment_1, False
|
90
|
+
)
|
91
|
+
self.__draw_moment_curve(
|
92
|
+
*self.position_DT2, moment_height_2, moment_2, True
|
93
|
+
)
|
94
|
+
self.__draw_moment_curve(
|
95
|
+
*self.position_DT3, moment_height_3, moment_3, False
|
96
|
+
)
|
97
|
+
self.__draw_label_and_title("弯矩线", "弯矩图(kN·m)")
|
98
|
+
|
99
|
+
def plot_shear(self, shears: List[float]):
|
100
|
+
shear_max = max([abs(i) for i in shears])
|
101
|
+
# 用来确定弯矩最大值处的高度
|
102
|
+
shear_height = [s / shear_max * 400 for s in shears]
|
103
|
+
shear_height_1 = [shear_height[0], shear_height[1]]
|
104
|
+
shear_height_2 = [shear_height[2], shear_height[3]]
|
105
|
+
shear_height_3 = [shear_height[4], shear_height[5]]
|
106
|
+
shear_1 = [shears[0], shears[1]]
|
107
|
+
shear_2 = [shears[2], shears[3]]
|
108
|
+
shear_3 = [shears[4], shears[5]]
|
109
|
+
|
110
|
+
# todo: 具体绘图
|
111
|
+
if self.current_stair.stair_type == "AT":
|
112
|
+
self.__draw_shear_curve(*self.position_AT2, shear_height_2, shear_2, True)
|
113
|
+
elif self.current_stair.stair_type == "BT":
|
114
|
+
self.__draw_shear_curve(*self.position_BT1, shear_height_1, shear_1)
|
115
|
+
self.__draw_shear_curve(*self.position_BT2, shear_height_2, shear_2, True)
|
116
|
+
elif self.current_stair.stair_type == "CT":
|
117
|
+
self.__draw_shear_curve(*self.position_CT2, shear_height_2, shear_2, True)
|
118
|
+
self.__draw_shear_curve(*self.position_CT3, shear_height_3, shear_3)
|
119
|
+
elif self.current_stair.stair_type == "DT":
|
120
|
+
self.__draw_shear_curve(*self.position_DT1, shear_height_1, shear_1)
|
121
|
+
self.__draw_shear_curve(*self.position_DT2, shear_height_2, shear_2, True)
|
122
|
+
self.__draw_shear_curve(*self.position_DT3, shear_height_3, shear_3)
|
123
|
+
self.__draw_label_and_title("剪力线", "剪力图(kN)")
|
124
|
+
|
125
|
+
def plot_displacement(self, disp: float):
|
126
|
+
start_x = self.start_x
|
127
|
+
end_x = self.end_x
|
128
|
+
start_y = self.start_y
|
129
|
+
end_y = self.end_y
|
130
|
+
# todo: 具体绘图
|
131
|
+
if self.current_stair.stair_type == "AT":
|
132
|
+
self.__draw_disp_curve(start_x, start_y, end_x, end_y, disp)
|
133
|
+
elif self.current_stair.stair_type == "BT":
|
134
|
+
self.plotter.draw_line(
|
135
|
+
start_x, start_y, start_x + self.extend, start_y + 200
|
136
|
+
)
|
137
|
+
self.__draw_disp_curve(
|
138
|
+
start_x + self.extend, start_y + 200, end_x, end_y, disp
|
139
|
+
)
|
140
|
+
elif self.current_stair.stair_type == "CT":
|
141
|
+
self.__draw_disp_curve(
|
142
|
+
start_x, start_y, end_x - self.extend, end_y + 200, disp
|
143
|
+
)
|
144
|
+
self.plotter.draw_line(end_x - self.extend, end_y + 200, end_x, end_y)
|
145
|
+
elif self.current_stair.stair_type == "DT":
|
146
|
+
self.plotter.draw_line(
|
147
|
+
start_x, start_y, start_x + self.extend, start_y + 200
|
148
|
+
)
|
149
|
+
self.__draw_disp_curve(
|
150
|
+
start_x + self.extend,
|
151
|
+
start_y + 200,
|
152
|
+
end_x - self.extend,
|
153
|
+
end_y + 200,
|
154
|
+
disp,
|
155
|
+
)
|
156
|
+
self.plotter.draw_line(end_x - self.extend, end_y + 200, end_x, end_y)
|
157
|
+
self.__draw_label_and_title("塑性挠度线", "塑性挠度图(mm)")
|
158
|
+
|
159
|
+
def plot_calculate_rebar_area(
|
160
|
+
self,
|
161
|
+
rebar_areas_left: List[float],
|
162
|
+
rebar_areas_middle: List[float],
|
163
|
+
rebar_areas_right: List[float],
|
164
|
+
):
|
165
|
+
x_offset_base = 180
|
166
|
+
x_offset_small = 80
|
167
|
+
x_offset_big = 350
|
168
|
+
if self.current_stair.stair_type == "AT":
|
169
|
+
self.__draw_rebar_area(
|
170
|
+
*self.position_AT2, rebar_areas_middle, x_offset_base
|
171
|
+
)
|
172
|
+
elif self.current_stair.stair_type == "BT":
|
173
|
+
self.__draw_rebar_area(*self.position_BT1, rebar_areas_left, x_offset_small)
|
174
|
+
self.__draw_rebar_area(*self.position_BT2, rebar_areas_middle, x_offset_big)
|
175
|
+
elif self.current_stair.stair_type == "CT":
|
176
|
+
self.__draw_rebar_area(*self.position_CT2, rebar_areas_middle, x_offset_big)
|
177
|
+
self.__draw_rebar_area(
|
178
|
+
*self.position_CT3, rebar_areas_right, x_offset_small
|
179
|
+
)
|
180
|
+
elif self.current_stair.stair_type == "DT":
|
181
|
+
self.__draw_rebar_area(*self.position_DT1, rebar_areas_left, x_offset_small)
|
182
|
+
self.__draw_rebar_area(*self.position_DT2, rebar_areas_middle, x_offset_big)
|
183
|
+
self.__draw_rebar_area(
|
184
|
+
*self.position_DT3, rebar_areas_right, x_offset_small
|
185
|
+
)
|
186
|
+
self.__draw_label_and_title(None, "计算配筋简图")
|
187
|
+
|
188
|
+
def plot_real_rebar(
|
189
|
+
self, rebar_left: List[str], rebar_middle: List[str], rebar_right: List[str]
|
190
|
+
):
|
191
|
+
x_offset_base = 180
|
192
|
+
x_offset_small = 80
|
193
|
+
x_offset_big = 350
|
194
|
+
if self.current_stair.stair_type == "AT":
|
195
|
+
self.__draw_rebar_area(*self.position_AT2, rebar_middle, x_offset_base)
|
196
|
+
elif self.current_stair.stair_type == "BT":
|
197
|
+
self.__draw_rebar_area(*self.position_BT1, rebar_left, x_offset_small)
|
198
|
+
self.__draw_rebar_area(*self.position_BT2, rebar_middle, x_offset_big)
|
199
|
+
elif self.current_stair.stair_type == "CT":
|
200
|
+
self.__draw_rebar_area(*self.position_CT2, rebar_middle, x_offset_big)
|
201
|
+
self.__draw_rebar_area(*self.position_CT3, rebar_right, x_offset_small)
|
202
|
+
elif self.current_stair.stair_type == "DT":
|
203
|
+
self.__draw_rebar_area(*self.position_DT1, rebar_left, x_offset_small)
|
204
|
+
self.__draw_rebar_area(*self.position_DT2, rebar_middle, x_offset_big)
|
205
|
+
self.__draw_rebar_area(*self.position_DT3, rebar_right, x_offset_small)
|
206
|
+
self.__draw_label_and_title(None, "实际配筋简图")
|
207
|
+
|
208
|
+
def plot_crack(self, w_list):
|
209
|
+
if self.current_stair.stair_type == "AT":
|
210
|
+
self.__draw_rebar_area(*self.position_AT2, w_list)
|
211
|
+
elif self.current_stair.stair_type == "BT":
|
212
|
+
self.__draw_rebar_area(*self.position_BT2, w_list)
|
213
|
+
elif self.current_stair.stair_type == "CT":
|
214
|
+
self.__draw_rebar_area(*self.position_CT2, w_list)
|
215
|
+
elif self.current_stair.stair_type == "DT":
|
216
|
+
self.__draw_rebar_area(*self.position_DT2, w_list)
|
217
|
+
self.__draw_label_and_title(None, "裂缝图")
|
218
|
+
|
219
|
+
def to_stream(self):
|
220
|
+
return self.plotter.to_stream()
|
221
|
+
|
222
|
+
def save(self, path):
|
223
|
+
self.plotter.save(path)
|
224
|
+
|
225
|
+
def __plot_basic_stair(self):
|
226
|
+
start_x = self.start_x
|
227
|
+
end_x = self.end_x
|
228
|
+
start_y = self.start_y
|
229
|
+
end_y = self.end_y
|
230
|
+
if self.current_stair.stair_type == "AT":
|
231
|
+
self.plotter.draw_line(start_x, start_y, end_x, end_y)
|
232
|
+
self.__draw_dimension(
|
233
|
+
self.current_stair.total_horizental_length,
|
234
|
+
start_x,
|
235
|
+
start_y + 500,
|
236
|
+
end_x,
|
237
|
+
start_y + 500,
|
238
|
+
300,
|
239
|
+
500,
|
240
|
+
)
|
241
|
+
elif self.current_stair.stair_type == "BT":
|
242
|
+
self.plotter.draw_line(start_x, start_y, start_x + 500, start_y)
|
243
|
+
self.plotter.draw_line(start_x + 500, start_y, end_x, end_y)
|
244
|
+
|
245
|
+
self.__draw_dimension(
|
246
|
+
self.current_stair.left_extend_length,
|
247
|
+
start_x,
|
248
|
+
start_y + 500,
|
249
|
+
start_x + 500,
|
250
|
+
start_y + 500,
|
251
|
+
300,
|
252
|
+
300,
|
253
|
+
)
|
254
|
+
self.__draw_dimension(
|
255
|
+
self.current_stair.stair_length_list[1],
|
256
|
+
start_x + 500,
|
257
|
+
start_y + 500,
|
258
|
+
end_x,
|
259
|
+
start_y + 500,
|
260
|
+
300,
|
261
|
+
500,
|
262
|
+
)
|
263
|
+
|
264
|
+
elif self.current_stair.stair_type == "CT":
|
265
|
+
self.plotter.draw_line(start_x, start_y, end_x - 500, end_y)
|
266
|
+
self.plotter.draw_line(end_x - 500, end_y, end_x, end_y)
|
267
|
+
self.__draw_dimension(
|
268
|
+
self.current_stair.stair_length_list[1],
|
269
|
+
start_x,
|
270
|
+
start_y + 500,
|
271
|
+
end_x - 500,
|
272
|
+
start_y + 500,
|
273
|
+
300,
|
274
|
+
450,
|
275
|
+
)
|
276
|
+
self.__draw_dimension(
|
277
|
+
self.current_stair.right_extend_length,
|
278
|
+
end_x - 500,
|
279
|
+
start_y + 500,
|
280
|
+
end_x,
|
281
|
+
start_y + 500,
|
282
|
+
450,
|
283
|
+
500,
|
284
|
+
)
|
285
|
+
|
286
|
+
elif self.current_stair.stair_type == "DT":
|
287
|
+
self.plotter.draw_line(start_x, start_y, start_x + 500, start_y)
|
288
|
+
self.plotter.draw_line(start_x + 500, start_y, end_x - 500, end_y)
|
289
|
+
self.plotter.draw_line(end_x - 500, end_y, end_x, end_y)
|
290
|
+
self.__draw_dimension(
|
291
|
+
self.current_stair.stair_length_list[0],
|
292
|
+
start_x,
|
293
|
+
start_y + 500,
|
294
|
+
start_x + 500,
|
295
|
+
start_y + 500,
|
296
|
+
300,
|
297
|
+
350,
|
298
|
+
)
|
299
|
+
self.__draw_dimension(
|
300
|
+
self.current_stair.stair_length_list[1],
|
301
|
+
start_x + 500,
|
302
|
+
start_y + 500,
|
303
|
+
end_x - 500,
|
304
|
+
start_y + 500,
|
305
|
+
350,
|
306
|
+
450,
|
307
|
+
)
|
308
|
+
self.__draw_dimension(
|
309
|
+
self.current_stair.stair_length_list[2],
|
310
|
+
end_x - 500,
|
311
|
+
start_y + 500,
|
312
|
+
end_x,
|
313
|
+
start_y + 500,
|
314
|
+
450,
|
315
|
+
500,
|
316
|
+
)
|
317
|
+
d = 50
|
318
|
+
temp_x1 = start_x - d / 2 + 10
|
319
|
+
temp_y1 = start_y
|
320
|
+
self.__draw_boundary(temp_x1, temp_y1, 50)
|
321
|
+
temp_x1 = end_x - d / 2 + 10
|
322
|
+
temp_y1 = end_y
|
323
|
+
self.__draw_boundary(temp_x1, temp_y1, 50)
|
324
|
+
self.__draw_dimension(
|
325
|
+
self.current_stair.total_height,
|
326
|
+
end_x + 400,
|
327
|
+
start_y,
|
328
|
+
end_x + 400,
|
329
|
+
end_y,
|
330
|
+
300,
|
331
|
+
300,
|
332
|
+
)
|
333
|
+
|
334
|
+
def __draw_dimension(self, distance, x1, y1, x2, y2, extend_len1, extend_len2):
|
335
|
+
|
336
|
+
degree = math.atan2((y1 - y2), (x2 - x1))
|
337
|
+
sin_deg = math.sin(degree)
|
338
|
+
cos_deg = math.cos(degree)
|
339
|
+
sin_deg_45 = math.sin(degree + math.pi / 4)
|
340
|
+
cos_deg_45 = math.cos(degree + math.pi / 4)
|
341
|
+
self.plotter.draw_line(
|
342
|
+
x1 - (extend_len1 - 50) * sin_deg,
|
343
|
+
y1 - (extend_len1 - 50) * cos_deg,
|
344
|
+
x1 + 50 * sin_deg,
|
345
|
+
y1 + 50 * cos_deg,
|
346
|
+
)
|
347
|
+
self.plotter.draw_line(
|
348
|
+
x2 - (extend_len2 - 50) * sin_deg,
|
349
|
+
y2 - (extend_len2 - 50) * cos_deg,
|
350
|
+
x2 + 50 * sin_deg,
|
351
|
+
y2 + 50 * cos_deg,
|
352
|
+
)
|
353
|
+
self.plotter.draw_line(
|
354
|
+
x1 - 50 * cos_deg,
|
355
|
+
y1 + 50 * sin_deg,
|
356
|
+
x2 + 50 * cos_deg,
|
357
|
+
y2 - 50 * sin_deg,
|
358
|
+
)
|
359
|
+
self.plotter.draw_line(
|
360
|
+
x1 - 40 * sin_deg_45,
|
361
|
+
y1 - 40 * cos_deg_45,
|
362
|
+
x1 + 40 * sin_deg_45,
|
363
|
+
y1 + 40 * cos_deg_45,
|
364
|
+
width=self.bold_pen_width,
|
365
|
+
)
|
366
|
+
self.plotter.draw_line(
|
367
|
+
x2 - 40 * sin_deg_45,
|
368
|
+
y2 - 40 * cos_deg_45,
|
369
|
+
x2 + 40 * sin_deg_45,
|
370
|
+
y2 + 40 * cos_deg_45,
|
371
|
+
width=self.bold_pen_width,
|
372
|
+
)
|
373
|
+
self.plotter.draw_text(
|
374
|
+
int((x1 + x2) / 2),
|
375
|
+
int((y1 + y2) / 2),
|
376
|
+
f"{distance:.0f}",
|
377
|
+
100,
|
378
|
+
degree,
|
379
|
+
y_offset=-150,
|
380
|
+
)
|
381
|
+
|
382
|
+
def __draw_boundary(self, x, y, dimeter):
|
383
|
+
self.plotter.draw_circle(x, y, dimeter)
|
384
|
+
self.plotter.draw_circle(x - 80, y + 138, dimeter)
|
385
|
+
self.plotter.draw_circle(x + 80, y + 138, dimeter)
|
386
|
+
self.plotter.draw_line(x + 37.5, y + 46.65, x + 92.5, y + 141.91)
|
387
|
+
self.plotter.draw_line(x + 12.5, y + 46.65, x - 42.5, y + 141.91)
|
388
|
+
self.plotter.draw_line(x - 154.56, y + 188.56, x + 205.44, y + 188.56)
|
389
|
+
temp_y = y + 231.86
|
390
|
+
for i in range(11):
|
391
|
+
temp_x = x - 149.56 + 30 * i
|
392
|
+
self.plotter.draw_line(temp_x, temp_y, temp_x + 25, temp_y - 43.3)
|
393
|
+
|
394
|
+
def __draw_moment_curve(
|
395
|
+
self,
|
396
|
+
x1,
|
397
|
+
y1,
|
398
|
+
x2,
|
399
|
+
y2,
|
400
|
+
line_length_list: List[float],
|
401
|
+
moment_list: List[float],
|
402
|
+
draw_middle: bool,
|
403
|
+
):
|
404
|
+
degree = math.atan2((y1 - y2), (x2 - x1))
|
405
|
+
sin_deg = math.sin(degree)
|
406
|
+
cos_deg = math.cos(degree)
|
407
|
+
temp_x1 = x1 + line_length_list[0] * sin_deg
|
408
|
+
temp_y1 = y1 + line_length_list[0] * cos_deg
|
409
|
+
temp_x2 = (x1 + x2) / 2 + line_length_list[1] * sin_deg
|
410
|
+
temp_y2 = (y1 + y2) / 2 + line_length_list[1] * cos_deg
|
411
|
+
temp_x3 = x2 + line_length_list[2] * sin_deg
|
412
|
+
temp_y3 = y2 + line_length_list[2] * cos_deg
|
413
|
+
|
414
|
+
self.plotter.draw_line(x1, y1, temp_x1, temp_y1)
|
415
|
+
self.plotter.draw_line(x2, y2, temp_x3, temp_y3)
|
416
|
+
c_x1, c_y1, c_r = self.__calculate_circle_center_by_three_points(
|
417
|
+
temp_x1, temp_y1, temp_x2, temp_y2, temp_x3, temp_y3
|
418
|
+
)
|
419
|
+
degree = math.atan2((temp_y3 - c_y1), (temp_x3 - c_x1))
|
420
|
+
start_degree = 180 / math.pi * degree
|
421
|
+
degree = math.atan2((temp_y1 - c_y1), (temp_x1 - c_x1))
|
422
|
+
end_degree = 180 / math.pi * degree
|
423
|
+
if start_degree > 0 and end_degree < 0:
|
424
|
+
end_degree = end_degree + 180
|
425
|
+
if start_degree > 0 and end_degree < start_degree:
|
426
|
+
start_degree = start_degree - 180
|
427
|
+
end_degree = end_degree - 180
|
428
|
+
if start_degree < 0 and end_degree > start_degree:
|
429
|
+
start_degree = start_degree + 180
|
430
|
+
end_degree = end_degree + 180
|
431
|
+
self.plotter.draw_arc(
|
432
|
+
c_x1 - c_r,
|
433
|
+
c_y1 - c_r,
|
434
|
+
c_r * 2,
|
435
|
+
c_r * 2,
|
436
|
+
start_degree,
|
437
|
+
end_degree,
|
438
|
+
)
|
439
|
+
degree = math.atan2((y1 - y2), (x2 - x1))
|
440
|
+
if draw_middle:
|
441
|
+
str_x = int(temp_x2)
|
442
|
+
str_y = int(temp_y2)
|
443
|
+
self.plotter.draw_text(
|
444
|
+
str_x,
|
445
|
+
str_y,
|
446
|
+
f"{moment_list[1]:.1f}",
|
447
|
+
100,
|
448
|
+
degree,
|
449
|
+
0,
|
450
|
+
180 if moment_list[1] > 0 else -180,
|
451
|
+
)
|
452
|
+
|
453
|
+
str_x = int(temp_x1)
|
454
|
+
str_y = int(temp_y1)
|
455
|
+
self.plotter.draw_text(
|
456
|
+
str_x,
|
457
|
+
str_y,
|
458
|
+
f"{moment_list[0]:.1f}",
|
459
|
+
100,
|
460
|
+
degree,
|
461
|
+
800 if (self.current_stair.left_extend_length > 0 and draw_middle) else 0,
|
462
|
+
180 if moment_list[0] > 0 else -180,
|
463
|
+
)
|
464
|
+
|
465
|
+
str_x = int(temp_x3)
|
466
|
+
str_y = int(temp_y3)
|
467
|
+
self.plotter.draw_text(
|
468
|
+
str_x,
|
469
|
+
str_y,
|
470
|
+
f"{moment_list[2]:.1f}",
|
471
|
+
100,
|
472
|
+
degree,
|
473
|
+
-800 if (self.current_stair.right_extend_length > 0 and draw_middle) else 0,
|
474
|
+
180 if moment_list[2] > 0 else -180,
|
475
|
+
)
|
476
|
+
|
477
|
+
def __draw_shear_curve(
|
478
|
+
self,
|
479
|
+
x1,
|
480
|
+
y1,
|
481
|
+
x2,
|
482
|
+
y2,
|
483
|
+
line_length_list: List[float],
|
484
|
+
shear_list: List[float],
|
485
|
+
is_middle: bool = False,
|
486
|
+
):
|
487
|
+
|
488
|
+
degree = math.atan2((y1 - y2), (x2 - x1))
|
489
|
+
sin_deg = math.sin(degree)
|
490
|
+
cos_deg = math.cos(degree)
|
491
|
+
temp_x1 = x1 + line_length_list[0] * sin_deg
|
492
|
+
temp_y1 = y1 + line_length_list[0] * cos_deg
|
493
|
+
temp_x2 = x2 + line_length_list[1] * sin_deg
|
494
|
+
temp_y2 = y2 + line_length_list[1] * cos_deg
|
495
|
+
self.plotter.draw_line(x1, y1, temp_x1, temp_y1)
|
496
|
+
self.plotter.draw_line(x2, y2, temp_x2, temp_y2)
|
497
|
+
self.plotter.draw_line(temp_x1, temp_y1, temp_x2, temp_y2)
|
498
|
+
str_x = int(temp_x1)
|
499
|
+
str_y = int(temp_y1)
|
500
|
+
self.plotter.draw_text(
|
501
|
+
str_x,
|
502
|
+
str_y,
|
503
|
+
f"{shear_list[0]:.1f}",
|
504
|
+
100,
|
505
|
+
degree,
|
506
|
+
800 if (self.current_stair.left_extend_length > 0 and is_middle) else 0,
|
507
|
+
180 if shear_list[0] > 0 else -180,
|
508
|
+
)
|
509
|
+
|
510
|
+
str_x = int(temp_x2)
|
511
|
+
str_y = int(temp_y2)
|
512
|
+
self.plotter.draw_text(
|
513
|
+
str_x,
|
514
|
+
str_y,
|
515
|
+
f"{shear_list[1]:.1f}",
|
516
|
+
100,
|
517
|
+
degree,
|
518
|
+
-800 if (self.current_stair.right_extend_length > 0 and is_middle) else 0,
|
519
|
+
180 if shear_list[1] > 0 else -180,
|
520
|
+
)
|
521
|
+
|
522
|
+
def __draw_disp_curve(self, x1, y1, x2, y2, disp):
|
523
|
+
disp_offset = 400
|
524
|
+
degree = math.atan2((y1 - y2), (x2 - x1))
|
525
|
+
sin_deg = math.sin(degree)
|
526
|
+
cos_deg = math.cos(degree)
|
527
|
+
temp_x1 = x1
|
528
|
+
temp_y1 = y1
|
529
|
+
temp_x2 = (x1 + x2) / 2 + disp_offset * sin_deg
|
530
|
+
temp_y2 = (y1 + y2) / 2 + disp_offset * cos_deg
|
531
|
+
temp_x3 = x2
|
532
|
+
temp_y3 = y2
|
533
|
+
c_x1, c_y1, c_r = self.__calculate_circle_center_by_three_points(
|
534
|
+
temp_x1, temp_y1, temp_x2, temp_y2, temp_x3, temp_y3
|
535
|
+
)
|
536
|
+
degree = math.atan2((temp_y3 - c_y1), (temp_x3 - c_x1))
|
537
|
+
start_degree = 180 / math.pi * degree
|
538
|
+
degree = math.atan2((temp_y1 - c_y1), (temp_x1 - c_x1))
|
539
|
+
end_degree = 180 / math.pi * degree
|
540
|
+
if start_degree > 0 and end_degree < 0:
|
541
|
+
end_degree = end_degree + 180
|
542
|
+
if start_degree > 0 and end_degree < start_degree:
|
543
|
+
start_degree = start_degree - 180
|
544
|
+
end_degree = end_degree - 180
|
545
|
+
if start_degree < 0 and end_degree > start_degree:
|
546
|
+
start_degree = start_degree + 180
|
547
|
+
end_degree = end_degree + 180
|
548
|
+
self.plotter.draw_arc(
|
549
|
+
c_x1 - c_r,
|
550
|
+
c_y1 - c_r,
|
551
|
+
c_r * 2,
|
552
|
+
c_r * 2,
|
553
|
+
start_degree,
|
554
|
+
end_degree,
|
555
|
+
)
|
556
|
+
degree = math.atan2((y1 - y2), (x2 - x1))
|
557
|
+
str_x = int(temp_x2)
|
558
|
+
str_y = int(temp_y2)
|
559
|
+
self.plotter.draw_text(str_x, str_y, f"{abs(disp):.2f}", 100, degree, 0, 180)
|
560
|
+
|
561
|
+
def __draw_rebar_area(self, x1, y1, x2, y2, rebar_areas, x_offset_base=180):
|
562
|
+
degree = math.atan2((y1 - y2), (x2 - x1))
|
563
|
+
x_list = [x1, (x1 + x2) / 2, x2]
|
564
|
+
y_list = [y1, (y1 + y2) / 2, y2]
|
565
|
+
for i in range(len(rebar_areas)):
|
566
|
+
temp_data = rebar_areas[i]
|
567
|
+
if not isinstance(temp_data, str) and temp_data <= 0:
|
568
|
+
continue
|
569
|
+
if isinstance(temp_data, str) and temp_data == "":
|
570
|
+
continue
|
571
|
+
x = x_list[i // 2]
|
572
|
+
y = y_list[i // 2]
|
573
|
+
x_offset = (1 - i // 2) * x_offset_base
|
574
|
+
y_offset = -180 if i % 2 == 0 else 180
|
575
|
+
text = f"{temp_data:.0f}" if not isinstance(temp_data, str) else temp_data
|
576
|
+
self.plotter.draw_text(
|
577
|
+
int(x), int(y), str(text), 100, degree, x_offset, y_offset
|
578
|
+
)
|
579
|
+
|
580
|
+
def __draw_label_and_title(self, label: str, title: str):
|
581
|
+
start_x = self.start_x
|
582
|
+
end_y = self.end_y
|
583
|
+
if label != None:
|
584
|
+
self.plotter.draw_line(start_x, end_y + 500, start_x + 500, end_y + 500)
|
585
|
+
self.plotter.draw_text(start_x + 800, end_y + 500, label, 100, 0)
|
586
|
+
self.plotter.draw_text(2700, 3050, title, 130, 0)
|
587
|
+
self.plotter.draw_line(2100, 3150, 3300, 3150)
|
588
|
+
self.plotter.draw_line(2100, 3190, 3300, 3190, width=15)
|
589
|
+
|
590
|
+
def __calculate_circle_center_by_three_points(self, x1, y1, x2, y2, x3, y3):
|
591
|
+
c_x1 = (
|
592
|
+
(y1 - y3) * (x1 * x1 - x2 * x2 + y1 * y1 - y2 * y2)
|
593
|
+
- (y1 - y2) * (x1 * x1 - x3 * x3 + y1 * y1 - y3 * y3)
|
594
|
+
) / (2 * ((x1 - x2) * (y1 - y3) - (x1 - x3) * (y1 - y2)))
|
595
|
+
c_y1 = (
|
596
|
+
(x1 - x2) * (x1 * x1 - x3 * x3 + y1 * y1 - y3 * y3)
|
597
|
+
- (x1 - x3) * (x1 * x1 - x2 * x2 + y1 * y1 - y2 * y2)
|
598
|
+
) / (2 * ((x1 - x2) * (y1 - y3) - (x1 - x3) * (y1 - y2)))
|
599
|
+
c_r = ((x1 - c_x1) ** 2 + (y1 - c_y1) ** 2) ** 0.5
|
600
|
+
return (c_x1, c_y1, c_r)
|
@@ -0,0 +1 @@
|
|
1
|
+
from .StairCalculationSheetPNGPlotter import StairCalculationSheetPNGPlotter
|
@@ -3,6 +3,9 @@ class DocPicture:
|
|
3
3
|
def init_attr(self, fig_num: int):
|
4
4
|
self.width = 2.36 * fig_num
|
5
5
|
|
6
|
-
def __init__(self, path_or_stream, fig_num: int = 1) -> None:
|
6
|
+
def __init__(self, path_or_stream, fig_num: int = 1, width: float = None) -> None:
|
7
7
|
self.path_or_stream = path_or_stream
|
8
|
-
|
8
|
+
if width == None:
|
9
|
+
self.init_attr(fig_num)
|
10
|
+
else:
|
11
|
+
self.width = width / 6 * 2.36
|