Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
ca57742
Add WavePortObject class
eblanco-ansys Sep 1, 2025
4d1264e
Use WavePortObject for waveports
eblanco-ansys Sep 1, 2025
363abb2
CHORE: Auto fixes from pre-commit hooks
pre-commit-ci[bot] Sep 1, 2025
f6a330d
chore: adding changelog file 6595.added.md [dependabot-skip]
pyansys-ci-bot Sep 2, 2025
0d21f95
Added set mode polarity using integration lines
eblanco-ansys Sep 2, 2025
836fb27
Add filter mode reporter property + specify wave direction
eblanco-ansys Sep 2, 2025
842b891
Merge branch 'feat/waveport_object_alignment' of https://github.com/a…
eblanco-ansys Sep 2, 2025
92c1242
CHORE: Auto fixes from pre-commit hooks
pre-commit-ci[bot] Sep 2, 2025
c31e54f
Added properties
eblanco-ansys Sep 3, 2025
0327f47
Added tests
eblanco-ansys Sep 3, 2025
8c75251
Merge branch 'feat/waveport_object_alignment' of https://github.com/a…
eblanco-ansys Sep 3, 2025
53411f6
Merge branch 'main' into feat/waveport_object_alignment
eblanco-ansys Sep 3, 2025
0291e36
CHORE: Auto fixes from pre-commit hooks
pre-commit-ci[bot] Sep 3, 2025
509f780
Merge branch 'main' into feat/waveport_object_alignment
eblanco-ansys Sep 3, 2025
dc9160b
Fixed line issue
eblanco-ansys Sep 3, 2025
78a2e17
CHORE: Auto fixes from pre-commit hooks
pre-commit-ci[bot] Sep 3, 2025
19bdf2e
chore: adding changelog file 6595.added.md [dependabot-skip]
pyansys-ci-bot Sep 3, 2025
1bb0a56
Merge branch 'main' into feat/waveport_object_alignment
eblanco-ansys Sep 5, 2025
c9a41c8
Merge branch 'main' into feat/waveport_object_alignment
eblanco-ansys Sep 5, 2025
c50212e
Tests run in one single HFSS design
eblanco-ansys Sep 5, 2025
eb8098f
Fixed waveguide orientation
eblanco-ansys Sep 5, 2025
ffe8efe
Merge branch 'main' into feat/waveport_object_alignment
eblanco-ansys Sep 5, 2025
8231a9f
Add Enum
Samuelopez-ansys Sep 16, 2025
2bee40c
Merge branch 'main' into feat/waveport_object_alignment
Samuelopez-ansys Sep 16, 2025
94f5969
Fix Waveport
Samuelopez-ansys Sep 16, 2025
ba441ab
Fix some properties
Samuelopez-ansys Sep 17, 2025
78ca59b
Fix some properties
Samuelopez-ansys Sep 17, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions doc/changelog.d/6595.added.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Waveport object advanced config
4 changes: 2 additions & 2 deletions src/ansys/aedt/core/application/analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -666,7 +666,7 @@ def design_excitations(self):
>>> oModule.GetExcitations
"""
exc_names = self.excitation_names[::]

exc_names = list(dict.fromkeys(s.split(":", 1)[0] for s in exc_names))
for el in self.boundaries:
if el.name in exc_names:
self._excitation_objects[el.name] = el
Expand All @@ -675,7 +675,7 @@ def design_excitations(self):
keys_to_remove = [
internal_excitation
for internal_excitation in self._excitation_objects
if internal_excitation not in self.excitation_names
if internal_excitation not in self.excitation_names and internal_excitation not in exc_names
]

for key in keys_to_remove:
Expand Down
3 changes: 3 additions & 0 deletions src/ansys/aedt/core/application/design.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@
from ansys.aedt.core.internal.errors import GrpcApiError
from ansys.aedt.core.internal.load_aedt_file import load_entire_aedt_file
from ansys.aedt.core.modules.boundary.common import BoundaryObject
from ansys.aedt.core.modules.boundary.hfss_boundary import WavePort
from ansys.aedt.core.modules.boundary.icepak_boundary import NetworkObject
from ansys.aedt.core.modules.boundary.layout_boundary import BoundaryObject3dLayout
from ansys.aedt.core.modules.boundary.maxwell_boundary import MaxwellParameters
Expand Down Expand Up @@ -511,6 +512,8 @@ def boundaries(self) -> List[BoundaryObject]:
self._boundaries[boundary] = BoundaryObject(self, boundary, boundarytype=maxwell_motion_type)
elif boundarytype == "Network":
self._boundaries[boundary] = NetworkObject(self, boundary)
elif boundarytype == "Wave Port":
self._boundaries[boundary] = WavePort(self, boundary)
else:
self._boundaries[boundary] = BoundaryObject(self, boundary, boundarytype=boundarytype)

Expand Down
68 changes: 46 additions & 22 deletions src/ansys/aedt/core/hfss.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@

"""This module contains the ``Hfss`` class."""

from enum import Enum
import math
from pathlib import Path
import tempfile
Expand All @@ -48,6 +49,7 @@
from ansys.aedt.core.generic.numbers_utils import is_number
from ansys.aedt.core.generic.settings import settings
from ansys.aedt.core.internal.errors import AEDTRuntimeError
from ansys.aedt.core.internal.errors import GrpcApiError
from ansys.aedt.core.mixins import CreateBoundaryMixin
from ansys.aedt.core.modeler import cad
from ansys.aedt.core.modeler.cad.component_array import ComponentArray
Expand All @@ -56,10 +58,19 @@
from ansys.aedt.core.modules.boundary.common import BoundaryObject
from ansys.aedt.core.modules.boundary.hfss_boundary import FarFieldSetup
from ansys.aedt.core.modules.boundary.hfss_boundary import NearFieldSetup
from ansys.aedt.core.modules.boundary.hfss_boundary import WavePort
from ansys.aedt.core.modules.boundary.layout_boundary import NativeComponentObject
from ansys.aedt.core.modules.setup_templates import SetupKeys


class NearFieldType(str, Enum):
Sphere = "NearFieldSphere"
Box = "NearFieldBox"
Rectangle = "NearFieldRectangle"
Line = "NearFieldLine"
Points = "NearFieldPoints"


class Hfss(FieldAnalysis3D, ScatteringMethods, CreateBoundaryMixin):
"""Provides the HFSS application interface.

Expand Down Expand Up @@ -238,27 +249,40 @@ def _init_from_design(self, *args, **kwargs):
self.__init__(*args, **kwargs)

@pyaedt_function_handler
# NOTE: Extend Mixin behaviour to handle near field setups
# NOTE: Extend Mixin behaviour to handle HFSS excitations
def _create_boundary(self, name, props, boundary_type):
# No-near field cases
if boundary_type not in (
"NearFieldSphere",
"NearFieldBox",
"NearFieldRectangle",
"NearFieldLine",
"NearFieldPoints",
# Wave Port cases - return WavePort
if boundary_type == "Wave Port":
try:
bound = WavePort(self, name, props)
if not bound.create():
raise AEDTRuntimeError(f"Failed to create boundary {boundary_type} {name}")

self._boundaries[bound.name] = bound
self.logger.info(f"Boundary {boundary_type} {name} has been created.")
return bound
except GrpcApiError as e:
raise AEDTRuntimeError(f"Failed to create boundary {boundary_type} {name}") from e

# Near field cases
if boundary_type in (
NearFieldType.Sphere,
NearFieldType.Box,
NearFieldType.Rectangle,
NearFieldType.Line,
NearFieldType.Points,
):
# Near field setup
bound = NearFieldSetup(self, name, props, boundary_type)
result = bound.create()
if result:
self.field_setups.append(bound)
self.logger.info(f"Field setup {boundary_type} {name} has been created.")
return bound
raise AEDTRuntimeError(f"Failed to create near field setup {boundary_type} {name}")
else:
return super()._create_boundary(name, props, boundary_type)

# Near field setup
bound = NearFieldSetup(self, name, props, boundary_type)
result = bound.create()
if result:
self.field_setups.append(bound)
self.logger.info(f"Field setup {boundary_type} {name} has been created.")
return bound
raise AEDTRuntimeError(f"Failed to create near field setup {boundary_type} {name}")

@property
def field_setups(self):
"""List of AEDT radiation fields.
Expand Down Expand Up @@ -5624,7 +5648,7 @@ def insert_near_field_sphere(
props["CoordSystem"] = custom_coordinate_system
else:
props["CoordSystem"] = ""
return self._create_boundary(name, props, "NearFieldSphere")
return self._create_boundary(name, props, NearFieldType.Sphere)

@pyaedt_function_handler()
def insert_near_field_box(
Expand Down Expand Up @@ -5695,7 +5719,7 @@ def insert_near_field_box(
props["CoordSystem"] = custom_coordinate_system
else:
props["CoordSystem"] = "Global"
return self._create_boundary(name, props, "NearFieldBox")
return self._create_boundary(name, props, NearFieldType.Box)

@pyaedt_function_handler()
def insert_near_field_rectangle(
Expand Down Expand Up @@ -5759,7 +5783,7 @@ def insert_near_field_rectangle(
else:
props["CoordSystem"] = "Global"

return self._create_boundary(name, props, "NearFieldRectangle")
return self._create_boundary(name, props, NearFieldType.Rectangle)

@pyaedt_function_handler(line="assignment")
def insert_near_field_line(
Expand Down Expand Up @@ -5804,7 +5828,7 @@ def insert_near_field_line(
props["NumPts"] = points
props["Line"] = assignment

return self._create_boundary(name, props, "NearFieldLine")
return self._create_boundary(name, props, NearFieldType.Line)

@pyaedt_function_handler()
def insert_near_field_points(
Expand Down Expand Up @@ -5842,7 +5866,7 @@ def insert_near_field_points(
props["CoordSystem"] = coordinate_system
props["PointListFile"] = str(point_file)

return self._create_boundary(name, props, "NearFieldPoints")
return self._create_boundary(name, props, NearFieldType.Points)

@pyaedt_function_handler()
def set_sbr_current_sources_options(self, conformance=False, thin_sources=False, power_fraction=0.95):
Expand Down
Loading
Loading