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 91d92a2
Show file tree
Hide file tree
Showing 7 changed files with 36 additions and 36 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
29 changes: 17 additions & 12 deletions doc/source/user_guide/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,29 +4,34 @@
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:

.. code:: python
api = rocky.api
project = api.CreateProject()
rocky = pyrocky.launch_rocky()
project = rocky.api.CreateProject()

Check failure on line 16 in doc/source/user_guide/index.rst

View workflow job for this annotation

GitHub Actions / vale

[vale] doc/source/user_guide/index.rst#L16

[Google.Spacing] 'i.C' should have one space.
Raw output
{"message": "[Google.Spacing] 'i.C' should have one space.", "location": {"path": "doc/source/user_guide/index.rst", "range": {"start": {"line": 16, "column": 23}}}, "severity": "ERROR"}
study = project.GetStudy()

Check failure on line 17 in doc/source/user_guide/index.rst

View workflow job for this annotation

GitHub Actions / vale

[vale] doc/source/user_guide/index.rst#L17

[Google.Spacing] 't.G' should have one space.
Raw output
{"message": "[Google.Spacing] 't.G' should have one space.", "location": {"path": "doc/source/user_guide/index.rst", "range": {"start": {"line": 17, "column": 19}}}, "severity": "ERROR"}
study.SetName("My Study")

Check failure on line 18 in doc/source/user_guide/index.rst

View workflow job for this annotation

GitHub Actions / vale

[vale] doc/source/user_guide/index.rst#L18

[Google.Spacing] 'y.S' should have one space.
Raw output
{"message": "[Google.Spacing] 'y.S' should have one space.", "location": {"path": "doc/source/user_guide/index.rst", "range": {"start": {"line": 18, "column": 9}}}, "severity": "ERROR"}

Check warning on line 18 in doc/source/user_guide/index.rst

View workflow job for this annotation

GitHub Actions / vale

[vale] doc/source/user_guide/index.rst#L18

[Google.FirstPerson] Avoid first-person pronouns such as 'My'.
Raw output
{"message": "[Google.FirstPerson] Avoid first-person pronouns such as 'My'.", "location": {"path": "doc/source/user_guide/index.rst", "range": {"start": {"line": 18, "column": 20}}}, "severity": "WARNING"}
api.SaveProject("my-project.rocky"))

Check failure on line 19 in doc/source/user_guide/index.rst

View workflow job for this annotation

GitHub Actions / vale

[vale] doc/source/user_guide/index.rst#L19

[Google.Spacing] 'i.S' should have one space.
Raw output
{"message": "[Google.Spacing] 'i.S' should have one space.", "location": {"path": "doc/source/user_guide/index.rst", "range": {"start": {"line": 19, "column": 7}}}, "severity": "ERROR"}

Check warning on line 19 in doc/source/user_guide/index.rst

View workflow job for this annotation

GitHub Actions / vale

[vale] doc/source/user_guide/index.rst#L19

[Google.FirstPerson] Avoid first-person pronouns such as 'my'.
Raw output
{"message": "[Google.FirstPerson] Avoid first-person pronouns such as 'my'.", "location": {"path": "doc/source/user_guide/index.rst", "range": {"start": {"line": 19, "column": 22}}}, "severity": "WARNING"}
To view comprehensive PrePost API documentation, in the Rocky app, select
**Help > Manuals > API PrePost**.
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:

- ``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 91d92a2

Please sign in to comment.