Skip to content

Commit

Permalink
Merge branch 'main' into release/0.13
Browse files Browse the repository at this point in the history
# Conflicts:
#	src/ansys/aedt/core/__init__.py
  • Loading branch information
Samuelopez-ansys committed Jan 15, 2025
2 parents d5de1b4 + 11e2fdd commit 62ad058
Show file tree
Hide file tree
Showing 311 changed files with 3,362 additions and 59,183 deletions.
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2021 - 2024 ANSYS, Inc. and/or its affiliates.
Copyright (c) 2021 - 2025 ANSYS, Inc. and/or its affiliates.

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
Expand Down
14 changes: 7 additions & 7 deletions doc/source/Getting_started/Installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ requires Ansys Electronics Desktop (AEDT) 2022 R1 or later. The AEDT Student Ver

Install from PyAEDT installer
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The following python script automatically installs PyAEDT from AEDT,
The following Python script automatically installs PyAEDT from AEDT,
using the CPython interpreter included in the AEDT installation.

In order to do that you can:
Expand All @@ -23,7 +23,7 @@ In order to do that you can:

- Open an Electronics Desktop Session and click on Tools->Run Script and execute the file.

- Offline install is also possible using wheelhouses.
- Offline installation is also possible using wheelhouses.

.. note::
A wheelhouse is a zip containing all needed packages that can be installed offline.
Expand Down Expand Up @@ -103,7 +103,7 @@ If you want to install the PyAEDT panels in the AEDT Automation tab, use the fol
pip install pyaedt[installer]
Finally, in the python console, run the following commands:
Finally, in the Python console, run the following commands:

.. code::
Expand All @@ -114,10 +114,10 @@ You can also install the PyAEDT panels using the following steps, this is also u

- Download the following file: :download:`PyAEDT panel Installer Python file <../Resources/toolkit_installer_from_aedt.py>`

- Define an environment variable called `PYAEDT_INTERPRETER` with the path of the python interpreter in which PyAEDT is installed.
- Define an environment variable called `PYAEDT_INTERPRETER` with the path of the Python interpreter in which PyAEDT is installed.

- Open an Electronics Desktop Session and click on Tools->Run Script and execute the file. You do not need the previous step if
you pass as an argument the path of the python interpreter.
you pass as an argument the path of the Python interpreter.


Linux support
Expand All @@ -141,7 +141,7 @@ From the `Releases <https://github.com/ansys/pyaedt/releases>`_
page in the PyAEDT repository, you can find the wheelhouses for a particular release in its
assets and download the wheelhouse specific to your setup.

There are two kind of wheelhouses: `all` and `installer`.
There are two kinds of wheelhouses: `all` and `installer`.

The `all` wheelhouse contains all PyAEDT dependencies. And the `installer` one includes `ipython` and `jupyter lab`.

Expand All @@ -160,7 +160,7 @@ If you want to add the PyAEDT panels in the AEDT Automation tab, you need first
pip install --no-cache-dir --no-index --find-links=file:///<path_to_wheelhouse>/PyAEDT-v<release_version>-wheelhouse-Windows-3.10 pyaedt[installer]
Finally, in the python console, run the following commands:
Finally, in the Python console, run the following commands:

.. code::
Expand Down
22 changes: 18 additions & 4 deletions doc/source/Resources/pyaedt_installer_from_aedt.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,20 @@


VENV_DIR_PREFIX = ".pyaedt_env"

"""
It is possible create Python virtual environment in a specific directory by setting variable VENV_DIR.
For example,
VENV_DIR = "e:/pyaedt_env"
"""
VENV_DIR = None
if not VENV_DIR:
if is_windows:
VENV_DIR = os.path.join(os.environ["APPDATA"], VENV_DIR_PREFIX)
else:
VENV_DIR = os.path.join(os.environ["HOME"], VENV_DIR_PREFIX)


DISCLAIMER = (
"This script will download and install certain third-party software and/or "
"open-source software (collectively, 'Third-Party Software'). Such Third-Party "
Expand Down Expand Up @@ -99,10 +113,10 @@ def run_pyinstaller_from_c_python(oDesktop):
# Add PyAEDT tabs in AEDT
# Virtual environment path and Python executable
if is_windows:
venv_dir = os.path.join(os.environ["APPDATA"], VENV_DIR_PREFIX, python_version_new)
venv_dir = os.path.join(VENV_DIR, python_version_new)
python_exe = os.path.join(venv_dir, "Scripts", "python.exe")
else:
venv_dir = os.path.join(os.environ["HOME"], VENV_DIR_PREFIX, python_version_new)
venv_dir = os.path.join(VENV_DIR, python_version_new)
python_exe = os.path.join(venv_dir, "bin", "python")
pyaedt_path = os.path.join(venv_dir, "Lib", "site-packages", "ansys", "aedt", "core")
if is_linux:
Expand Down Expand Up @@ -207,11 +221,11 @@ def install_pyaedt():
python_version = "3_7"

if is_windows:
venv_dir = Path(os.environ["APPDATA"], VENV_DIR_PREFIX, python_version)
venv_dir = Path(VENV_DIR, python_version)
python_exe = venv_dir / "Scripts" / "python.exe"
pip_exe = venv_dir / "Scripts" / "pip.exe"
else:
venv_dir = Path(os.environ["HOME"], VENV_DIR_PREFIX, python_version)
venv_dir = Path(VENV_DIR, python_version)
python_exe = venv_dir / "bin" / "python"
pip_exe = venv_dir / "bin" / "pip"
os.environ["ANSYSEM_ROOT{}".format(args.version)] = args.edt_root
Expand Down
12 changes: 6 additions & 6 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -54,17 +54,17 @@ unit-tests = [
"mock>=5.1.0,<5.2",
]
integration-tests = [
"matplotlib>=3.5.0,<3.10",
"matplotlib>=3.5.0,<3.11",
"mock>=5.1.0,<5.2",
"numpy>=1.20.0,<2.3",
"pandas>=1.1.0,<2.3",
"pytest>=7.4.0,<8.4",
"pytest-cov>=4.0.0,<6.1",
]
tests = [
"ipython>=7.30.0,<8.31",
"ipython>=7.30.0,<8.32",
"joblib>=1.0.0,<1.5",
"matplotlib>=3.5.0,<3.10",
"matplotlib>=3.5.0,<3.11",
"mock>=5.1.0,<5.2",
"numpy>=1.20.0,<2.3",
"openpyxl>=3.1.0,<3.3",
Expand Down Expand Up @@ -104,7 +104,7 @@ doc = [
"pyvista[io]>=0.38.0,<0.45",
]
all = [
"matplotlib>=3.5.0,<3.10",
"matplotlib>=3.5.0,<3.11",
"numpy>=1.20.0,<2.3",
"openpyxl>=3.1.0,<3.3",
"osmnx>=1.1.0,<2.1",
Expand All @@ -120,7 +120,7 @@ all = [
"utm",
]
installer = [
"matplotlib>=3.5.0,<3.10",
"matplotlib>=3.5.0,<3.11",
"numpy>=1.20.0,<2.3",
"openpyxl>=3.1.0,<3.3",
"osmnx>=1.1.0,<2.1",
Expand All @@ -134,7 +134,7 @@ installer = [
"SRTM.py",
"utm",
"jupyterlab>=3.6.0,<4.4",
"ipython>=7.30.0,<8.31",
"ipython>=7.30.0,<8.32",
"ipyvtklink>=0.2.0,<0.2.4",
]

Expand Down
2 changes: 1 addition & 1 deletion src/ansys/aedt/core/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
#
# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates.
# Copyright (C) 2021 - 2025 ANSYS, Inc. and/or its affiliates.
# SPDX-License-Identifier: MIT
#
#
Expand Down
2 changes: 1 addition & 1 deletion src/ansys/aedt/core/aedt_logger.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
#
# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates.
# Copyright (C) 2021 - 2025 ANSYS, Inc. and/or its affiliates.
# SPDX-License-Identifier: MIT
#
#
Expand Down
2 changes: 1 addition & 1 deletion src/ansys/aedt/core/application/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
#
# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates.
# Copyright (C) 2021 - 2025 ANSYS, Inc. and/or its affiliates.
# SPDX-License-Identifier: MIT
#
#
Expand Down
2 changes: 1 addition & 1 deletion src/ansys/aedt/core/application/aedt_file_management.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
#
# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates.
# Copyright (C) 2021 - 2025 ANSYS, Inc. and/or its affiliates.
# SPDX-License-Identifier: MIT
#
#
Expand Down
15 changes: 14 additions & 1 deletion src/ansys/aedt/core/application/aedt_objects.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
#
# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates.
# Copyright (C) 2021 - 2025 ANSYS, Inc. and/or its affiliates.
# SPDX-License-Identifier: MIT
#
#
Expand Down Expand Up @@ -81,6 +81,7 @@ def __init__(self, desktop=None, project=None, design=None, is_inherithed=False)
self._o_symbol_manager = None
self._opadstackmanager = None
self._oradfield = None
self._onetwork_data_explorer = None

@property
def oradfield(self):
Expand Down Expand Up @@ -429,3 +430,15 @@ def o_model_manager(self):
if not self._o_model_manager and self.odefinition_manager:
self._o_model_manager = self.odefinition_manager.GetManager("Model")
return self._o_model_manager

@property
def onetwork_data_explorer(self):
"""Network data explorer module.
References
----------
>>> oDesktop.GetTool("NdExplorer")
"""
if not self._onetwork_data_explorer:
self._onetwork_data_explorer = self._odesktop.GetTool("NdExplorer")
return self._onetwork_data_explorer
5 changes: 2 additions & 3 deletions src/ansys/aedt/core/application/analysis.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
#
# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates.
# Copyright (C) 2021 - 2025 ANSYS, Inc. and/or its affiliates.
# SPDX-License-Identifier: MIT
#
#
Expand Down Expand Up @@ -1542,7 +1542,6 @@ def get_setup(self, name):
def create_output_variable(self, variable, expression, solution=None, context=None):
"""Create or modify an output variable.
Parameters
----------
variable : str, optional
Expand Down Expand Up @@ -1644,7 +1643,7 @@ def get_object_material_properties(self, assignment=None, prop_names=None):

dict = {}
for entry in assignment:
mat_name = self.modeler[entry].material_name
mat_name = self.modeler[entry].material_name.casefold()
mat_props = self.materials.material_keys[mat_name]
if prop_names is None:
dict[entry] = mat_props._props
Expand Down
46 changes: 21 additions & 25 deletions src/ansys/aedt/core/application/analysis_3d.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
#
# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates.
# Copyright (C) 2021 - 2025 ANSYS, Inc. and/or its affiliates.
# SPDX-License-Identifier: MIT
#
#
Expand All @@ -27,6 +27,7 @@
import os

from ansys.aedt.core.application.analysis import Analysis
from ansys.aedt.core.generic.checks import min_aedt_version
from ansys.aedt.core.generic.configurations import Configurations
from ansys.aedt.core.generic.constants import unit_converter
from ansys.aedt.core.generic.general_methods import generate_unique_name
Expand Down Expand Up @@ -224,6 +225,7 @@ def components3d(self):
return components_dict

@pyaedt_function_handler(objects="assignment", export_path="output_file")
@min_aedt_version("2021.2")
def plot(
self,
assignment=None,
Expand Down Expand Up @@ -280,23 +282,20 @@ def plot(
:class:`ansys.aedt.core.generic.plot.ModelPlotter`
Model Object.
"""
if self._aedt_version < "2021.2":
self.logger.warning("Plot is supported from AEDT 2021 R2.")
else:
return self.post.plot_model_obj(
objects=assignment,
show=show,
export_path=output_file,
plot_as_separate_objects=plot_as_separate_objects,
plot_air_objects=plot_air_objects,
force_opacity_value=force_opacity_value,
clean_files=clean_files,
view=view,
show_legend=show_legend,
dark_mode=dark_mode,
show_bounding=show_bounding,
show_grid=show_grid,
)
return self.post.plot_model_obj(
objects=assignment,
show=show,
export_path=output_file,
plot_as_separate_objects=plot_as_separate_objects,
plot_air_objects=plot_air_objects,
force_opacity_value=force_opacity_value,
clean_files=clean_files,
view=view,
show_legend=show_legend,
dark_mode=dark_mode,
show_bounding=show_bounding,
show_grid=show_grid,
)

@pyaedt_function_handler(setup_name="setup", variation_string="variations")
def export_mesh_stats(self, setup, variations="", mesh_path=None):
Expand Down Expand Up @@ -1145,6 +1144,7 @@ def flatten_3d_components(self, components=None, purge_history=True, password=No
return True

@pyaedt_function_handler(object_name="assignment")
@min_aedt_version("2023.2")
def identify_touching_conductors(self, assignment=None):
# type: (str) -> dict
"""Identify all touching components and group in a dictionary.
Expand All @@ -1161,10 +1161,7 @@ def identify_touching_conductors(self, assignment=None):
dict
"""
if settings.aedt_version < "2023.2": # pragma: no cover
self.logger.error("This method requires CPython and PyVista.")
return {}
if settings.aedt_version >= "2023.2" and self.design_type == "HFSS": # pragma: no cover
if self.design_type == "HFSS": # pragma: no cover
nets_aedt = self.oboundary.IdentifyNets(True)
nets = {}
for net in nets_aedt[1:]:
Expand Down Expand Up @@ -1312,9 +1309,6 @@ def import_dxf(
import_method : int, bool
Whether the import method is ``Script`` or ``Acis``.
The default is ``1``, which means that the ``Acis`` is used.
sheet_bodies_2d : bool, optional
Whether importing as 2D sheet bodies causes imported objects to
be organized in terms of 2D sheets. The default is ``True``.
Returns
-------
Expand Down Expand Up @@ -1472,12 +1466,14 @@ def import_gds_3d(self, input_file: str, mapping_layers: dict, units: str = "um"
def _find_indices(self, list_to_check, item_to_find):
# type: (list, str|int) -> list
"""Given a list, returns the list of indices for all occurrences of a given element.
Parameters
----------
list_to_check: list
List to check.
item_to_find: str, int
Element to search for in the list.
Returns
-------
list
Expand Down
2 changes: 1 addition & 1 deletion src/ansys/aedt/core/application/analysis_3d_layout.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
#
# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates.
# Copyright (C) 2021 - 2025 ANSYS, Inc. and/or its affiliates.
# SPDX-License-Identifier: MIT
#
#
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
#
# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates.
# Copyright (C) 2021 - 2025 ANSYS, Inc. and/or its affiliates.
# SPDX-License-Identifier: MIT
#
#
Expand Down
2 changes: 1 addition & 1 deletion src/ansys/aedt/core/application/analysis_hf.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
#
# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates.
# Copyright (C) 2021 - 2025 ANSYS, Inc. and/or its affiliates.
# SPDX-License-Identifier: MIT
#
#
Expand Down
2 changes: 1 addition & 1 deletion src/ansys/aedt/core/application/analysis_icepak.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
#
# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates.
# Copyright (C) 2021 - 2025 ANSYS, Inc. and/or its affiliates.
# SPDX-License-Identifier: MIT
#
#
Expand Down
Loading

0 comments on commit 62ad058

Please sign in to comment.