Skip to content

About

Python interface to Ansys Result Explorer

Resources

Code of conduct

Contributing

Security policy

Stars

0 stars

Watchers

1 watching

Forks

PyResultExplorer

PyAnsys Python Apache

PyResultExplorer is a Python client library for Ansys Result Explorer, which is a tool to explore and visualize structural simulation results. With PyResultExplorer you can:

  • Launch a new or connect to an existing Result Explorer session
  • Automate and customize your Result Explorer post-processing workflows

Installation

For users

To install PyResultExplorer:

python -m pip install ansys-result-explorer-core

For developers

Installing PyResultExplorer in developer mode allows you to modify the source and enhance it.

Start by cloning this repository:

git clone https://github.com/ansys/pyresultexplorer

Create a fresh-clean Python environment and activate it:

# Create a virtual environment
uv venv

# Activate it in a POSIX system
source .venv/bin/activate

# Activate it in Windows
.venv\Scripts\activate

Install with latest required build system, doc, and testing dependencies:

uv sync --all-groups

The style checks take advantage of pre-commit. You can install it with pre-commit install.

Basic usage

The following code snippet shows how to launch a new Result Explorer instance, create a solution and load a displacement view.

import os
from ansys.result_explorer.core import launch_result_explorer

# Launch a new Result Explorer session
rx = launch_result_explorer()

# Create a solution from an APDL RST file
sol = rx.create_solution(
    name="PyRX Solution",
    file_path=os.path.join("tests", "data", "multiple_connections.rst"),
)

# Create a new workspace and load a displacement view
workspace = rx.create_workspace(name="PyRX Workspace")

views = sol.views
print("Views in solution:")
for v in views:
    print(f" - {v}")

view = next((v for v in views if "Displacement" in v.name), None)
viewport = workspace.assign_view(view=view, wait=True)

# Take a screenshot of the view and save to disk
snapshot_data = viewport.take_snapshot()

print("Saving snapshot to file...")
with open(view.name + ".png", "wb") as image_file:
    image_file.write(snapshot_data)

License

This project is licensed under the Apache 2.0 license agreement. See the LICENSE file for details.

Resources

For general PyAnsys questions, email pyansys-core@synopsys.com.

About

Python interface to Ansys Result Explorer

Resources

Code of conduct

Contributing

Security policy

Stars

0 stars

Watchers

1 watching

Forks

Releases

Used by

Contributors

Languages