qtmodel 1.1.9__tar.gz → 1.1.10__tar.gz

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.

Potentially problematic release.


This version of qtmodel might be problematic. Click here for more details.

Files changed (42) hide show
  1. {qtmodel-1.1.9 → qtmodel-1.1.10}/PKG-INFO +3 -3
  2. {qtmodel-1.1.9 → qtmodel-1.1.10}/README.md +2 -2
  3. qtmodel-1.1.10/qtmodel/core/__init__.py +1 -0
  4. qtmodel-1.1.10/qtmodel/core/qt_server.py +47 -0
  5. {qtmodel-1.1.9 → qtmodel-1.1.10}/qtmodel/mdb/mdb_analysis_setting.py +62 -99
  6. {qtmodel-1.1.9 → qtmodel-1.1.10}/qtmodel/mdb/mdb_assistant.py +2 -2
  7. {qtmodel-1.1.9 → qtmodel-1.1.10}/qtmodel/mdb/mdb_boundary.py +97 -118
  8. {qtmodel-1.1.9 → qtmodel-1.1.10}/qtmodel/mdb/mdb_construction_stage.py +40 -45
  9. {qtmodel-1.1.9 → qtmodel-1.1.10}/qtmodel/mdb/mdb_dynamic_load.py +95 -124
  10. {qtmodel-1.1.9 → qtmodel-1.1.10}/qtmodel/mdb/mdb_live_load.py +21 -22
  11. {qtmodel-1.1.9 → qtmodel-1.1.10}/qtmodel/mdb/mdb_load.py +25 -42
  12. {qtmodel-1.1.9 → qtmodel-1.1.10}/qtmodel/mdb/mdb_project.py +44 -85
  13. {qtmodel-1.1.9 → qtmodel-1.1.10}/qtmodel/mdb/mdb_property.py +95 -109
  14. {qtmodel-1.1.9 → qtmodel-1.1.10}/qtmodel/mdb/mdb_section.py +75 -84
  15. {qtmodel-1.1.9 → qtmodel-1.1.10}/qtmodel/mdb/mdb_sink_load.py +33 -48
  16. {qtmodel-1.1.9 → qtmodel-1.1.10}/qtmodel/mdb/mdb_static_load.py +108 -141
  17. {qtmodel-1.1.9 → qtmodel-1.1.10}/qtmodel/mdb/mdb_structure.py +117 -145
  18. {qtmodel-1.1.9 → qtmodel-1.1.10}/qtmodel/mdb/mdb_temperature_load.py +95 -122
  19. {qtmodel-1.1.9 → qtmodel-1.1.10}/qtmodel/mdb/mdb_tendon.py +46 -56
  20. {qtmodel-1.1.9 → qtmodel-1.1.10}/qtmodel/odb/odb_model_boundary.py +10 -10
  21. {qtmodel-1.1.9 → qtmodel-1.1.10}/qtmodel/odb/odb_model_load.py +12 -12
  22. {qtmodel-1.1.9 → qtmodel-1.1.10}/qtmodel/odb/odb_model_material.py +10 -10
  23. {qtmodel-1.1.9 → qtmodel-1.1.10}/qtmodel/odb/odb_model_section.py +7 -7
  24. {qtmodel-1.1.9 → qtmodel-1.1.10}/qtmodel/odb/odb_model_stage.py +5 -5
  25. {qtmodel-1.1.9 → qtmodel-1.1.10}/qtmodel/odb/odb_model_structure.py +14 -14
  26. {qtmodel-1.1.9 → qtmodel-1.1.10}/qtmodel/odb/odb_result_data.py +16 -16
  27. {qtmodel-1.1.9 → qtmodel-1.1.10}/qtmodel/odb/odb_result_plot.py +12 -12
  28. {qtmodel-1.1.9 → qtmodel-1.1.10}/qtmodel/odb/odb_view.py +12 -12
  29. {qtmodel-1.1.9 → qtmodel-1.1.10}/qtmodel.egg-info/PKG-INFO +3 -3
  30. {qtmodel-1.1.9 → qtmodel-1.1.10}/setup.py +2 -2
  31. qtmodel-1.1.9/qtmodel/core/__init__.py +0 -3
  32. qtmodel-1.1.9/qtmodel/core/qt_server.py +0 -85
  33. {qtmodel-1.1.9 → qtmodel-1.1.10}/qtmodel/__init__.py +0 -0
  34. {qtmodel-1.1.9 → qtmodel-1.1.10}/qtmodel/core/data_helper.py +0 -0
  35. {qtmodel-1.1.9 → qtmodel-1.1.10}/qtmodel/core/model_db.py +0 -0
  36. {qtmodel-1.1.9 → qtmodel-1.1.10}/qtmodel/core/result_db.py +0 -0
  37. {qtmodel-1.1.9 → qtmodel-1.1.10}/qtmodel/mdb/__init__.py +0 -0
  38. {qtmodel-1.1.9 → qtmodel-1.1.10}/qtmodel/odb/__init__.py +0 -0
  39. {qtmodel-1.1.9 → qtmodel-1.1.10}/qtmodel.egg-info/SOURCES.txt +0 -0
  40. {qtmodel-1.1.9 → qtmodel-1.1.10}/qtmodel.egg-info/dependency_links.txt +0 -0
  41. {qtmodel-1.1.9 → qtmodel-1.1.10}/qtmodel.egg-info/top_level.txt +0 -0
  42. {qtmodel-1.1.9 → qtmodel-1.1.10}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: qtmodel
3
- Version: 1.1.9
3
+ Version: 1.1.10
4
4
  Summary: python modeling for qt 2025-09-30
5
5
  Home-page: https://github.com/Inface0443/pyqt
6
6
  Author: dqy-zhj
@@ -2302,8 +2302,8 @@ from qtmodel import *
2302
2302
  mdb.add_spectrum_case(name="反应谱工况",info_x=("函数1",1.0))
2303
2303
  #Returns: 无
2304
2304
  ```
2305
- # print(s)
2306
- QtServer.post_command(s, "QDAT")
2305
+ ### update_spectrum_function
2306
+ todo 更新反应谱函数
2307
2307
  > 参数:
2308
2308
  > name: 函数名称
2309
2309
  > new_name: 新函数名称
@@ -2283,8 +2283,8 @@ from qtmodel import *
2283
2283
  mdb.add_spectrum_case(name="反应谱工况",info_x=("函数1",1.0))
2284
2284
  #Returns: 无
2285
2285
  ```
2286
- # print(s)
2287
- QtServer.post_command(s, "QDAT")
2286
+ ### update_spectrum_function
2287
+ todo 更新反应谱函数
2288
2288
  > 参数:
2289
2289
  > name: 函数名称
2290
2290
  > new_name: 新函数名称
@@ -0,0 +1 @@
1
+ __all__ = []
@@ -0,0 +1,47 @@
1
+ import json
2
+ from typing import Optional
3
+ import requests
4
+
5
+
6
+ class QtServer:
7
+ URL: str = "http://localhost:55125/pythonForQt/"
8
+ MERGE_STR: str = ""
9
+ QT_MERGE: bool = False # 是否合并发送
10
+ QT_VERSION: str = "1.2.3"
11
+
12
+ @staticmethod
13
+ def send_command(command: str = "", header: str = ""):
14
+ """
15
+ 用于单次数据传输,数据传输完成但不刷新UI
16
+ :param command:建议输入json对象(单行)
17
+ :param header: 数据块标识符
18
+ :return:
19
+ """
20
+ response = requests.post(QtServer.URL,
21
+ headers={'Content-Type': f'{header}'},
22
+ data=command.encode('utf-8'))
23
+ if response.status_code == 200:
24
+ return response.text
25
+ elif response.status_code == 400:
26
+ raise Exception(response.text)
27
+ elif response.status_code == 413:
28
+ raise Exception("请求体过大,请拆分请求或调整服务端或反向代理(Nginx/网关/负载均衡)请求限制")
29
+ elif response.status_code == 504:
30
+ raise Exception("服务端或反向代理(Nginx/网关/负载均衡)超时,请增加最大等待时间")
31
+ else:
32
+ raise Exception("连接错误,请重新尝试")
33
+
34
+ @staticmethod
35
+ def send_dict(header: str, payload: Optional[dict] = None):
36
+ """
37
+ 统一发送:有参数 -> JSON;无参数 -> 不带 command 的 post
38
+ """
39
+ try:
40
+ if not payload: # None 或 空字典
41
+ return QtServer.send_command(header=header, command="")
42
+ if "version" not in payload:
43
+ payload["version"] = QtServer.QT_VERSION
44
+ json_string = json.dumps(payload, ensure_ascii=False)
45
+ return QtServer.send_command(header=header, command=json_string)
46
+ except Exception as ex:
47
+ raise Exception(ex)
@@ -1,5 +1,5 @@
1
1
  from typing import Union, List, Optional
2
- from ..core.qt_server import QtServer
2
+ from qtmodel.core.qt_server import QtServer
3
3
  from qtmodel.core.data_helper import QtDataHelper
4
4
 
5
5
 
@@ -43,7 +43,7 @@ class MdbAnalysisSetting:
43
43
  if val: # 字符串不为空
44
44
  s += f"{key}={val}\r\n"
45
45
  # print(s)
46
- QtServer.post_command(s, "QDAT")
46
+ QtServer.send_command(s, "QDAT")
47
47
  except Exception as ex:
48
48
  raise Exception(ex)
49
49
 
@@ -59,12 +59,8 @@ class MdbAnalysisSetting:
59
59
  mdb.update_global_setting(solver_type=0,calculation_type=2,thread_count=12)
60
60
  Returns: 无
61
61
  """
62
- try:
63
- s = "*GLB-SET\r\n" + f"{solver_type},{calculation_type},{thread_count}\r\n"
64
- # print(s)
65
- QtServer.post_command(s, "QDAT")
66
- except Exception as ex:
67
- raise Exception(ex)
62
+ s = "*GLB-SET\r\n" + f"{solver_type},{calculation_type},{thread_count}\r\n"
63
+ QtServer.send_command(s, "QDAT")
68
64
 
69
65
  @staticmethod
70
66
  def update_construction_stage_setting(do_analysis: bool = True, to_end_stage: bool = True,
@@ -91,18 +87,14 @@ class MdbAnalysisSetting:
91
87
  do_creep_analysis=True, cable_tension_position=0, consider_completion_stage=True,shrink_creep_type=2)
92
88
  Returns: 无
93
89
  """
94
- try:
95
- do_str = "YES" if do_analysis else "NO"
96
- toend_str = "YES" if to_end_stage else "NO"
97
- creep_str = "YES" if do_creep_analysis else "NO"
98
- comp_str = "YES" if consider_completion_stage else "NO"
99
- s = "*CS-SET\r\n" + f"{do_str},{toend_str},{other_stage_name},{analysis_type},{creep_str},{cable_tension_position},{comp_str}\r\n"
100
- s += f"{shrink_creep_type},{creep_load_type},"
101
- s += f"{'YES' if sub_step_info[0] else 'NO'},{','.join(f'{x:g}' for x in sub_step_info[1:])}\r\n" if sub_step_info else "\r\n"
102
- # print(s)
103
- QtServer.post_command(s, "QDAT")
104
- except Exception as ex:
105
- raise Exception(ex)
90
+ do_str = "YES" if do_analysis else "NO"
91
+ toend_str = "YES" if to_end_stage else "NO"
92
+ creep_str = "YES" if do_creep_analysis else "NO"
93
+ comp_str = "YES" if consider_completion_stage else "NO"
94
+ s = "*CS-SET\r\n" + f"{do_str},{toend_str},{other_stage_name},{analysis_type},{creep_str},{cable_tension_position},{comp_str}\r\n"
95
+ s += f"{shrink_creep_type},{creep_load_type},"
96
+ s += f"{'YES' if sub_step_info[0] else 'NO'},{','.join(f'{x:g}' for x in sub_step_info[1:])}\r\n" if sub_step_info else "\r\n"
97
+ QtServer.send_command(s, "QDAT")
106
98
 
107
99
  @staticmethod
108
100
  def update_live_load_setting(lateral_spacing: float = 0.1, vertical_spacing: float = 1, damper_calc_type: int = -1,
@@ -149,30 +141,25 @@ class MdbAnalysisSetting:
149
141
  displacement_groups=["结构组1","结构组2"])
150
142
  Returns: 无
151
143
  """
144
+ s = "*LIV-SET\r\n" + f"{lateral_spacing:g},{vertical_spacing:g},{eccentricity:g},{'YES' if displacement_track else 'NO'},{'YES' if force_track else 'NO'},{'YES' if reaction_track else 'NO'},{'YES' if link_track else 'NO'},{'YES' if constrain_track else 'NO'}\r\n"
145
+ if damper_calc_type != -1:
146
+ s += f"1,{damper_calc_type},{','.join(damper_groups)}\r\n"
152
147
 
153
- try:
154
- s = "*LIV-SET\r\n" + f"{lateral_spacing:g},{vertical_spacing:g},{eccentricity:g},{'YES' if displacement_track else 'NO'},{'YES' if force_track else 'NO'},{'YES' if reaction_track else 'NO'},{'YES' if link_track else 'NO'},{'YES' if constrain_track else 'NO'}\r\n"
155
- if damper_calc_type != -1:
156
- s += f"1,{damper_calc_type},{','.join(damper_groups)}\r\n"
148
+ lines = []
149
+ configs = [
150
+ (displacement_track, 2, displacement_calc_type, displacement_groups),
151
+ (force_track, 3, force_calc_type, force_groups),
152
+ (reaction_track, 4, reaction_calc_type, reaction_groups),
153
+ (link_track, 5, link_calc_type, link_groups),
154
+ (constrain_track, 6, constrain_calc_type, constrain_groups),
155
+ ]
157
156
 
158
- lines = []
159
- configs = [
160
- (displacement_track, 2, displacement_calc_type, displacement_groups),
161
- (force_track, 3, force_calc_type, force_groups),
162
- (reaction_track, 4, reaction_calc_type, reaction_groups),
163
- (link_track, 5, link_calc_type, link_groups),
164
- (constrain_track, 6, constrain_calc_type, constrain_groups),
165
- ]
157
+ for enabled, code, calc_type, groups in configs:
158
+ if enabled:
159
+ lines.append(QtDataHelper.live_load_set_line(code, calc_type, groups))
166
160
 
167
- for enabled, code, calc_type, groups in configs:
168
- if enabled:
169
- lines.append(QtDataHelper.live_load_set_line(code, calc_type, groups))
170
-
171
- s = "".join(lines)
172
- # print(s)
173
- QtServer.post_command(s, "QDAT")
174
- except Exception as ex:
175
- raise Exception(ex)
161
+ s = "".join(lines)
162
+ QtServer.send_command(s, "QDAT")
176
163
 
177
164
  @staticmethod
178
165
  def update_non_linear_setting(non_linear_type: int = 1, non_linear_method: int = 1, max_loading_steps: int = 1,
@@ -192,12 +179,8 @@ class MdbAnalysisSetting:
192
179
  accuracy_of_displacement=0.0001, accuracy_of_force=0.0001)
193
180
  Returns: 无
194
181
  """
195
- try:
196
- s = "*NON-SET\r\n" + f"{non_linear_type},{non_linear_method},{max_loading_steps},{max_iteration_times},{accuracy_of_displacement:g},{accuracy_of_force:g}\r\n"
197
- # print(s)
198
- QtServer.post_command(s, "QDAT")
199
- except Exception as ex:
200
- raise Exception(ex)
182
+ s = "*NON-SET\r\n" + f"{non_linear_type},{non_linear_method},{max_loading_steps},{max_iteration_times},{accuracy_of_displacement:g},{accuracy_of_force:g}\r\n"
183
+ QtServer.send_command(s, "QDAT")
201
184
 
202
185
  @staticmethod
203
186
  def update_operation_stage_setting(do_analysis: bool = True, final_stage: str = "",
@@ -216,18 +199,14 @@ class MdbAnalysisSetting:
216
199
  mdb.update_operation_stage_setting(do_analysis=True, final_stage="上二恒",static_load_cases=None)
217
200
  Returns: 无
218
201
  """
219
- try:
220
- s = "*OP-SET\r\n" + f"{'YES' if do_analysis else 'NO'},{final_stage}\r\n"
221
- if static_load_cases is not None:
222
- s += f"ST={','.join(static_load_cases)}\r\n"
223
- if sink_load_cases is not None:
224
- s += f"SM={','.join(sink_load_cases)}\r\n"
225
- if live_load_cases is not None:
226
- s += f"MV={','.join(live_load_cases)}\r\n"
227
- # print(s)
228
- QtServer.post_command(s, "QDAT")
229
- except Exception as ex:
230
- raise Exception(ex)
202
+ s = "*OP-SET\r\n" + f"{'YES' if do_analysis else 'NO'},{final_stage}\r\n"
203
+ if static_load_cases is not None:
204
+ s += f"ST={','.join(static_load_cases)}\r\n"
205
+ if sink_load_cases is not None:
206
+ s += f"SM={','.join(sink_load_cases)}\r\n"
207
+ if live_load_cases is not None:
208
+ s += f"MV={','.join(live_load_cases)}\r\n"
209
+ QtServer.send_command(s, "QDAT")
231
210
 
232
211
  @staticmethod
233
212
  def update_self_vibration_setting(do_analysis: bool = True, method: int = 1, matrix_type: int = 0,
@@ -243,12 +222,8 @@ class MdbAnalysisSetting:
243
222
  mdb.update_self_vibration_setting(do_analysis=True,method=1,matrix_type=0,mode_num=3)
244
223
  Returns: 无
245
224
  """
246
- try:
247
- s = "*VB-SET\r\n" + f"{'YES' if do_analysis else 'NO'},{method},{matrix_type},{mode_num}\r\n"
248
- # print(s)
249
- QtServer.post_command(s, "QDAT")
250
- except Exception as ex:
251
- raise Exception(ex)
225
+ s = "*VB-SET\r\n" + f"{'YES' if do_analysis else 'NO'},{method},{matrix_type},{mode_num}\r\n"
226
+ QtServer.send_command(s, "QDAT")
252
227
 
253
228
  @staticmethod
254
229
  def update_response_spectrum_setting(do_analysis: bool = True, kind: int = 1, by_mode: bool = False,
@@ -264,15 +239,11 @@ class MdbAnalysisSetting:
264
239
  mdb.update_response_spectrum_setting(do_analysis=True,kind=1,damping_ratio=0.05)
265
240
  Returns: 无
266
241
  """
267
- try:
268
- if do_analysis:
269
- if isinstance(damping_ratio, float):
270
- damping_ratio = [damping_ratio]
271
- s = "*RS-SET\r\n" + f"{kind},{'YES' if by_mode else 'NO'},{','.join(f'{x:g}' for x in damping_ratio)}\r\n"
272
- # print(s)
273
- QtServer.post_command(s, "QDAT")
274
- except Exception as ex:
275
- raise Exception(ex)
242
+ if do_analysis:
243
+ if isinstance(damping_ratio, float):
244
+ damping_ratio = [damping_ratio]
245
+ s = "*RS-SET\r\n" + f"{kind},{'YES' if by_mode else 'NO'},{','.join(f'{x:g}' for x in damping_ratio)}\r\n"
246
+ QtServer.send_command(s, "QDAT")
276
247
 
277
248
  @staticmethod
278
249
  def update_time_history_setting(do_analysis: bool = True, output_all: bool = True, groups: Optional[list[str]] = None):
@@ -286,18 +257,14 @@ class MdbAnalysisSetting:
286
257
  mdb.update_time_history_setting(do_analysis=True,output_all=True)
287
258
  Returns: 无
288
259
  """
289
- try:
290
- if do_analysis:
291
- s = "*TH-SET\r\n" + f"{'YES' if output_all else 'NO'}"
292
- if groups:
293
- s += "," + ','.join(groups) + "\r\n"
294
- else:
295
- s += "\r\n"
296
- QtServer.post_command(s, "QDAT")
297
- # print(s)
298
- QtServer.post_command(s, "QDAT")
299
- except Exception as ex:
300
- raise Exception(ex)
260
+ if do_analysis:
261
+ s = "*TH-SET\r\n" + f"{'YES' if output_all else 'NO'}"
262
+ if groups:
263
+ s += "," + ','.join(groups) + "\r\n"
264
+ else:
265
+ s += "\r\n"
266
+ QtServer.send_command(s, "QDAT")
267
+ QtServer.send_command(s, "QDAT")
301
268
 
302
269
  @staticmethod
303
270
  def update_bulking_setting(do_analysis: bool = True, mode_count: int = 3, stage_id: int = -1,
@@ -319,18 +286,14 @@ class MdbAnalysisSetting:
319
286
  mdb.update_bulking_setting(do_analysis=True,mode_count=3,variable_cases=["工况1","工况2"])
320
287
  Returns: 无
321
288
  """
322
- try:
323
- if do_analysis:
324
- s = "*BUK-SET\r\n" + f"{mode_count},{stage_id},{'YES' if stressed else 'NO'},{calculate_kind}\r\n"
325
- if variable_cases is None:
326
- raise Exception("操作错误,可变荷载工况名称集合为必要参数")
327
- else:
328
- s += f"VL={','.join(variable_cases)}\r\n"
329
- if constant_cases is not None:
330
- s += f"CL={','.join(constant_cases)}\r\n"
331
- # print(s)
332
- QtServer.post_command(s, "QDAT")
333
- except Exception as ex:
334
- raise Exception(ex)
289
+ if do_analysis:
290
+ s = "*BUK-SET\r\n" + f"{mode_count},{stage_id},{'YES' if stressed else 'NO'},{calculate_kind}\r\n"
291
+ if variable_cases is None:
292
+ raise Exception("操作错误,可变荷载工况名称集合为必要参数")
293
+ else:
294
+ s += f"VL={','.join(variable_cases)}\r\n"
295
+ if constant_cases is not None:
296
+ s += f"CL={','.join(constant_cases)}\r\n"
297
+ QtServer.send_command(s, "QDAT")
335
298
 
336
299
  # endregion
@@ -1,4 +1,4 @@
1
- from ..core.qt_server import QtServer
1
+ from qtmodel.core.qt_server import QtServer
2
2
 
3
3
 
4
4
  class MdbAssistant:
@@ -31,4 +31,4 @@ class MdbAssistant:
31
31
  "box_num": box_num,
32
32
  "material": material,
33
33
  }
34
- return QtServer.send_post("CREATE-CANTILEVER-BRIDGE", payload)
34
+ return QtServer.send_dict("CREATE-CANTILEVER-BRIDGE", payload)