Skip to content

Commit

Permalink
Update docs considering changes on Rocky 24R2
Browse files Browse the repository at this point in the history
- Explicit list PyRocky differences on GetTimeSet and GetCurves methods
- Use "PrePost Scripting" instead of "PrePost API" to refers to the
Rocky scripting feature (changed on 24R2)
- Fix the docstring content of launcher.py
- CONTRIBUTING.md now points to the PyRock Contributing section of
PyRocky Developer's Guide
- Adds a small intro to the Developer's guide index page and remove
the "How to Contribute" card (not something we want to highlight for
the casual user)
  • Loading branch information
igortg committed May 27, 2024
1 parent 3b5b30d commit bcbc652
Show file tree
Hide file tree
Showing 7 changed files with 38 additions and 33 deletions.
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Contributing

For contributing to this project, please refer to the [PyAnsys Developer's Guide].
For contributing to this project, please refer to the [PyRocky Developer's Guide].

[PyAnsys Developer's Guide]: https://dev.docs.pyansys.com/how-to/contributing.html
[PyRocky Developer's Guide]: https://rocky.docs.pyansys.com/version/dev/contributing.html
9 changes: 4 additions & 5 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,9 @@ PyRocky

|pyansys| |MIT| |python| |pypi| |codecov| |MIT| |black| |pre-commit|

PyRocky is a Python client library for remotely controlling
`Ansys Rocky <https://www.ansys.com/products/fluids/ansys-rocky>`_,
which is the most powerful software in the market for performing
DEM (discrete element method) simulations.
PyRocky is a Python client library to create, run and post-processing
particle dynamics simulations using `Ansys Rocky <https://www.ansys.com/products/fluids/ansys-rocky>`_,
the most powerful DEM (discrete element method) software in the market.

Documentation and issues
------------------------
Expand All @@ -19,7 +18,7 @@ The documentation has five sections:
- `Getting started <https://rocky.docs.pyansys.com/version/stable/getting_started/index.html>`_: Learn
how to install PyRocky in user mode and then launch it.
- `User guide <https://rocky.docs.pyansys.com/version/stable/user_guide/index.html>`_: Understand how to
use the Rocky PrePost API with PyRocky.
use the Rocky PrePost Scripting with PyRocky.
- `API reference <https://rocky.docs.pyansys.com/version/stable/api/index.html>`_: Understand PyRocky API
endpoints, their capabilities, and how to interact with them programmatically.
- `Examples <https://rocky.docs.pyansys.com/version/stable/examples/index.html>`_: Explore end-to-end
Expand Down
9 changes: 2 additions & 7 deletions doc/source/getting_started/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,6 @@
Getting started
===============

PyRocky is a Python client library for remotely controlling
`Ansys Rocky <https://www.ansys.com/products/fluids/ansys-rocky>`_,
which is the most powerful software in the market for performing
DEM (discrete element method) simulations.

Install PyRocky
---------------

Expand Down Expand Up @@ -51,9 +46,9 @@ Connect to an existing session

Assume that a Rocky session is started with the ``--pyrocky`` option:

.. code:: bat
.. code::
C:\Program Files\Ansys Inc\v241\Rocky> bin\Rocky.exe --pyrocky
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:

Expand Down
14 changes: 6 additions & 8 deletions doc/source/index.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
PyRocky
#######

PyRocky is a Python client library to create, run and post-processing
particle dynamics simulations using `Ansys Rocky <https://www.ansys.com/products/fluids/ansys-rocky>`_,
the most powerful DEM (discrete element method) software in the market.


.. grid:: 2
:gutter: 2 3 3 4

Expand All @@ -10,7 +16,6 @@ PyRocky

Learn how to install PyRocky in user mode and then launch it.


.. grid-item-card:: User guide :material-regular:`book`
:padding: 2 2 2 2
:link: user_guide/index
Expand All @@ -36,13 +41,6 @@ PyRocky

Explore end-to-end examples that show how to use PyRocky.

.. grid-item-card:: Contribute :fa:`people-group`
:padding: 2 2 2 2
:link: contributing
:link-type: doc

Learn how to contribute to the PyRocky codebase or documentation.

.. toctree::
:hidden:
:maxdepth: 3
Expand Down
28 changes: 19 additions & 9 deletions doc/source/user_guide/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,29 +4,39 @@
User guide
==========

Use the Rocky PrePost Scripting
-------------------------------

Use the Rocky PrePost API
-------------------------

Most of the Rocky PrePost API is available through the ``api`` object. For example,
the following code creates a project and saves it to disk:
In its current shape, PyRocky is a thin layer that enables remote calls to Rocky using the
PrePost Scripting API. This API is available through the ``RockyClient.api`` object. For
example, the following code creates a project and saves it to disk:

.. vale off
.. code:: python
rocky = pyrocky.launch_rocky()
api = rocky.api
project = api.CreateProject()
study = project.GetStudy()
study.SetName("My Study")
api.SaveProject("my-project.rocky"))
.. vale on
To view comprehensive PrePost Scripting documentation, in the Rocky app, select
**Help > Manuals > PrePost Scripting**.

Most methods of the PrePost Scripting, when called through PyRocky, works in the exact same way
they work in the Rocky built-in Python Shell. However, there are differences worth noting:

To view comprehensive PrePost API documentation, in the Rocky app, select
**Help > Manuals > API PrePost**.
- ``KAStudy.GetTimeSet``: on PyRocky this method returns a ``numpy.array`` of simulation time
steps in seconds (instead of a ``TimeSet`` object).
- ``KAElementItem.GetCurve``: this method is not supported by PyRocky. Use ``GetNumpyCurve`` to
get resulting curves from study entities.


Known issues
************
- When opened with the Rocky UI visible (non-headless mode), PyRocky cannot deal with confirmation
or error dialogs. For example, a call to the ``CloseProject()`` method asks for confirmation,
causing PyRocky to freeze until **OK** or **Cancel** is clicked in the Rocky UI.
- Some API methods may not work.
5 changes: 4 additions & 1 deletion src/ansys/rocky/core/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
"""Module with the client operations of Rocky."""
"""
Module that defines the RockyClient class, which act as a proxy for a Rocky application
session.
"""
from collections.abc import Callable, Generator
import pickle
from typing import Any, Final
Expand Down
2 changes: 1 addition & 1 deletion src/ansys/rocky/core/launcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
"""Module for launching operations of the Rocky backend."""
"""Module that exposes functions to launch Rocky application."""
import contextlib
import os
from pathlib import Path
Expand Down

0 comments on commit bcbc652

Please sign in to comment.