Skip to content

Add custom Python operator and plugin tutorials #1890

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 45 commits into
base: doc/new-tutorials-section
Choose a base branch
from

Conversation

luisaFelixSalles
Copy link
Contributor

@luisaFelixSalles luisaFelixSalles commented Nov 13, 2024

Closes #1869

Add new tutorials to the enriching dpf capabilities Custom Operators and Plugins section:

  • It adapts some "how-tos" into this section
  • It changes some examples names

Tutorials added:

  • Create custom operators and plugins
  • Create a plug-in package with multiple operators
  • Create a plug-in package that has third-party dependencies

Preview on how it renders:

Custom Operators and Plugins section main page

image

Create custom operators and plugins tutorial

_D__ANSYSdev_pydpf-core_doc_build_html_user_guide_tutorials_custom_operators_and_plugins_custom_operators html

Create a plug-in package with multiple operators

_D__ANSYSdev_pydpf-core_doc_build_html_user_guide_tutorials_custom_operators_and_plugins_custom_plug_in_package html

Create a plug-in package that has third-party dependencies

_D__ANSYSdev_pydpf-core_doc_build_html_user_guide_tutorials_custom_operators_and_plugins_custom_plug_in_package_third_deps html

@luisaFelixSalles luisaFelixSalles self-assigned this Nov 13, 2024
@luisaFelixSalles luisaFelixSalles changed the title Add enriching dpf capabilities tutorials Add enriching dpf capabilities tutorials to the main tutorials branch Nov 13, 2024
Copy link

codecov bot commented Nov 13, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 84.05%. Comparing base (e17d70b) to head (62351fa).

✅ All tests successful. No failed tests found.

Additional details and impacted files
@@                      Coverage Diff                      @@
##           doc/new-tutorials-section    #1890      +/-   ##
=============================================================
- Coverage                      84.10%   84.05%   -0.05%     
=============================================================
  Files                             91       91              
  Lines                          10529    10529              
=============================================================
- Hits                            8855     8850       -5     
- Misses                          1674     1679       +5     

@luisaFelixSalles
Copy link
Contributor Author

luisaFelixSalles commented Nov 15, 2024

The tutorials section for Creating Custom DPF Operators and Plugins with Python should have a few tutorials:

  • Create a custom DPF plugin in Python
  • Create a custom DPF plugin in Python with third-party dependencies
  • Load and use a custom DPF plugin in PyDPF
  • Load and use a custom DPF plugin in Mechanical

Yes, i'll put in the PR description the tutorials that this section has. Because I actually put the "load" explanations into each tutorial

@luisaFelixSalles luisaFelixSalles mentioned this pull request Nov 15, 2024
36 tasks
@PProfizi PProfizi added the tutorials Related to PyDPF-Core tutorials label Nov 19, 2024
@PProfizi PProfizi removed their request for review November 19, 2024 15:00
@PProfizi PProfizi changed the title Add enriching dpf capabilities tutorials to the main tutorials branch Add custom Python operator and plugin tutorials Nov 19, 2024
@luisaFelixSalles luisaFelixSalles force-pushed the doc/new-tutorials-section branch from 576cd9f to 627c2de Compare December 19, 2024 16:42
@AnsMelanie AnsMelanie self-requested a review March 27, 2025 16:57
@PProfizi PProfizi requested a review from a team as a code owner June 12, 2025 10:20
================

In Ansys 2023 R1 and later, you can create custom operators in CPython. Creating custom operators
consists of wrapping Python routines in a DPF-compliant way so that you can access them in the same way
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
consists of wrapping Python routines in a DPF-compliant way so that you can access them in the same way
consists in wrapping Python routines in a DPF-compliant way so that you can access them in the same way


- **Accessibility:** A simple script can define a basic operator plugin.

- **Componentization:** Operators with similar applications can be grouped in Python plug-in packages.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

plugin or plug-in?

#. Run the downloaded script for installing with optional arguments:

- ``-awp_root``: Path to the Ansys root installation folder. For example, the 2023 R1 installation folder ends
with ``Ansys Inc/v231``, and the default environment variable is ``AWP_ROOT231``.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe update to a more recent version?

#. Run the downloaded script for uninstalling with the optional argument:

- ``-awp_root``: Path to the Ansys root installation folder. For example, the 2023 R1 installation folder ends
with ``Ansys Inc/v231``, and the default environment variable is ``AWP_ROOT231``.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same

----------------

Creating a basic operator plugin consists of writing a single Python script. An operator implementation
derives from the :class:`CustomOperatorBase <ansys.dpf.core.custom_operator.CustomOperatorBase>` class and a call to
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tutorials Related to PyDPF-Core tutorials
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants