Skip to content

Commit

Permalink
Migration common toolkit (#193)
Browse files Browse the repository at this point in the history
* migration first part

* customize UI

* customize UI

* customize UI

* post-processing ui

* post-processing ui

* json to toml

* fixes

* fixes

* run pre-commit and update pre-commit-config.yaml

* segmentation and skew buttons

* improve ui and icons

* migration

* fix tests

* fix doc

* last thing of migration + export faces

* fix tests

* fix common_api.rst

* fix doc

* fix examples

* fix example

* add images

* WIP: test conftest fix

* update toml

* Update pyproject.toml

* WIP: Leverage toolkits-common dependencies

* fix apply_skew_test

* fix test validate

* FIX: Typo in README.rst

* improve doc

* update toml

* clean user guide

* update run_toolkit.py

---------

Co-authored-by: Sebastien Morais <[email protected]>
Co-authored-by: Sébastien Morais <[email protected]>
  • Loading branch information
3 people authored May 13, 2024
1 parent a06dad6 commit 5720cef
Show file tree
Hide file tree
Showing 81 changed files with 3,743 additions and 4,473 deletions.
3 changes: 2 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ exclude: |
(?x)(
src/ansys/aedt/toolkits/magnet_segmentation/ui/common/frontend_ui.py |
tests/input_data/.* |
examples/input_files/.*
examples/input_files/.* |
src/ansys/aedt/toolkits/magnet_segmentation/ui/windows/.*
)
repos:
Expand Down
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# Contributing

We absolutely welcome any code contributions and we hope that this
guide will facilitate an understanding of the Magnet Segmentation Toolkit
guide will facilitate an understanding of the Magnet Segmentation ToolkitBackend
code repository. It is important to note that while the Magnet Segmentation
Toolkit software package is maintained by ANSYS and any submissions will be
ToolkitBackend software package is maintained by ANSYS and any submissions will be
reviewed thoroughly before merging, we still seek to foster a community that can
support user questions and develop new features to make this software
a useful tool for all users. As such, we welcome and encourage any
Expand Down
16 changes: 8 additions & 8 deletions README.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Magnet Segmentation Toolkit
===========================
Magnet Segmentation ToolkitBackend
==================================

|pyansys| |PythonVersion| |GH-CI| |MIT| |black|

Expand All @@ -22,7 +22,7 @@ Magnet Segmentation Toolkit

.. reuse_start
The Magnet Segmentation Toolkit is a Python wrapper for automating the segmentation
The Magnet Segmentation ToolkitBackend is a Python wrapper for automating the segmentation
and skew of interior permanent magnet (IPM) and surface permanent magnet (SPM)
motors using Ansys Electronics Desktop (AEDT). You can launch this toolkit
from the AEDT UI or launch it directly from a Python console.
Expand All @@ -31,25 +31,25 @@ Requirements
~~~~~~~~~~~~
In addition to the runtime dependencies listed in
`Getting started <https://magnet.segmentation.toolkit.docs.pyansys.com/version/stable/Getting_started.html>`_,
the Magnet Segmentation Toolkit requires AEDT 2023 R1 or later. This toolkit also supports the AEDT
the Magnet Segmentation ToolkitBackend requires AEDT 2023 R1 or later. This toolkit also supports the AEDT
Student Version for 2023 R1 or later.

Documentation and issues
~~~~~~~~~~~~~~~~~~~~~~~~
Documentation for the latest stable release of the Magnet Segmentation Toolkit is hosted at
`Magnet Segmentation Toolkit documentation <https://magnet.segmentation.toolkit.docs.pyansys.com/version/stable/index.html>`_.
Documentation for the latest stable release of the Magnet Segmentation ToolkitBackend is hosted at
`Magnet Segmentation ToolkitBackend documentation <https://magnet.segmentation.toolkit.docs.pyansys.com/version/stable/index.html>`_.

In the upper right corner of the documentation's title bar, there is an option for switching from
viewing the documentation for the latest stable release to viewing the documentation for the
development version or previously released versions.

On the `Magnet Segmentation Toolkit Issues <https://github.com/ansys/magnet-segmentation-toolkit/issues>`_
On the `Magnet Segmentation ToolkitBackend Issues <https://github.com/ansys/magnet-segmentation-toolkit/issues>`_
page, you can create issues to report bugs and request new features. On the `Discussions <https://discuss.ansys.com/>`_
page on the Ansys Developer portal, you can post questions, share ideas, and get community feedback.

License
~~~~~~~
The Magnet Segmentation Toolkit is licensed under the MIT license.
The Magnet Segmentation ToolkitBackend is licensed under the MIT license.

This toolkit makes no commercial claim over Ansys whatsoever. The use of this toolkit
requires a legally licensed copy of AEDT. For more information, see the
Expand Down
4 changes: 2 additions & 2 deletions doc/source/Contributing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ Use the `Magnet Segmentation Toolkit Issues <https://github.com/ansys/magnet-seg
to create issues to report bugs and request new features.

View documentation
-------------------
Documentation for the latest stable release is hosted at `Magnet Segmentation Toolkit documentation <https://magnet.segmentation.toolkit.docs.pyansys.com/version/stable/>`_.
------------------
Documentation for the latest stable release is hosted at `Magnet Segmentation Toolkit Documentation <https://magnet.segmentation.toolkit.docs.pyansys.com/version/stable/>`_.

In the upper right corner of the documentation's title bar, there is an option for switching from viewing
the documentation for the latest stable release to viewing the documentation for the development version
Expand Down
167 changes: 0 additions & 167 deletions doc/source/Getting_started.rst

This file was deleted.

66 changes: 36 additions & 30 deletions doc/source/Toolkit/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,33 +19,39 @@ automating the segmentation and skew of a 3D motor.

Toolkit

This code shows how to use the ``Toolkit`` class:

.. code:: python
# Import required modules and backend
from ansys.aedt.toolkits.magnet_segmentation.backend.api import Toolkit
# Initialize generic service
toolkit = Toolkit()
# Get the default properties loaded from JSON file
properties = toolkit.get_properties()
# Set properties
new_properties = {"aedt_version": "2023.2"}
toolkit.set_properties(new_properties)
properties = toolkit.get_properties()
# Launch AEDT
msg = toolkit.launch_aedt()
# Wait for the toolkit thread to be idle
toolkit.wait_to_be_idle()
# Segment and skew motor
toolkit.segmentation()
toolkit.apply_skew()
# Release AEDT
toolkit.release_aedt()
This code shows how to use the ``ToolkitBackend`` class:

.. code:: python
# Import required modules and backend
from ansys.aedt.toolkits.magnet_segmentation.backend.api import ToolkitBackend
# Initialize generic service
toolkit = ToolkitBackend()
# Get the default properties loaded from JSON file
properties = toolkit.get_properties()
# Set properties
aedt_file = os.path.join(common_temp_dir, "input_data", f"{PROJECT_NAME}.aedt")
new_properties = {
"aedt_version": "2024.1",
"non_graphical": True,
"active_project": aedt_file,
"active_design": DESIGN_NAME,
"design_list": {PROJECT_NAME: [DESIGN_NAME]},
"use_grpc": config["use_grpc"],
}
toolkit.set_properties(new_properties)
# Launch AEDT and open project
msg = toolkit.launch_aedt()
toolkit.open_project(aedt_file)
toolkit.connect_design("Maxwell3D")
# Segment and skew motor
toolkit.segmentation()
toolkit.apply_skew()
# Release AEDT
toolkit.release_aedt()
43 changes: 0 additions & 43 deletions doc/source/Toolkit/common_api.rst

This file was deleted.

7 changes: 1 addition & 6 deletions doc/source/Toolkit/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
API reference
=============

This section provides descriptions of the two APIs available for the Magnet
This section provides descriptions of the available API for the Magnet
Segmentation Toolkit:

- **Toolkit API**: Contains the ``Toolkit`` class, which provides methods for
Expand All @@ -19,12 +19,7 @@ Segmentation Toolkit:
- For segmentation, ``SymmetryFactor`` and ``HalfAxial`` design settings must be defined.
- For skew, ``Shaft`` must be the name of the shaft.

- **AEDT Common Toolkit API**: Contains the ``AEDTCommonToolkit`` class, which provides basic
functions for controlling AEDT that are shared between the backend and frontend.
These functions are the same for all AEDT toolkits.

.. toctree::
:maxdepth: 2

api
common_api
Loading

0 comments on commit 5720cef

Please sign in to comment.