ansys / pymapdl

Pythonic interface to MAPDL
https://mapdl.docs.pyansys.com
MIT License
423 stars 120 forks source link

Failed to read the wbpj file #1908

Closed 15076882301 closed 1 year ago

15076882301 commented 1 year ago

🔍 Before submitting the issue

🐞 Description of the bug

I want to read the parameters in the wbpj file, using the following

from ansys.mapdl.core import launch_mapdl import pyansys

mapdl = launch_mapdl() mapdl.input("C:\Test\1.wbpj")

print(mapdl.parameters)

mapdl.exit()

When the code was executed to mapdl.input("C:\Test\1.wbpj"), the program crashed. I found that line mapdl_grpc.py 1423 of the temporarily generated file was read incorrectly. When I opened the read file, I found that it was full of error information ErrorCode Code

📝 Steps to reproduce

from ansys.mapdl.core import launch_mapdl import pyansys

mapdl = launch_mapdl() mapdl.input("C:\Test\1.wbpj")

print(mapdl.parameters)

mapdl.exit() ErrorCode

ErrorOut

💻 Which operating system are you using?

Windows

📀 Which ANSYS version are you using?

Ansys 2021 R1

🐍 Which Python version are you using?

3.8

📦 Installed packages

ansys-api-fluent==0.3.7
ansys-api-mapdl==0.5.1
ansys-api-meshing-prime==0.1.1
ansys-api-platform-instancemanagement==1.0.0b3
ansys-corba==0.1.1
ansys-dpf-core==0.6.0
ansys-dpf-gate==0.2.1
ansys-dpf-gatebin==0.3.0
ansys-dpf-post==0.2.5
ansys-fluent-core==0.11.0
ansys-fluent-parametric==0.5.0
ansys-fluent-visualization==0.5.0
ansys-grantami-bomanalytics==1.0.1
ansys-grantami-bomanalytics-openapi==1.0.0
ansys-grpc-dpf==0.7.0
ansys-mapdl-core==0.63.2
ansys-mapdl-reader==0.52.0
ansys-meshing-prime==0.2.0
ansys-openapi-common==1.1.1
ansys-platform-instancemanagement==1.0.2
ansys-seascape==0.2.0
anyio==3.6.2
appdirs==1.4.4
argon2-cffi==21.3.0
argon2-cffi-bindings==21.2.0
asttokens==2.2.1
attrs==22.2.0
backcall==0.2.0
beautifulsoup4==4.11.2
bleach==6.0.0
cachetools==5.3.0
certifi==2022.12.7
cffi==1.15.1
charset-normalizer==3.0.1
clr-loader==0.2.5
colorama==0.4.6
comm==0.1.2
contourpy==1.0.7
cryptography==39.0.0
cycler==0.11.0
debugpy==1.6.6
decorator==5.1.1
defusedxml==0.7.1
executing==1.2.0
fastjsonschema==2.16.2
fonttools==4.38.0
geomdl==5.3.1
google-api-core==2.10.1
google-api-python-client==2.76.0
google-auth==2.16.0
google-auth-httplib2==0.1.0
googleapis-common-protos==1.56.4
grpcio==1.51.1
h5py==3.8.0
httplib2==0.21.0
idna==3.4
imageio==2.25.0
importlib-metadata==4.13.0
importlib-resources==5.10.2
ipycanvas==0.13.1
ipyevents==2.0.1
ipykernel==6.21.1
ipython==8.9.0
ipython-genutils==0.2.0
ipyvtklink==0.2.3
ipywidgets==7.7.2
jedi==0.18.2
Jinja2==3.1.2
jsonschema==4.17.3
jupyter-client==8.0.2
jupyter-core==5.2.0
jupyter-events==0.6.3
jupyter-server==2.2.1
jupyter-server-terminals==0.4.4
jupyterlab-pygments==0.2.2
jupyterlab-widgets==1.1.1
kiwisolver==1.4.4
MarkupSafe==2.1.2
matplotlib==3.6.3
matplotlib-inline==0.1.6
mistune==2.0.4
nbclassic==0.5.1
nbclient==0.7.2
nbconvert==7.2.9
nbformat==5.7.3
nest-asyncio==1.5.6
notebook==6.5.2
notebook-shim==0.2.2
ntlm-auth==1.5.0
numpy==1.24.1
packaging==23.0
pandas==1.5.3
pandocfilters==1.5.0
parso==0.8.3
pickleshare==0.7.5
Pillow==9.4.0
pkgutil-resolve-name==1.3.10
platformdirs==2.6.2
plumbum==1.8.1
pooch==1.6.0
prometheus-client==0.16.0
prompt-toolkit==3.0.36
protobuf==3.20.1
protoc-gen-swagger==0.1.0
psutil==5.9.4
pure-eval==0.2.2
pyaedt==0.6.3
pyansys==2023.1.3
pyasn1==0.4.8
pyasn1-modules==0.2.8
pycparser==2.21
Pygments==2.14.0
pyiges==0.2.1
pyparsing==3.0.9
pypiwin32==223
pyrsistent==0.19.3
PySide6==6.4.2
PySide6-Addons==6.4.2
PySide6-Essentials==6.4.2
python-dateutil==2.8.2
python-json-logger==2.0.4
pythonnet==3.0.0rc6
pytwin==0.2.0
pytz==2022.7.1
pyvista==0.38.1
pyvistaqt==0.9.0
pywin32==305
pywinpty==2.0.10
PyYAML==6.0
pyzmq==25.0.0
QtPy==2.3.0
requests==2.28.2
requests-negotiate-sspi==0.5.2
requests-ntlm==1.1.0
rfc3339-validator==0.1.4
rfc3986-validator==0.1.1
rpyc==5.0.1
rsa==4.9
scipy==1.10.0
scooby==0.7.1
Send2Trash==1.8.0
shiboken6==6.4.2
six==1.16.0
sniffio==1.3.0
soupsieve==2.3.2.post1
stack-data==0.6.2
terminado==0.17.1
tinycss2==1.2.1
tornado==6.2
tqdm==4.64.1
traitlets==5.9.0
uritemplate==4.1.1
urllib3==1.26.14
vtk==9.2.5
wcwidth==0.2.6
webencodings==0.5.1
websocket-client==1.5.0
widgetsnbextension==3.6.1
zipp==3.12.0
15076882301 commented 1 year ago

I am a novice, the first contact, thank you for your help, thank you very much

RobPasMue commented 1 year ago

Hi @15076882301! Thanks for opening your first issue. It seems to me that this is an issue related to PyMAPDL specifically. Let me move your issue to the corresponding repository and ping one of their maintainers (@germa89).

Thanks for getting in touch!

RobPasMue commented 1 year ago

My gut feeling is that the encoding of the file might not be the correct one or similar... But I'll leave it to the experts.

15076882301 commented 1 year ago

@RobPasMue Ok, thank you for your answer,

15076882301 commented 1 year ago

@germa89 Hi, elder brother, I need to ask you some questions. I want to obtain the parameters in the wbpj file and modify them. I don't know whether my release of use is correct, because I reported a mistake in this way.

mikerife commented 1 year ago

Hi @15076882301 A wbpj is not an Mechanical APDL file, nor is it a file that MAPDL can read/input directly. It (wbpj) is an XML file - perhaps you could use the Python XML module to parse through the file to retrieve parameters then pass them to MAPDL.

Can I ask why you want to retrieve parameters from a wbpj file in PyMAPDL?

Mike

15076882301 commented 1 year ago

Hi @mikerife I am a student. In my graduation design, I plan to do a secondary development of ansys based on python, read the input parameters and modify them as a table on the interface, and then open the outgoing interface and default mode of the post-processing module. As a student majoring in computer science, I have not systematically learned the operation of ansys software, and my classmates have not come into contact with it. I plan to have a try

germa89 commented 1 year ago

secondary development of ansys based on python

Hi @15076882301

As @mikerife pointed out, you can't read a wbpj file with PyMAPDL. You could though read the ds.dat file in the zipped project wbpz. For that, you need to open your Workbench project and "archive" it (See https://www.youtube.com/watch?v=MtiA1PkO6ww). This will generate a wbpz file which can be extracted as it were a zip. Inside it, you should find (in one of the folders, depends on your simulation type) a ds.dat file which you can use.

By the way, what do you mean with "secondary development"?

15076882301 commented 1 year ago

Hi @germa89 In fact, using pyansys library, add a layer of graphical interface outside, I call it secondary development, ha ha ha

germa89 commented 1 year ago

I guess a layer of graphical interface in Qt?

Well, anyway. There is no way to read wbpj using any of the Ansys libraries for now. Closing the issue.

15076882301 commented 1 year ago

Hi @germa89 Yes, I want to make an interface with Qt. Thank you for answering my question.