Open
Description
Before submitting the issue
- I have checked for Compatibility issues
- I have searched among the existing issues
- I am using a Python virtual environment
Description of the bug
My goal is to extract all the properties of a given material.
It seems you cannot get all the material properties at once (really?). So you need to iterate over all the names knowing before hand their labels. So I am doing:
full_mesh = model.metadata.meshed_region
mats = full_mesh.property_field("mat")
mat_prop = dpf.operators.result.mapdl_material_properties()
mat_prop.inputs.materials.connect(mats)
props = tuple(["DENS", "EX"])
mat_prop.inputs.properties_name.connect(props) # error
mat_prop.inputs.data_sources.connect(model)
prop_field = mat_prop.outputs.properties_value.get_data()
However the line mat_prop.inputs.properties_name.connect(props)
gives the following error:
5 mat_prop.inputs.materials.connect(mats)
7 props = tuple(["DENS", "EX"])
----> 8 mat_prop.inputs.properties_name.connect(props) # error
9 mat_prop.inputs.data_sources.connect(model)
11 prop_field = mat_prop.outputs.properties_value.get_data()
File ~/.venv/lib/python3.11/site-packages/ansys/dpf/core/inputs.py:139, in Input.connect(self, inpt)
134 err_str = (
135 f"The input operator for the {self._spec.name} pin must be "
136 "one of the following types:\n"
137 )
138 err_str += "\n".join([f"- {py_type}" for py_type in self._python_expected_types])
--> 139 raise TypeError(err_str)
141 from ansys.dpf.core.results import Result
143 if isinstance(inpt, _Outputs):
TypeError: The input operator for the properties_name pin must be one of the following types:
- str
- Vector<String>
It seems you cannot use a list of strings as input of connect
method.
I did try to use ansys.dpf.gate.dpf_vector.DPFVectorString
class, but it gives NotImplementedError
:
>>> gate.dpf_vector.DPFVectorString("DENS", "EX")
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
File ~/.venv/lib/python3.11/site-packages/ansys/dpf/gate/dpf_vector.py:41, in DPFVectorBase.__init__(self, client, api)
40 else:
---> 41 self._internal_obj = self.dpf_vector_api.dpf_vector_new_for_object(client)
42 except AttributeError:
AttributeError: 'str' object has no attribute 'dpf_vector_new_for_object'
During handling of the above exception, another exception occurred:
NotImplementedError Traceback (most recent call last)
Cell In[80], line 1
----> 1 gate.dpf_vector.DPFVectorString("DENS", "EX")
File ~/.venv/lib/python3.11/site-packages/ansys/dpf/gate/dpf_vector.py:262, in DPFVectorString.__init__(self, client, api)
261 def __init__(self, client=None, api=dpf_vector_capi.DpfVectorCAPI):
--> 262 super().__init__(client, api)
263 self._array = MutableListString()
File ~/.venv/lib/python3.11/site-packages/ansys/dpf/gate/dpf_vector.py:43, in DPFVectorBase.__init__(self, client, api)
41 self._internal_obj = self.dpf_vector_api.dpf_vector_new_for_object(client)
42 except AttributeError:
---> 43 raise NotImplementedError
NotImplementedError:
Hence, the question is how to retrieve all the properties of a given material in the most efficient way?
Steps To Reproduce
NA
Which Operating System causes the issue?
MacOS
Which DPF/Ansys version are you using?
Ansys 2025 R2
Which Python version causes the issue?
3.11
Installed packages
Packages
accessible-pygments==0.0.5
aiohappyeyeballs==2.6.1
aiohttp==3.11.18
aiosignal==1.3.2
alabaster==1.0.0
ansys-api-mapdl==0.5.2
ansys-api-platform-instancemanagement==1.1.3
ansys-dpf-core==0.13.6
-e git+https://github.com/ansys/pymapdl.git@749ef517136fa54e135d4274068307a1d8bb42fa#egg=ansys_mapdl_core
ansys-mapdl-reader==0.55.0
ansys-math-core==0.2.2
ansys-platform-instancemanagement==1.1.2
ansys-sphinx-theme==1.4.4
ansys-tools-path==0.7.1
ansys-tools-visualization-interface==0.9.1
anyio==4.9.0
appdirs==1.4.4
argon2-cffi==23.1.0
argon2-cffi-bindings==21.2.0
arrow==1.3.0
asttokens==3.0.0
async-lru==2.0.5
attrs==24.2.0
autopep8==2.3.2
babel==2.17.0
beautifulsoup4==4.13.4
bleach==6.2.0
certifi==2025.4.26
cffi==1.17.1
cfgv==3.4.0
charset-normalizer==3.4.2
click==8.2.0
colorama==0.4.6
comm==0.2.2
contourpy==1.3.2
coverage==7.8.0
cycler==0.12.1
debugpy==1.8.14
decorator==5.2.1
defusedxml==0.7.1
distlib==0.3.9
docutils==0.21.2
executing==2.2.0
fastjsonschema==2.21.1
filelock==3.18.0
fonttools==4.58.0
fqdn==1.5.1
frozenlist==1.6.0
geomdl==5.3.1
gprof2dot==2025.4.14
grpcio==1.70.0
h11==0.16.0
httpcore==1.0.9
httpx==0.28.1
identify==2.6.10
idna==3.10
imageio==2.37.0
imageio-ffmpeg==0.6.0
imagesize==1.4.1
importlib_metadata==8.7.0
iniconfig==2.1.0
ipydatawidgets==4.3.5
ipykernel==6.29.5
ipython==9.2.0
ipython_pygments_lexers==1.1.1
ipywidgets==8.1.7
isoduration==20.11.0
jedi==0.19.2
Jinja2==3.1.6
json5==0.12.0
jsonpointer==3.0.0
jsonschema==4.23.0
jsonschema-specifications==2025.4.1
jupyter==1.1.1
jupyter-console==6.6.3
jupyter-events==0.12.0
jupyter-lsp==2.2.5
jupyter-sphinx==0.5.3
jupyter_client==8.6.3
jupyter_core==5.7.2
jupyter_server==2.16.0
jupyter_server_terminals==0.5.3
jupyterlab==4.4.2
jupyterlab_pygments==0.3.0
jupyterlab_server==2.27.3
jupyterlab_widgets==3.0.15
kiwisolver==1.4.8
MarkupSafe==3.0.2
matplotlib==3.10.3
matplotlib-inline==0.1.7
mistune==3.1.3
more-itertools==10.7.0
msgpack==1.1.0
multidict==6.4.4
narwhals==1.40.0
nbclient==0.10.2
nbconvert==7.16.6
nbformat==5.10.4
nest-asyncio==1.6.0
nodeenv==1.9.1
notebook==7.4.2
notebook_shim==0.2.4
numpy==2.2.6
numpydoc==1.8.0
overrides==7.7.0
packaging==25.0
pandas==2.2.3
pandocfilters==1.5.1
parso==0.8.4
pdf2image==1.17.0
pexpect==4.9.0
pillow==11.2.1
platformdirs==4.3.8
plotly==6.0.1
pluggy==1.6.0
pooch==1.8.2
pre_commit==4.2.0
prometheus_client==0.22.0
prompt_toolkit==3.0.51
propcache==0.3.1
protobuf==4.25.7
psutil==7.0.0
ptyprocess==0.7.0
pure_eval==0.2.3
pyansys-tools-report==0.8.2
pyansys-tools-versioning==0.6.0
pycodestyle==2.13.0
pycparser==2.22
pydata-sphinx-theme==0.16.1
pyfakefs==5.8.0
Pygments==2.19.1
pyiges==0.3.1
pypandoc==1.15
pyparsing==3.2.3
pytest==8.3.5
pytest-cov==6.1.1
pytest-profiling==1.8.1
pytest-random-order==1.1.1
pytest-reportlog==0.4.0
pytest-rerunfailures==15.1
pytest-sphinx==0.6.3
pytest-timeout==2.4.0
pytest_pyvista==0.1.9
python-dateutil==2.9.0.post0
python-json-logger==3.3.0
pythreejs==2.4.2
pytz==2025.2
pyvista==0.45.2
PyYAML==6.0.2
pyzmq==26.4.0
referencing==0.36.2
requests==2.32.3
rfc3339-validator==0.1.4
rfc3986-validator==0.1.1
roman-numerals-py==3.1.0
rpds-py==0.25.0
scipy==1.15.3
scooby==0.10.1
Send2Trash==1.8.3
six==1.17.0
sniffio==1.3.1
snowballstemmer==2.2.0
soupsieve==2.7
Sphinx==8.2.3
sphinx-autobuild==2024.10.3
sphinx-autodoc-typehints==3.1.0
sphinx-copybutton==0.5.2
sphinx-gallery==0.19.0
sphinx-jinja==2.0.2
sphinx-notfound-page==1.1.0
sphinx_design==0.6.1
sphinxcontrib-applehelp==2.0.0
sphinxcontrib-devhelp==2.0.0
sphinxcontrib-htmlhelp==2.1.0
sphinxcontrib-jsmath==1.0.1
sphinxcontrib-qthelp==2.0.0
sphinxcontrib-serializinghtml==2.0.0
sphinxcontrib-websupport==2.0.0
sphinxemoji==0.3.1
stack-data==0.6.3
starlette==0.46.2
tabulate==0.9.0
terminado==0.18.1
tinycss2==1.4.0
tornado==6.5
tqdm==4.67.1
traitlets==5.14.3
traittypes==0.2.1
trame==3.9.0
trame-client==3.9.0
trame-common==0.2.0
trame-server==3.4.0
trame-vtk==2.8.15
trame-vuetify==3.0.1
types-python-dateutil==2.9.0.20250516
typing_extensions==4.13.2
tzdata==2025.2
uri-template==1.3.0
urllib3==2.4.0
uvicorn==0.34.2
virtualenv==20.31.2
vtk==9.4.2
watchfiles==1.0.5
wcwidth==0.2.13
webcolors==24.11.1
webencodings==0.5.1
websocket-client==1.8.0
websockets==15.0.1
widgetsnbextension==4.0.14
wslink==2.3.4
yarl==1.20.0
zipp==3.21.0