Getting started#
Install PyRocky#
To install PyRocky, run this command:
python -m pip install ansys-rocky-core
Launch PyRocky#
The best way to experiment with PyRocky is by using Jupyter Notebook
or Visual Studio Code. The following code launches a
headless Rocky session and returns a RockyClient
instance from which you can programmatically
interact with the software:
import ansys.rocky.core as pyrocky
rocky = pyrocky.launch_rocky()
You use the close()
method to close the Rocky session:
rocky.close()
If you want to launch the Rocky UI, set headless=False
:
rocky = pyrocky.launch_rocky(headless=False)
Connect to an existing session#
Assume that a Rocky session is started with the --pyrocky
option:
C:\Program Files\Ansys Inc\v242\Rocky\bin\Rocky.exe --pyrocky
When the Rocky session is started in this way, you can connect to it with PyRocky:
import ansys.rocky.core as pyrocky
rocky = pyrocky.connect_to_rocky()