Open planestress opened 6 months ago
@germa89 @mikerife could you help this user out?
Hi @planstress Well, this may depend on what you want to do with the input file. Some choices are:
1 Define a Named Selection in WB Mechanical of Part1. This will be a element 'component' in the input file (MAPDL component). The PyMAPDL Reader then often has an option to specify a component when performing some function like creating a result plot.
2 Use PyMAPDL and you can use its select logic as needed to work with a sub-set of the model.
3 Use PyDPF which has Scoping based on MAPDL element attributes like material ID. A unique material ID is used by each Part in WB Mechanical even if the actual material is the same between parts.
Mike
Hi @mikerife
Thank you for replying.Honestly,I don't quite understand the methods you offered because I am rookie at this.
In this example,I want to read all elements information from dat file and then extract element type as well as nodes of every elements,so I issue thepymapdl_reader.Archive('ds.dst')
to read elements information.In my opinion,it should read all elements information but it only read the first part elements actually.
I wonder why is that and how can I do to my purpose?
@planstress Ok I read your description backwards! I see now that you are reporting that PyMAPDL Reader has elements missing compared to the ds.dat file. Can you share the ds.dat file? There is not much to go on just from a screen shot.
@mikerife of course,here it is.Thank you. [Uploading ds.zipβ¦]()
Doesn't seem like the file attachment worked.
@mikerife sorry about that,I upload it again. ds.zip
@planestress
PyMAPDL-Reader development is quite stale at the moment. I'm not quite sure why not all the elements are read in to be honest.
If I were you, I would probably switch to PyMAPDL where you can do:
from ansys.mapdl.core import launch_mapdl
mapdl = launch_mapdl()
mapdl.prep7()
mapdl.input("ds.dat")
mapdl.cmsel("s", "CRACK_TIP")
# Then you have selected the named selection called "CRACK_TIP".
...
# perform operations
This can be done, because in the ds.dat
file you have attached the named selections (which are just components) are defined as:
/com,*********** Send Named Selection as Node Component ***********
CMBLOCK,CRACK_TIP,NODE, 41
(8i10)
138 182 183 184 185 186 187 188
189 190 191 192 193 194 195 196
197 198 199 200 201 20501 20792 20800
20808 20817 20826 20836 20846 20854 20862 20871
20880 20891 20902 20913 20922 20930 20940 20949
20958
PyMAPDL should create the proper model from the dat
file, and then it should be able to read the components.
@germa89 Thank you for your reply.In fact,I want to caculate stress of some point in every element base on element shape function,so I have to get all elements information of this model include element type,nodes belong to the elements and so on. Besides,I tried your code
from ansys.mapdl.core import launch_mapdl
mapdl = launch_mapdl()
and then occured this error:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\31142\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\ansys\mapdl\core\launcher.py", line 1634, in launch_mapdl
raise exception
File "C:\Users\31142\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\ansys\mapdl\core\launcher.py", line 1590, in launch_mapdl
from ansys.mapdl.core.mapdl_corba import MapdlCorba
File "C:\Users\31142\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\ansys\mapdl\core\mapdl_corba.py", line 16, in <module>
raise ImportError(
ImportError: The CORBA interface is only supported for Python 3.8 and earlier
My python version is 3.11 and my ansys version is 19.2.
@planestress well that error is pretty evident. Try installing Python 3.8 and trying this again. Or update to a newer release of MAPDL (why are you using v19.2???).
@mikerife I pay little attention to the ansys versions,I think they are all pretty much the same.Can I achieve my purpose if I follow German's strategy?
@planestress
PyMAPDL-Reader development is quite stale at the moment. I'm not quite sure why not all the elements are read in to be honest.
If I were you, I would probably switch to PyMAPDL where you can do:
from ansys.mapdl.core import launch_mapdl mapdl = launch_mapdl() mapdl.prep7() mapdl.input("ds.dat") mapdl.cmsel("s", "CRACK_TIP") # Then you have selected the named selection called "CRACK_TIP". ... # perform operations
This can be done, because in the
ds.dat
file you have attached the named selections (which are just components) are defined as:/com,*********** Send Named Selection as Node Component *********** CMBLOCK,CRACK_TIP,NODE, 41 (8i10) 138 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 20501 20792 20800 20808 20817 20826 20836 20846 20854 20862 20871 20880 20891 20902 20913 20922 20930 20940 20949 20958
PyMAPDL should create the proper model from the
dat
file, and then it should be able to read the components.
@planestress "I pay little attention to the ansys versions, I think they are all pretty much the same." Depending on what feature/function you are using this could be a very dangerous/wrong statement, or not. Let's assum now not and see what happens.
"Can I achieve my purpose if I follow German's strategy?" Install Python 3.8 and test and see what happens.
@mikerife I install Python 3.8.10 and reinstall PyMAPDL version 0.67, 0.68 doesn't support Python 3.8.Oh my god,why there are so many versions???Then I do as German's method but there is a new error.(I am devastated T_T)
CRITICAL - pymapdl_global - logging - handle_exception - Uncaught exception
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "D:\Program Files (x86)\python3.8.10\lib\site-packages\ansys\mapdl\core\launcher.py", line 1634, in launch_mapdl
raise exception
File "D:\Program Files (x86)\python3.8.10\lib\site-packages\ansys\mapdl\core\launcher.py", line 1597, in launch_mapdl
mapdl = MapdlCorba(
File "D:\Program Files (x86)\python3.8.10\lib\site-packages\ansys\mapdl\core\mapdl_corba.py", line 191, in __init__
super().__init__(
File "D:\Program Files (x86)\python3.8.10\lib\site-packages\ansys\mapdl\core\mapdl.py", line 265, in __init__
_sanitize_start_parm(start_parm)
File "D:\Program Files (x86)\python3.8.10\lib\site-packages\ansys\mapdl\core\mapdl.py", line 203, in _sanitize_start_parm
raise ValueError(f"The argument '{each_key}' is not recognaised.")
ValueError: The argument 'log_broadcast' is not recognaised.
Besides,I cannot install pyansys directly because some Python packages in pyansys are incompatible with Python 3.8,so I only installed PyMAPDL 0.67.
@planestress the errors you are getting are because PyMAPDL is trying to connect using the CORBA
interface which is the one recommended for v19.2. See Compatibility between MAPDL and interfaces
While it is true that most of the MAPDL commands remain fairly stable between versions, PyMAPDL interface does not. In 2021R1, the gRPC interface was introduced and since then, it has been the recommended PyMAPDL interface. CORBA
has been deprecated recently, and it was never fully covered by testing.
My advice is to install the latest MAPDL version (at least 2022R2), and update PyMAPDL, the experience should be way better.
π Before submitting the issue
π Description of the bug
My geometry cotains two solids,so elements information in .dat file is divided into two parts(both are same material).I awnt to use PyMapdl reader to read all elements information from .dat file but it just read the first part elements information.How should I do?
π Steps to reproduce
like my discription of the bug
π» Which operating system are you using?
Windows
π Which ANSYS version are you using?
19.2
π Which Python version are you using?
3.11
π¦ Installed packages