Skip to content

Commit

Permalink
DOCS: Extensions (#5138)
Browse files Browse the repository at this point in the history
Co-authored-by: Sébastien Morais <146729917+SMoraisAnsys@users.noreply.github.com>
  • Loading branch information
gmalinve and SMoraisAnsys authored Sep 6, 2024
1 parent b39bf82 commit a90d958
Show file tree
Hide file tree
Showing 5 changed files with 87 additions and 14 deletions.
8 changes: 5 additions & 3 deletions doc/source/Getting_started/Installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,13 @@ Extension manager
The user can install or uninstall automated workflows using the extension manager.
There are three options:

- Custom PyAEDT scripts.
- **Pre-installed extensions** already available in the PyAEDT library.

- Existing workflows in the PyAEDT library.
- **Open source PyAEDT toolkits** described in the `PyAEDT Common Toolkit documentation <https://aedt.common.toolkit.docs.pyansys.com/>`_.

- Open source PyAEDT toolkits described in the `PyAEDT Common Toolkit documentation <https://aedt.common.toolkit.docs.pyansys.com/>`_.
- **Custom PyAEDT extensions**.

See `Extension Manager <https://aedt.docs.pyansys.com/version/stable/User_guide/extensions.html>`_ for more information.

.. image:: ../Resources/toolkit_manager_1.png
:width: 800
Expand Down
Binary file added doc/source/Resources/my_custom_extension.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/source/Resources/my_custom_extension_1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified doc/source/Resources/toolkit_manager_1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
93 changes: 82 additions & 11 deletions doc/source/User_guide/extensions.rst
Original file line number Diff line number Diff line change
@@ -1,18 +1,23 @@
Extensions
==========
Extension manager
=================

Extensions provide a simplified interface to perform automated workflows in AEDT.
In AEDT, you can use the Extension Manager to add or remove extensions.
For more information, see `Extension Manager <https://aedt.docs.pyansys.com/version/stable/Getting_started/Installation.html#extension-manager>`_.
Extensions provide a simplified interface to perform automated workflows in AEDT, they are generally tool-specific and are therefore only accessible given the appropriate context.
In AEDT, you can use the `Extension manager <https://aedt.docs.pyansys.com/version/stable/Getting_started/Installation.html#extension-manager>`_ to add or remove extensions.
The Extension manager allows the user to install three different types of extensions:

Extensions are generally tool-specific and are therefore only accessible given the appropriate context. The following sections provide further clarification.
- **Pre-installed extensions** available at project level.
- **Open source PyAEDT toolkits** available at application level.
- **Custom extensions** installable both at project and application level.

The following sections provide further clarification.

You can launch extensions in standalone mode from the console or a Python script.

Project extensions
==================
Pre-installed extensions
~~~~~~~~~~~~~~~~~~~~~~~~

Project extension apply to all extensions that are applicable for all AEDT applications.
Pre-installed extensions are available at project level so they are available for all AEDT applications.
They are small automated workflow with a simple UI.

.. grid:: 2

Expand Down Expand Up @@ -53,8 +58,74 @@ Project extension apply to all extensions that are applicable for all AEDT appli
pyaedt_extensions_doc/project

HFSS extensions
===============
---------------


HFSS 3D Layout extensions
=========================
-------------------------


Open source toolkits
~~~~~~~~~~~~~~~~~~~~

Open source toolkits are available at application level.
They are complex workflows where backend and frontend are split.
They are also fully documented and tested.

Here are some links to existing toolkits:
- Hfss: `Antenna Wizard <https://github.com/ansys/pyaedt-toolkits-antenna>`_.
- Maxwell 3D: `Magnet Segmentation Wizard <https://github.com/ansys/magnet-segmentation-toolkit>`_.

Custom extensions
~~~~~~~~~~~~~~~~~

Custom extensions are custom workflows (Python script) that can be installed both at project and application level.
From the Extension manager select the target destination:

.. image:: ../Resources/toolkit_manager_1.png
:width: 500
:alt: PyAEDT toolkit manager 1

Select `Custom` as the extension type.
Provide the path of the Python script containing the workflow.
Enter the extension name. This is the name that appears beneath the button in the Automation tab after a successful installation.

.. image:: ../Resources/my_custom_extension.png
:width: 500
:alt: Custom Extension

After the normal completion of the installation a new button appears:

.. image:: ../Resources/my_custom_extension_1.png
:width: 500
:alt: Custom Extension 1

The example below is a simple example of custom extension.
The Python script requires a common initial part to define the port and the version of the AEDT session to connect to.

.. code:: python
import ansys.aedt.core
import os
# common part
if "PYAEDT_SCRIPT_PORT" in os.environ and "PYAEDT_SCRIPT_VERSION" in os.environ:
port = os.environ["PYAEDT_SCRIPT_PORT"]
version = os.environ["PYAEDT_SCRIPT_VERSION"]
else:
port = 0
version = "2024.2"
# your pyaedt script
app = ansys.aedt.core.Desktop(new_desktop_session=False, specified_version=version, port=port)
active_project = app.active_project()
active_design = app.active_design(active_project)
# no need to hardcode you application but get_pyaedt_app will detect it for you
aedtapp = ansys.aedt.core.get_pyaedt_app(design_name=active_design.GetName(), desktop=app)
# your workflow
aedtapp.modeler.create_sphere([0, 0, 0], 20)
app.release_desktop(False, False)

0 comments on commit a90d958

Please sign in to comment.