How to get Coordinate System information from a results file (file.rst) by using DPF?
I want to see which coordinate systems are defined in a Mechanical results file (file.rst). The Programmers Reference mentions that this information is available on the rst file. I can only find a function that retrieves information when the number of the coordinate system is given: op = dpf.operators.result.coordinate_system(). It would be nice if a list with available CS id's could be retrieved. Does a command exist to retrieve that info?
If it's not possible to get the numbers of the defined coordinate systems a try/except statement can be used. I have written the code and found that for non existing CS numbers the exception is raised, but for existing CS numbers I get the following error for all CS ids except for coordinate system id=1:
Unable to describe object with error: invalid vector subscript
An attached file shows the cslist output from APDL.
from ansys.dpf import core as dpf path_to_rst = r"<some directory>\file.rst" print('Datasources: ') my_data_sources = dpf.DataSources(path_to_rst) print('my_data_sources: '+str(my_data_sources)) myServer=dpf.start_local_server(ansys_path=r'C:\Program Files\ANSYS Inc\v231') print('myServer: '+str(myServer)) print("Local server: "+str(myServer.local_server)) for i in range(0,15): print(i) try: op = dpf.operators.result.coordinate_system() # operator instantiation op.inputs.cs_id.connect(i) op.inputs.data_sources.connect(my_data_sources) my_field = op.outputs.field() print(my_field) except: print('An error occurred')
Best Answer
-
@RvdH unfortunately, there is no such operators in dpf. Of course, you could use pyMAPDL to retrieve that information and then use it in your script.
May I suggest to create an issue on Github to request such a capability?
0
Answers
-
This question already exists on Github: https://github.com/ansys/pydpf-core/issues/153
Using PyMAPDL in combination with ansys-dpf-core is probably an alternative because using
*GET Preprocessing Items, Entity = CDSY
appears to provide all desired data.0 -
This question already exists on Github: https://github.com/ansys/pydpf-core/issues/153
Using PyMAPDL in combination with ansys-dpf-core is probably an alternative because using
*GET Preprocessing Items, Entity = CDSY
appears to provide all desired data.0