Calling pyansys in C++ #3096
Unanswered
COOLEST-GET
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
If you could provide assistance, I would greatly appreciate it.
In PyANSYS, the function I implement is to create a model, encapsulate it as a function, and then perform stress analysis, which is also encapsulated as a function.
I want to call the model building function first in C++, and then operate by calling the stress analysis function multiple times.
The problem I am facing now is that the process of stress analysis after building the model is only successful on the first call, and subsequent calls to the stress analysis function do not run.
Here is my code:
mapdl = launch_mapdl()
def build():
# mapdl = launch_mapdl()
mapdl.clear()
mapdl.prep7()
pv.global_theme.camera['position'] = [0, 1, 0]
b1 = mapdl.block(daoru2()) # 创建中间长方体1
b1x1, b1x2, b1y1, b1y2, b1z1, b1z2 = 70, 130, -30, 30, -30, -20
b2x1, b2x2, b2y1, b2y2, b2z1, b2z2 = -130, -70, -30, 30, 20, 30
mapdl.block(b1x1, b1x2, b1y1, b1y2, b1z1, b1z2) # 创建一边的长方体2
mapdl.block(b2x1, b2x2, b2y1, b2y2, b2z1, b2z2) # 另一边的长方体3
def calculate():
# 施加载荷
mapdl.f("ALL", "FZ", "198") # 施加荷载
mapdl.allsel("ALL") # 全选
Beta Was this translation helpful? Give feedback.
All reactions