Skip to content

Commit

Permalink
Merge branch 'main' into refactor/improve-vulnerability-handling-in-w…
Browse files Browse the repository at this point in the history
…orkflows
  • Loading branch information
SMoraisAnsys authored Nov 8, 2024
2 parents a1e4f51 + e580d7a commit d4b62d0
Show file tree
Hide file tree
Showing 33 changed files with 2,050 additions and 1,129 deletions.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ body:
- '3.9'
- '3.10'
- '3.11'
- 'IronPython'
- '3.12'
validations:
required: true

Expand Down
3 changes: 0 additions & 3 deletions .github/workflows/ci_cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@ env:
MAIN_PYTHON_VERSION: '3.10'
PACKAGE_NAME: 'PyAEDT'
DOCUMENTATION_CNAME: 'aedt.docs.pyansys.com'
MEILISEARCH_API_KEY: ${{ secrets.MEILISEARCH_API_KEY }}
MEILISEARCH_HOST_URL: ${{ vars.MEILISEARCH_HOST_URL }}
MEILISEARCH_PUBLIC_API_KEY: ${{ secrets.MEILISEARCH_PUBLIC_API_KEY }}
ON_CI: True
PYTEST_ARGUMENTS: '-vvv --color=yes -ra --durations=25 --maxfail=10 --cov=ansys.aedt.core --cov-report=html --cov-report=xml --junitxml=junit/test-results.xml'

Expand Down
3 changes: 0 additions & 3 deletions .github/workflows/nightly-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@ env:
ANSYSLMD_LICENSE_FILE: ${{ format('1055@{0}', secrets.LICENSE_SERVER) }}
MAIN_PYTHON_VERSION: '3.10'
DOCUMENTATION_CNAME: 'aedt.docs.pyansys.com'
MEILISEARCH_API_KEY: ${{ secrets.MEILISEARCH_API_KEY }}
MEILISEARCH_HOST_URL: ${{ vars.MEILISEARCH_HOST_URL }}
MEILISEARCH_PUBLIC_API_KEY: ${{ secrets.MEILISEARCH_PUBLIC_API_KEY }}

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
Expand Down
10 changes: 5 additions & 5 deletions doc/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -291,11 +291,11 @@ def setup(app):
},
"collapse_navigation": True,
"navigation_with_keys": True,
"use_meilisearch": {
"api_key": os.getenv("MEILISEARCH_PUBLIC_API_KEY", ""),
"index_uids": {
f"pyaedt-v{get_version_match(__version__).replace('.', '-')}": "PyAEDT",
},
"static_search": {
"threshold": 0.5,
"minMatchCharLength": 2,
"limite": 10,
"ignoreLocation": True,
},
}

Expand Down
10 changes: 4 additions & 6 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ dependencies = [
[project.optional-dependencies]
unit-tests = [
"pytest>=7.4.0,<8.4",
"pytest-cov>=4.0.0,<5.1",
"pytest-cov>=4.0.0,<6.1",
"mock>=5.1.0,<5.2",
]
tests = [
Expand All @@ -61,7 +61,7 @@ tests = [
"osmnx>=1.1.0,<1.10",
"pandas>=1.1.0,<2.3",
"pytest>=7.4.0,<8.4",
"pytest-cov>=4.0.0,<5.1",
"pytest-cov>=4.0.0,<6.1",
"pytest-xdist>=3.5.0,<3.7",
"pyvista[io]>=0.38.0,<0.45",
# Never directly imported but required when loading ML related file see #4713
Expand All @@ -77,9 +77,8 @@ dotnet = [
"dotnetcore2==3.1.23; platform_system=='Linux'",
"pywin32>=303; platform_system=='Windows'",
]

doc = [
"ansys-sphinx-theme>=0.10.0,<1.1",
"ansys-sphinx-theme>=1.0.0,<1.3",
"numpydoc>=1.5.0,<1.9",
"recommonmark",
"Sphinx>=7.1.0,<8.2",
Expand All @@ -91,7 +90,6 @@ doc = [
"sphinx_design>=0.4.0,<0.7",
"pyvista[io]>=0.38.0,<0.45",
]

all = [
"matplotlib>=3.5.0,<3.10",
"numpy>=1.20.0,<2",
Expand All @@ -118,7 +116,7 @@ installer = [
"scikit-rf>=0.30.0,<1.4",
"SRTM.py",
"utm",
"jupyterlab>=3.6.0,<4.3",
"jupyterlab>=3.6.0,<4.4",
"ipython>=7.30.0,<8.30",
"ipyvtklink>=0.2.0,<0.2.4",
]
Expand Down
1 change: 1 addition & 0 deletions src/ansys/aedt/core/application/design.py
Original file line number Diff line number Diff line change
Expand Up @@ -3132,6 +3132,7 @@ def change_validation_settings(
----------
entity_check_level : str, optional
Entity check level. The default is ``"Strict"``.
Options are ``"Strict"``, ``"Basic"``, ``"Warning Only"``, ``"None"``.
ignore_unclassified : bool, optional
Whether to ignore unclassified elements. The default is ``False``.
skip_intersections : bool, optional
Expand Down
2 changes: 1 addition & 1 deletion src/ansys/aedt/core/filtersolutions_core/export_to_aedt.py
Original file line number Diff line number Diff line change
Expand Up @@ -1310,7 +1310,7 @@ def substrate_resistivity(self, substrate_input):
ansys.aedt.core.filtersolutions_core._dll_interface().raise_error(status)

@property
def substrate_loss_tangent(self) -> Union[SubstrateType, str]:
def substrate_loss_tangent(self) -> Union[SubstrateEr, str]:
"""Substrate's loss tangent.
The value can be either a string or an instance of the ``SubstrateEr`` enum.
The default is ``0.0005`` for ``SubstrateEr.ALUMINA``.
Expand Down
71 changes: 1 addition & 70 deletions src/ansys/aedt/core/hfss.py
Original file line number Diff line number Diff line change
Expand Up @@ -3508,75 +3508,6 @@ def assign_lumped_rlc_to_sheet(
return self._create_boundary(name, props, "Lumped RLC")
return False

@pyaedt_function_handler(sheet_name="assignment", sourcename="name", is_infground="is_inifinite_ground")
def assign_impedance_to_sheet(self, assignment, name=None, resistance=50, reactance=0, is_inifinite_ground=False):
"""Create an impedance taking one sheet.
Parameters
----------
assignment : str or list
One or more names of the sheets to apply the boundary to.
name : str, optional
Name of the impedance. The default is ``None``.
resistance : optional
Resistance value in ohms. The default is ``50``. If ``None``,
this parameter is disabled.
reactance : optional
Reactance value in ohms. The default is ``0``. If ``None``,
this parameter is disabled.
is_inifinite_ground : bool, optional
Whether the impedance is an infinite ground. The default is ``False``.
Returns
-------
:class:`ansys.aedt.core.modules.boundary.BoundaryObject`
Boundary object if successful, ``False`` otherwise.
References
----------
>>> oModule.AssignImpedance
Examples
--------
Create a sheet and use it to create an impedance.
>>> sheet = hfss.modeler.create_rectangle(hfss.PLANE.XY,
... [0, 0, -90], [10, 2], name="ImpedanceSheet",
... material="Copper")
>>> impedance_to_sheet = hfss.assign_impedance_to_sheet(sheet.name,"ImpedanceFromSheet",100,50)
>>> type(impedance_to_sheet)
<class 'from ansys.aedt.core.modules.boundary.BoundaryObject'>
"""

if self.solution_type in ["Modal", "Terminal", "Transient Network"]:
if not name:
name = generate_unique_name("Imped")
elif name in self.modeler.get_boundaries_name():
name = generate_unique_name(name)

objects = self.modeler.convert_to_selections(assignment, True)

props = dict(
{
"Faces": objects,
}
)
if isinstance(objects[0], str):
props = dict(
{
"Objects": objects,
}
)
props["Resistance"] = str(resistance)
props["Reactance"] = str(reactance)
props["InfGroundPlane"] = is_inifinite_ground

return self._create_boundary(name, props, "Impedance")
return False

@pyaedt_function_handler(
sheet_name="assignment", sourcename="name", is_infground="is_infinite_ground", reference_cs="coordinate_system"
)
Expand Down Expand Up @@ -3643,7 +3574,7 @@ def assign_impedance_to_sheet(
"""

if self.solution_type in ["Modal", "Terminal", "Transient Network"]:
if self.solution_type in ["Modal", "Terminal", "Transient Network", "Eigenmode"]:
if not name:
name = generate_unique_name("Imped")
elif name in self.modeler.get_boundaries_name():
Expand Down
8 changes: 4 additions & 4 deletions src/ansys/aedt/core/modeler/cad/primitives.py
Original file line number Diff line number Diff line change
Expand Up @@ -4777,6 +4777,7 @@ def import_3d_cad(
reduce_percentage=0,
reduce_error=0,
merge_planar_faces=True,
merge_angle=0.02,
):
"""Import a CAD model.
Expand All @@ -4787,9 +4788,6 @@ def import_3d_cad(
healing : bool, optional
Whether to perform healing. The default is ``False``, in which
case healing is not performed.
healing : int, optional
Whether to perform healing. The default is ``0``, in which
case healing is not performed.
refresh_all_ids : bool, optional
Whether to refresh all IDs after the CAD file is loaded. The
default is ``True``. Refreshing IDs can take a lot of time in
Expand Down Expand Up @@ -4818,6 +4816,8 @@ def import_3d_cad(
Stl error percentage during reduce operation. Default is ``0``.
merge_planar_faces : bool, optional
Stl automatic planar face merge during import. Default is ``True``.
merge_angle : float, optional
Stl import angle in radians for which faces will be considered planar. Default is ``2e-2``.
Returns
-------
Expand All @@ -4844,7 +4844,7 @@ def import_3d_cad(
vArg1.append("CreateGroup:="), vArg1.append(create_group)
vArg1.append("STLFileUnit:="), vArg1.append("Auto")
vArg1.append("MergeFacesAngle:="), vArg1.append(
0.02 if input_file.endswith(".stl") and merge_planar_faces else -1
merge_angle if input_file.endswith(".stl") and merge_planar_faces else -1
)
if input_file.endswith(".stl"):
vArg1.append("HealSTL:="), vArg1.append(heal_stl)
Expand Down
11 changes: 8 additions & 3 deletions src/ansys/aedt/core/modeler/modeler_3d.py
Original file line number Diff line number Diff line change
Expand Up @@ -1042,6 +1042,7 @@ def import_nastran(
enable_planar_merge="True",
save_only_stl=False,
preview=False,
merge_angle=1e-3,
):
"""Import Nastran file into 3D Modeler by converting the faces to stl and reading it. The solids are
translated directly to AEDT format.
Expand Down Expand Up @@ -1070,10 +1071,13 @@ def import_nastran(
Whether to import the model in HFSS or only generate the stl file.
preview : bool, optional
Whether to preview the model in pyvista or skip it.
merge_angle : float, optional
Angle in radians for which faces will be considered planar. Default is ``1e-3``.
Returns
-------
List of :class:`ansys.aedt.core.modeler.Object3d.Object3d`
List of :class:`ansys.aedt.core.modeler.Object3d.Object3d`, dict
New object created and nastran dictionary.
"""
autosave = (
True if self._app.odesktop.GetRegistryInt("Desktop/Settings/ProjectOptions/DoAutoSave") == 1 else False
Expand All @@ -1089,7 +1093,7 @@ def import_nastran(
preview=preview,
)
if save_only_stl:
return output_stls
return output_stls, nas_to_dict

self._app.desktop_class.close_windows()
self.logger.info("Importing STL in 3D Modeler")
Expand All @@ -1100,6 +1104,7 @@ def import_nastran(
create_lightweigth_part=import_as_light_weight,
healing=False,
merge_planar_faces=enable_stl_merge,
merge_angle=merge_angle,
)
self.logger.info(f"Model {os.path.split(output_stl)[-1]} imported")
self._app.save_project()
Expand Down Expand Up @@ -1202,7 +1207,7 @@ def import_nastran(
self._app.oproject.SetActiveDesign(self._app.design_name)
self._app.odesktop.EnableAutoSave(autosave)
self.logger.info_timer("Nastran model correctly imported.")
return new_objects
return new_objects, nas_to_dict

@pyaedt_function_handler()
def import_from_openstreet_map(
Expand Down
Loading

0 comments on commit d4b62d0

Please sign in to comment.