mapdl.cdread() doesn't seem to work, when cdb file directory is specified via mapdl.cwd()
See original GitHub issueI am trying to do read a cdb file using mapdl.cdread() and provided the working directory via mapdl.cwd(). However, I get some errors.
Here are the commands I have used:
from ansys.mapdl.core import launch_mapdl
mapdl = launch_mapdl(exec_file='C:\\Program Files\\ANSYS Inc\\v212\\ansys\\bin\\winx64\\ansys212.exe', loglevel='ERROR',additional_switches='-smp',nproc=2)
mapdl.cwd(r'D:\AKD\PyANSYS\issues\cdb')
mapdl.prep7()
mapdl.cdread('db',fname='test',ext='db')
Errors I get:
Traceback (most recent call last):
File "C:/Users/rgpatchi/PycharmProjects/pythonProject/venv/issue_rst_testing.py", line 10, in <module>
mapdl.cdread('db',fname='test',ext='db')
File "C:\Users\rgpatchi\PycharmProjects\pythonProject\venv\lib\site-packages\ansys\mapdl\core\mapdl_grpc.py", line 933, in cdread
fname = kwargs.get('fname', args[1])
IndexError: tuple index out of range
I was able to workaround this issue using the below code.
import os
from ansys.mapdl.core import launch_mapdl
mapdl = launch_mapdl(exec_file='C:\\Program Files\\ANSYS Inc\\v212\\ansys\\bin\\winx64\\ansys212.exe', loglevel='ERROR',additional_switches='-smp',nproc=2)
mapdl.cwd(r'D:\AKD\PyANSYS\issues\cdb')
my_path = r'D:\AKD\PyANSYS\issues\cdb'
my_file = os.path.join(my_path,'test.cdb')
mapdl.prep7()
#mapdl.cdread('db',fname='test',ext='db')
mapdl.cdread('db',my_file,'cdb')
mapdl.eplot()
Is this a bug?
Issue Analytics
- State:
- Created 2 years ago
- Comments:6 (1 by maintainers)
Top Results From Across the Web
CDWRITE - BME-MM
Write only the solid model geometry and solid model load data. This output will be in IGES or ANF format, as specified in...
Read more >/cwd will not change the directory if there are blank spaces in ...
I am trying to set the directory where a pymapdl analysis results will be saved using the /cwd command. I have found that...
Read more >Post-Processing APDL Models in Mechanical | Ansys ...
By default, in APDL, contain element and node data for the model. Go to /PREP7 and use CDWRITE to write a CDB mesh...
Read more >Path directory format in APDL - Ansys Learning Forum
Is there any option to avoid writing the path (so, the directories) in a way that directly is saving the file in the...
Read more >How to open ANSYS APDL File in Workbench & Vice versa
This video explains, how to write workbench output file & how to read in APDL. Similarly, it explains how to write CDB file...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Hi @RGPATCHI
Indeed this is a bug. Python checks if the file exists, but it checks in the python execution directory, not in the Mapdl directory (changed by
cwd
).As you realized, input the full path to
cdread
fixes the issue.I will look into this to be fixed in future releases. Thank you!
Hi @mcMunich ! Feel free to create another issue and post some example code we can replicate. Regards,