.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "examples/00-read_binary/load_shaft_result.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code. .. rst-class:: sphx-glr-example-title .. _sphx_glr_examples_00-read_binary_load_shaft_result.py: .. _ref_load_shaft_result: Shaft Modal Analysis ~~~~~~~~~~~~~~~~~~~~ Visualize a shaft modal analysis .. GENERATED FROM PYTHON SOURCE LINES 10-18 .. code-block:: Python # sphinx_gallery_thumbnail_number = 6 from ansys.mapdl.reader import examples # Download an example shaft modal analysis result file shaft = examples.download_shaft_modal() .. GENERATED FROM PYTHON SOURCE LINES 19-20 Mesh is stored within the result object .. GENERATED FROM PYTHON SOURCE LINES 20-22 .. code-block:: Python print(shaft.mesh) .. rst-class:: sphx-glr-script-out .. code-block:: none ANSYS Mesh Number of Nodes: 27132 Number of Elements: 25051 Number of Element Types: 6 Number of Node Components: 4 Number of Element Components: 3 .. GENERATED FROM PYTHON SOURCE LINES 23-24 ...and contains a VTK unstructured grid .. GENERATED FROM PYTHON SOURCE LINES 24-26 .. code-block:: Python print(shaft.mesh._grid) .. rst-class:: sphx-glr-script-out .. code-block:: none None .. GENERATED FROM PYTHON SOURCE LINES 27-28 Plot the shaft .. GENERATED FROM PYTHON SOURCE LINES 28-31 .. code-block:: Python cpos = shaft.plot() # list shaft node components .. image-sg:: /examples/00-read_binary/images/sphx_glr_load_shaft_result_001.png :alt: load shaft result :srcset: /examples/00-read_binary/images/sphx_glr_load_shaft_result_001.png :class: sphx-glr-single-img .. GENERATED FROM PYTHON SOURCE LINES 32-34 .. code-block:: Python print(shaft.element_components.keys()) .. rst-class:: sphx-glr-script-out .. code-block:: none dict_keys(['EBC1', 'EBC2', 'SHAFT_MESH']) .. GENERATED FROM PYTHON SOURCE LINES 35-38 Plot a node component This camera angle was saved interactively from ``shaft.plot`` .. GENERATED FROM PYTHON SOURCE LINES 38-47 .. code-block:: Python cpos = [ (-115.35773008378118, 285.36602704380107, -393.9029392590675), (126.12852038381345, 0.2179228023931401, 5.236408799851887), (0.37246222812978824, 0.8468424028124546, 0.37964435122285495), ] shaft.plot(element_components=["SHAFT_MESH"], cpos=cpos) # get cpos from cpos = shaft.plot() .. image-sg:: /examples/00-read_binary/images/sphx_glr_load_shaft_result_002.png :alt: load shaft result :srcset: /examples/00-read_binary/images/sphx_glr_load_shaft_result_002.png :class: sphx-glr-single-img .. GENERATED FROM PYTHON SOURCE LINES 48-49 Plot a node component as a wireframe .. GENERATED FROM PYTHON SOURCE LINES 49-54 .. code-block:: Python shaft.plot( element_components=["SHAFT_MESH"], cpos=cpos, style="wireframe", lighting=False ) .. image-sg:: /examples/00-read_binary/images/sphx_glr_load_shaft_result_003.png :alt: load shaft result :srcset: /examples/00-read_binary/images/sphx_glr_load_shaft_result_003.png :class: sphx-glr-single-img .. GENERATED FROM PYTHON SOURCE LINES 55-56 Plot the shaft with edges and with a blue color .. GENERATED FROM PYTHON SOURCE LINES 56-58 .. code-block:: Python shaft.plot(show_edges=True, color="cyan") .. image-sg:: /examples/00-read_binary/images/sphx_glr_load_shaft_result_004.png :alt: load shaft result :srcset: /examples/00-read_binary/images/sphx_glr_load_shaft_result_004.png :class: sphx-glr-single-img .. GENERATED FROM PYTHON SOURCE LINES 59-60 Plot the shaft without lighting but with edges and with a blue color .. GENERATED FROM PYTHON SOURCE LINES 60-63 .. code-block:: Python shaft.plot(lighting=False, show_edges=True, color="cyan") .. image-sg:: /examples/00-read_binary/images/sphx_glr_load_shaft_result_005.png :alt: load shaft result :srcset: /examples/00-read_binary/images/sphx_glr_load_shaft_result_005.png :class: sphx-glr-single-img .. GENERATED FROM PYTHON SOURCE LINES 64-65 plot a mode shape without contours using the "bwr" color map .. GENERATED FROM PYTHON SOURCE LINES 65-76 .. code-block:: Python shaft.plot_nodal_solution( 9, element_components=["SHAFT_MESH"], show_displacement=True, cmap="bwr", displacement_factor=0.3, stitle=None, overlay_wireframe=True, cpos=cpos, ) .. image-sg:: /examples/00-read_binary/images/sphx_glr_load_shaft_result_006.png :alt: load shaft result :srcset: /examples/00-read_binary/images/sphx_glr_load_shaft_result_006.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out .. code-block:: none /opt/hostedtoolcache/Python/3.10.14/x64/lib/python3.10/site-packages/pyvista/plotting/_plotting.py:286: PyVistaDeprecationWarning: "stitle" is a deprecated keyword argument and will be removed in a future release. Use ``scalar_bar_args`` instead. For example: scalar_bar_args={'title': 'Scalar Bar Title'} warnings.warn(USE_SCALAR_BAR_ARGS, PyVistaDeprecationWarning) .. GENERATED FROM PYTHON SOURCE LINES 77-78 plot a mode shape with contours and the default colormap .. GENERATED FROM PYTHON SOURCE LINES 78-89 .. code-block:: Python shaft.plot_nodal_solution( 1, element_components=["SHAFT_MESH"], n_colors=10, show_displacement=True, displacement_factor=1, stitle=None, overlay_wireframe=True, cpos=cpos, ) .. image-sg:: /examples/00-read_binary/images/sphx_glr_load_shaft_result_007.png :alt: load shaft result :srcset: /examples/00-read_binary/images/sphx_glr_load_shaft_result_007.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out .. code-block:: none /opt/hostedtoolcache/Python/3.10.14/x64/lib/python3.10/site-packages/pyvista/plotting/_plotting.py:286: PyVistaDeprecationWarning: "stitle" is a deprecated keyword argument and will be removed in a future release. Use ``scalar_bar_args`` instead. For example: scalar_bar_args={'title': 'Scalar Bar Title'} warnings.warn(USE_SCALAR_BAR_ARGS, PyVistaDeprecationWarning) .. GENERATED FROM PYTHON SOURCE LINES 90-94 Animate a mode of a component the shaft Set ``loop==True`` to plot continuously. Disable ``movie_filename`` and increase ``n_frames`` for a smoother plot .. GENERATED FROM PYTHON SOURCE LINES 94-105 .. code-block:: Python shaft.animate_nodal_solution( 5, element_components="SHAFT_MESH", comp="norm", displacement_factor=1, show_edges=True, cpos=cpos, loop=False, movie_filename="demo.gif", n_frames=30, ) .. image-sg:: /examples/00-read_binary/images/sphx_glr_load_shaft_result_008.gif :alt: load shaft result :srcset: /examples/00-read_binary/images/sphx_glr_load_shaft_result_008.gif :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out .. code-block:: none [(-115.35773008378118, 285.36602704380107, -393.9029392590675), (126.12852038381345, 0.2179228023931401, 5.236408799851887), (0.3724622281297882, 0.8468424028124544, 0.37964435122285484)] .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 12.087 seconds) .. _sphx_glr_download_examples_00-read_binary_load_shaft_result.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: load_shaft_result.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: load_shaft_result.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: load_shaft_result.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_