Project tree#

Display the heirarchial Mechanical project structure.

Import necessary libraries#

from ansys.mechanical.core import App
from ansys.mechanical.core.examples import delete_downloads, download_file

Embed Mechanical and set global variables

app = App()
app.update_globals(globals())
print(app)
Ansys Mechanical [Ansys Mechanical Enterprise]
Product Version:251
Software build date: 11/27/2024 09:34:44

Download the mechdb file#

mechdb_path = download_file("graphics_test.mechdb", "pymechanical", "test_files")

Load the mechdb file inside Mechanical

app.open(mechdb_path)

Display the project tree#

app.print_tree()
├── Project
|  ├── Model
|  |  ├── Geometry Imports (✓)
|  |  |  ├── Geometry Import (✓)
|  |  ├── Geometry (✓)
|  |  |  ├── Part 1
|  |  |  |  ├── Part 1
|  |  ├── Materials (✓)
|  |  |  ├── Structural Steel (✓)
|  |  ├── Coordinate Systems (✓)
|  |  |  ├── Global Coordinate System (✓)
|  |  ├── Remote Points (✓)
|  |  ├── Mesh (✓)
|  |  ├── Static Structural (✓)
|  |  |  ├── Analysis Settings (✓)
|  |  |  ├── Fixed Support (✓)
|  |  |  ├── Force (✓)
|  |  |  ├── Solution (✓)
|  |  |  |  ├── Solution Information (✓)
|  |  |  |  ├── Directional Deformation (✓)

Display the tree only under the first analysis#

app.print_tree(Model.Analyses[0])
├── Static Structural (✓)
|  ├── Analysis Settings (✓)
|  ├── Fixed Support (✓)
|  ├── Force (✓)
|  ├── Solution (✓)
|  |  ├── Solution Information (✓)
|  |  ├── Directional Deformation (✓)

Cleanup#

delete_downloads()
app.new()

Total running time of the script: (0 minutes 2.646 seconds)

Gallery generated by Sphinx-Gallery