ansys / pymapdl

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

The command 'show_area_numbering' is not working in vplot #3243

Open GordonGu1998 opened 2 months ago

GordonGu1998 commented 2 months ago

🤓 Before submitting the issue

🔍 Description of the bug

Hi, the command 'show_area_numbering' is not working in vplot.

🕵️ Steps To Reproduce

from ansys.mapdl.core import launch_mapdl

mapdl = launch_mapdl()

k0 = mapdl.k("", 0, 0, 0)
k1 = mapdl.k("", 1, 0, 0)
k2 = mapdl.k("", 1, 1, 0)
k3 = mapdl.k("", 0, 1, 0)
k4 = mapdl.k("", 0, 0, 1)
k5 = mapdl.k("", 1, 0, 1)
k6 = mapdl.k("", 1, 1, 1)
k7 = mapdl.k("", 0, 1, 1)
v0 = mapdl.v(k0, k1, k2, k3, k4, k5, k6, k7)
mapdl.vplot(show_lines=True, vtk= True,
            show_area_numbering=True,
            color_areas=True)

💻 Which Operating System are you using?

Windows

🐍 Which Python version are you using?

3.12

💾 Which MAPDL version are you using?

2024R1

📝 PyMAPDL Report

Show the Report! ```text PyMAPDL Software and Environment Report Packages Requirements ********************* Core packages ------------- ansys.mapdl.core : 0.68.3 numpy : 1.26.4 platformdirs : 3.11.0 scipy : 1.14.0 grpc : Package not found ansys.api.mapdl.v0 : Package not found ansys.mapdl.reader : 0.53.0 google.protobuf : Package not found Optional packages ----------------- matplotlib : 3.9.1 pyvista : 0.43.4 pyiges : 0.3.1 tqdm : 4.66.4 Ansys Installation ****************** Version Location ------------------ 241 C:\Program Files\ANSYS Inc\v241 Ansys Environment Variables *************************** ANSYS241_DIR C:\Program Files\ANSYS Inc\v241\ANSYS AWP_ROOT241 C:\Program Files\ANSYS Inc\v241 CADOE_LIBDIR241 C:\Program Files\ANSYS Inc\v241\CommonFiles\Language\en-us ```

📝 Installed packages

Show the installed packages! ```text # PASTE HERE THE OUTPUT OF `python -m pip freeze` here about-time==4.2.1 aiohttp==3.9.5 aiosignal==1.3.1 alive-progress==3.1.5 annotated-types==0.7.0 ansys-acp-core==0.1b1 ansys-additive-core==0.18.0b6 ansys-additive-widgets==0.2.1 ansys-api-acp==0.1.0.dev9 ansys-api-additive==1.7.2 ansys-api-dbu==0.3.3 ansys-api-dyna==0.3.6 ansys-api-edb==1.0.1 ansys-api-fluent==0.3.25 ansys-api-geometry==0.4.4 ansys-api-mapdl==0.5.1 ansys-api-mechanical==0.1.2 ansys-api-meshing-prime==0.1.2 ansys-api-modelcenter==0.3.1 ansys-api-platform-instancemanagement==1.1.0 ansys-api-pyensight==0.4.1 ansys-api-sherlock==0.1.27 ansys-api-systemcoupling==0.1.0 ansys-api-tools-filetransfer==0.1.0 ansys-api-workbench==0.2.0 ansys-conceptev-core==0.1.4 ansys-dpf-composites==0.5.0 ansys-dpf-core==0.12.2 ansys-dpf-post==0.8.0 ansys-dyna-core==0.4.15 ansys-dynamicreporting-core==0.6.0 ansys-edb-core==0.1.4 ansys-engineeringworkflow-api==0.1.0 ansys-fluent-core==0.20.1 ansys-geometry-core==0.6.5 ansys-grantami-bomanalytics==2.1.1 ansys-grantami-bomanalytics-openapi==3.0.0 ansys-grantami-jobqueue==1.0.1 ansys-grantami-recordlists==1.2.1 ansys-grantami-serverapi-openapi==3.0.0 ansys-hps-client==0.8.0 ansys-mapdl-core==0.68.3 ansys-mapdl-reader==0.53.0 ansys-math-core==0.1.5 ansys-mechanical-core==0.11.1 ansys-mechanical-env==0.1.6 ansys-meshing-prime==0.6.0.dev9 ansys-modelcenter-workflow==0.1.1 ansys-motorcad-core==0.5.1 ansys-openapi-common==2.0.2 ansys-optislang-core==0.7.1 ansys-platform-instancemanagement==1.1.2 ansys-pyensight-core==0.8.4 ansys-pythonnet==3.1.0rc3 ansys-rocky-core==0.1.0 ansys-seascape==0.2.0 ansys-sherlock-core==0.6.0 ansys-simai-core==0.2.1 ansys-systemcoupling-core==0.6 ansys-tools-filetransfer==0.1.0 ansys-tools-local-product-launcher==0.1.0 ansys-tools-path==0.6.0 ansys-tools-visualization-interface==0.2.6 ansys-turbogrid-api==0.4.3 ansys-turbogrid-core==0.4.1 ansys-units==0.3.2 ansys-workbench-core==0.4.0 anyio==4.4.0 appdirs==1.4.4 argon2-cffi==23.1.0 argon2-cffi-bindings==21.2.0 arrow==1.3.0 asgiref==3.8.1 asttokens==2.4.1 attrs==23.2.0 backoff==2.2.1 backports.entry-points-selectable==1.3.0 bcrypt==4.1.3 beartype==0.17.2 beautifulsoup4==4.12.3 bleach==6.1.0 bokeh==3.4.2 build==1.2.1 cachetools==5.3.3 certifi==2024.7.4 cffi==1.16.0 charset-normalizer==3.3.2 click==8.1.7 clr-loader==0.2.6 colorama==0.4.6 comm==0.2.2 contourpy==1.2.1 cryptography==42.0.8 cycler==0.12.1 decorator==5.1.1 defusedxml==0.7.1 Deprecated==1.2.14 dill==0.3.8 Django==5.0.6 docker==6.1.3 docutils==0.21.2 elementpath==4.4.0 executing==2.0.1 fabric==3.2.2 fastjsonschema==2.20.0 filelock==3.15.4 flexcache==0.3 flexparser==0.3.1 fmodpy==1.7.4 fonttools==4.53.1 fortls==3.1.2 fpdf2==2.7.9 fqdn==1.5.1 frozenlist==1.4.1 geomdl==5.3.1 google-api-core==2.19.1 google-api-python-client==2.136.0 google-auth==2.31.0 google-auth-httplib2==0.2.0 googleapis-common-protos==1.63.2 grapheme==0.6.0 grpcio==1.64.1 grpcio-health-checking==1.48.2 grpcio-status==1.48.2 h11==0.14.0 httpcore==1.0.5 httplib2==0.22.0 httpx==0.26.0 idna==3.7 importlib_metadata==8.0.0 invoke==2.2.0 ipython==8.26.0 ipywidgets==8.1.3 isoduration==20.11.0 jaraco.classes==3.4.0 jaraco.context==5.3.0 jaraco.functools==4.0.1 jedi==0.19.1 Jinja2==3.1.4 json5==0.9.25 jsonpointer==3.0.0 jsonschema==4.22.0 jsonschema-specifications==2023.12.1 jupyter-events==0.10.0 jupyter_client==8.6.2 jupyter_core==5.7.2 jupyter_server==2.14.1 jupyter_server_proxy==4.3.0 jupyter_server_terminals==0.5.3 jupyterlab_pygments==0.3.0 jupyterlab_widgets==3.0.11 keyring==25.2.1 kiwisolver==1.4.5 linkify-it-py==2.0.3 lxml==4.9.4 Markdown==3.6 markdown-it-py==3.0.0 MarkupSafe==2.1.5 marshmallow==3.21.3 marshmallow-oneofschema==3.1.1 matplotlib==3.9.1 matplotlib-inline==0.1.7 mdit-py-plugins==0.4.1 mdurl==0.1.2 mistune==3.0.2 more-itertools==10.3.0 msgpack==1.0.8 multidict==6.0.5 nbclient==0.10.0 nbconvert==7.16.4 nbformat==5.10.4 nest-asyncio==1.6.0 nh3==0.2.17 numpy==1.26.4 overrides==7.7.0 packaging==24.1 pandas==1.5.3 pandocfilters==1.5.1 panel==1.4.4 param==2.1.1 paramiko==3.4.0 parso==0.8.4 pillow==10.4.0 Pint==0.24.1 pkginfo==1.10.0 platformdirs==3.11.0 plumbum==1.8.3 pooch==1.8.2 prometheus_client==0.20.0 prompt_toolkit==3.0.47 proto-plus==1.24.0 protobuf==3.20.3 psutil==5.9.8 pure-eval==0.2.2 pyaedt==0.9.7 pyansys==2024.2.0 pyansys-tools-variableinterop==0.1.1 pyansys-tools-versioning==0.5.0 pyasn1==0.6.0 pyasn1_modules==0.4.0 pycparser==2.22 pydantic==2.7.4 pydantic_core==2.18.4 pyedb==0.18.0 Pygments==2.18.0 pygranta==2024.2.0 pyiges==0.3.1 PyJWT==2.8.0 PyNaCl==1.5.0 pyparsing==3.1.2 pypiwin32==223 pypng==0.20220715.0 pyproject_hooks==1.1.0 Pyro5==5.15 pyspnego==0.11.0 python-dateutil==2.9.0.post0 python-dotenv==1.0.1 python-json-logger==2.0.7 pytomlpp==1.0.13 pytwin==0.7.0 pytz==2024.1 pyvista==0.43.4 pyviz_comms==3.0.2 pywin32==306 pywin32-ctypes==0.2.2 pywinpty==2.0.13 PyYAML==6.0.1 pyzmq==26.0.3 readme_renderer==43.0 referencing==0.35.1 requests==2.32.3 requests-negotiate-sspi==0.5.2 requests-toolbelt==1.0.0 requests_ntlm==1.3.0 rfc3339-validator==0.1.4 rfc3986==2.0.0 rfc3986-validator==0.1.1 rich==13.7.1 rpds-py==0.18.1 rpyc==6.0.0 rsa==4.9 Rtree==1.2.0 scipy==1.14.0 scooby==0.10.0 semver==3.0.2 Send2Trash==1.8.3 serpent==1.41 setuptools==70.2.0 simpervisor==1.0.0 six==1.16.0 sniffio==1.3.1 soupsieve==2.5 sqlparse==0.5.0 sseclient-py==1.8.0 sspilib==0.1.0 stack-data==0.6.3 tabulate==0.9.0 terminado==0.18.1 tinycss2==1.3.0 toml==0.10.2 tomli==2.0.1 tornado==6.4.1 tqdm==4.66.4 traitlets==5.14.3 trame==3.6.3 trame-client==3.2.1 trame-server==3.0.3 trame-vtk==2.8.9 trame-vuetify==2.6.1 twine==5.1.1 types-python-dateutil==2.9.0.20240316 typing_extensions==4.12.2 tzdata==2024.1 uc-micro-py==1.0.3 uri-template==1.3.0 uritemplate==4.1.1 urllib3==1.26.19 vtk==9.3.1 wakepy==0.9.1 wcwidth==0.2.13 webcolors==24.6.0 webencodings==0.5.1 websocket-client==1.8.0 websockets==12.0 widgetsnbextension==4.0.11 WMI==1.5.1 wrapt==1.16.0 wslink==2.1.1 xmlschema==2.5.1 xyzservices==2024.6.0 yarl==1.9.4 zipp==3.19.2 ```

📝 Logger output file

Show the logger output file. ```text # PASTE HERE THE CONTENT OF THE LOGGER OUTPUT FILE. ```
mikerife commented 2 months ago

Hi @GordonGu1998 I see same issue using Python 3.10 and MAPDL 23R2. Very similar issues have been reported in an earlier Issue here: https://github.com/ansys/pymapdl/issues/3120

Mike

GordonGu1998 commented 2 months ago

I have also noticed that 'show_line_numbering' and 'show_volume_numbering' are also not working in the plotting function 'vplot' when 'vtk = True'. However, in the plotting function 'aplot', both 'show_line_numbering' and 'show_volume_numbering' work well. I am quite surprised that no one has report this issue before and all the area IDs used in the pymapdl examples seem coming from nowhere. How do engineers apply boundary conditions and loads to the surfaces if they can't see which area ID is correspondent to the surface?

mikerife commented 2 months ago

@GordonGu1998 Usually by selecting the entities by some criteria. Like picker location (centroid for area) or capturing the entiry ID similarly to how you did.
Don't get me wrong - the plotting needs to get fixed asap.

Oh, and there is also the open_gui() option to open the model in MAPDL interactive and inspect the model. mike

GordonGu1998 commented 2 months ago

Thanks for your advice, Mike! 'open_gui( )' is a feasible way to identify the IDs of the surfaces. But it still will be more convenient to see IDs of surfaces directly. I am very looking forward to seeing this issue fixed.

germa89 commented 2 months ago

show_volume_numbering is not even implemented, althought it is an argument. That will require a PR itself.

germa89 commented 2 months ago

the issue with this is that the vplot extract the meshes from each area plot, but it does leave the labels (points) behind.

This is going to require a bit more of thinking... we could extract the labels sure... But maybe we should just reuse the same plotter.

GordonGu1998 commented 2 months ago

Thanks for your reply. But in my project, it will be much easier to identify the nodes by the face index than the location. This project has successfully been implemented on MATLAB before, and MATLAB offers face labels in its PDE toolbox.