Skip to content

Commit

Permalink
Merge branch 'main' into FEAT__Add_distributed_filters_substrate
Browse files Browse the repository at this point in the history
  • Loading branch information
ramin4667 authored Jan 14, 2025
2 parents f2d7a32 + c35e71b commit d3bd7ce
Show file tree
Hide file tree
Showing 23 changed files with 1,186 additions and 57,520 deletions.
3 changes: 0 additions & 3 deletions src/ansys/aedt/core/application/analysis_3d.py
Original file line number Diff line number Diff line change
Expand Up @@ -1312,9 +1312,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
19 changes: 11 additions & 8 deletions src/ansys/aedt/core/hfss.py
Original file line number Diff line number Diff line change
Expand Up @@ -808,11 +808,10 @@ def create_setup(self, name="MySetupAuto", setup_type=None, **kwargs):
Name of the setup. The default is ``"Setup1"``.
setup_type : str, optional
Type of the setup, which is based on the solution type. Options are
``"HFSSDrivenAuto"``, ``"HFSSDrivenDefault"``, ``"HFSSEigen"``, ``"HFSSTransient"``,
and ``"HFSSSBR"``. The default is ``"HFSSDrivenAuto"``.
``"HFSSDrivenAuto"``, ``"HFSSDriven"``, ``"HFSSEigen"``, ``"HFSSTransient"``,
and ``"HFSSSBR"``. The default is ``"HFSSDriven"``.
**kwargs : dict, optional
Extra arguments to set up the circuit.
Available keys depend on the setup chosen.
Keyword arguments from the native AEDT API.
For more information, see
:doc:`../SetupTemplatesHFSS`.
Expand All @@ -838,6 +837,7 @@ def create_setup(self, name="MySetupAuto", setup_type=None, **kwargs):
setup_type = self.design_solutions.default_setup
elif setup_type in SetupKeys.SetupNames:
setup_type = SetupKeys.SetupNames.index(setup_type)
name = self.generate_unique_setup_name(name)
setup = self._create_setup(name=name, setup_type=setup_type)
setup.auto_update = False
for arg_name, arg_value in kwargs.items():
Expand Down Expand Up @@ -5846,15 +5846,18 @@ def get_antenna_data(
)
self.logger.info("Far field sphere %s is created.", setup)

if setup in self.existing_analysis_sweeps and not frequencies:
frequency_units = self.odesktop.GetDefaultUnit("Frequency")
if setup in self.existing_analysis_sweeps and frequencies is None:
trace_name = "mag(rETheta)"
farfield_data = self.post.get_far_field_data(expressions=trace_name, setup_sweep_name=setup, domain=sphere)
if farfield_data and getattr(farfield_data, "primary_sweep_values", None) is not None:
frequencies = farfield_data.primary_sweep_values
frequency_units = self.odesktop.GetDefaultUnit("Frequency")
frequencies = [str(freq) + frequency_units for freq in frequencies]

if not frequencies: # pragma: no cover
if frequencies is not None:
if type(frequencies) in [float, int, str]:
frequencies = [frequencies]
frequencies = [str(freq) + frequency_units for freq in frequencies if is_number(freq)]
else: # pragma: no cover
self.logger.info("Frequencies could not be obtained.")
return False

Expand Down
526 changes: 207 additions & 319 deletions src/ansys/aedt/core/maxwell.py

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion src/ansys/aedt/core/modules/boundary/layout_boundary.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,9 @@ def _child_object(self):
"""
child_object = None
for el in self._app.oeditor.GetChildNames("ComponentDefinition"):
component_definition = self._app.oeditor.Get3DComponentDefinitionNames()

for el in component_definition:
design_childs = self._app.get_oo_object(self._app.oeditor, el).GetChildNames()
if self._name in design_childs:
child_object = self._app.get_oo_object(self._app.oeditor, f"{el}\\{self._name}")
Expand Down
2 changes: 0 additions & 2 deletions src/ansys/aedt/core/modules/mesh.py
Original file line number Diff line number Diff line change
Expand Up @@ -1158,7 +1158,6 @@ def assign_length_mesh(self, assignment, inside_selection=True, maximum_length=1
if maximum_length is None and maximum_elements is None:
self.logger.error("mesh not assigned due to incorrect settings")
return
assignment = self._app.modeler.convert_to_selections(assignment, True)

if isinstance(assignment[0], int) and not inside_selection:
seltype = "Faces"
Expand Down Expand Up @@ -1318,7 +1317,6 @@ def assign_curvilinear_elements(self, assignment, enable=True, name=None):
name = generate_unique_name(name)
else:
name = generate_unique_name("CurvilinearElements")
assignment = self._app.modeler.convert_to_selections(assignment, True)

if isinstance(assignment[0], int):
seltype = "Faces"
Expand Down
8 changes: 4 additions & 4 deletions src/ansys/aedt/core/modules/mesh_icepak.py
Original file line number Diff line number Diff line change
Expand Up @@ -933,12 +933,12 @@ def assignment(self):
for sr in sub_regions:
p1 = []
p2 = []
if "Part Names" in self._app.modeler[sr].history().props:
p1 = self._app.modeler[sr].history().props.get("Part Names", None)
if "Part Names" in self._app.modeler[sr].history().properties:
p1 = self._app.modeler[sr].history().properties.get("Part Names", None)
if not isinstance(p1, list):
p1 = [p1]
elif "Submodel Names" in self._app.modeler[sr].history().props:
p2 = self._app.modeler[sr].history().props.get("Submodel Names", None)
elif "Submodel Names" in self._app.modeler[sr].history().properties:
p2 = self._app.modeler[sr].history().properties.get("Submodel Names", None)
if not isinstance(p2, list):
p2 = [p2]
p1 += p2
Expand Down
2 changes: 1 addition & 1 deletion src/ansys/aedt/core/modules/setup_templates.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def HFSS3DLayout_AdaptiveFrequencyData(freq):


meshlink = dict({"ImportMesh": False})
autosweep = dict({"RangeType": "LinearStep", "RangeStart": "1GHz", "RangeEnd": "10GHz", "RangeStep": "1GHz"})
autosweep = dict({"RangeType": "LinearCount", "RangeStart": "1GHz", "RangeEnd": "10GHz", "RangeCount": "501"})
autosweeps = dict({"Sweep": autosweep})
multifreq = dict({"1GHz": [0.02], "2GHz": [0.02], "5GHz": [0.02]})
sweepsbr = dict({"RangeType": "LinearStep", "RangeStart": "1GHz", "RangeEnd": "10GHz", "RangeStep": "1GHz"})
Expand Down
19 changes: 5 additions & 14 deletions src/ansys/aedt/core/modules/solve_setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -866,7 +866,7 @@ def add_mesh_link(
Name of the source design.
solution : str, optional
Name of the source design solution in the format ``"name : solution_name"``.
If ``None``, the default value is ``name : LastAdaptive``.
If ``None``, the default value is taken from the nominal adaptive solution.
parameters : dict, optional
Dictionary of the "mapping" variables from the source design.
If ``None``, the default is `appname.available_variations.nominal_w_values_dict`.
Expand Down Expand Up @@ -919,9 +919,7 @@ def add_mesh_link(
design_type = self.p_app.design_type
meshlinks["Product"] = design_type
# design name
if not design or design is None:
raise ValueError("Provide design name to add mesh link to.")
elif design not in self.p_app.design_list:
if design not in self.p_app.design_list:
raise ValueError("Design does not exist in current project.")
else:
meshlinks["Design"] = design
Expand All @@ -939,15 +937,8 @@ def add_mesh_link(
meshlinks["ImportMesh"] = True
# solution name
if solution is None:
meshlinks["Soln"] = (
f'{self.p_app.oproject.GetDesign(design).GetChildObject("Analysis").GetChildNames()[0]} : '
f"LastAdaptive"
)
elif (
solution.split()[0] in self.p_app.oproject.GetDesign(design).GetChildObject("Analysis").GetChildNames()
):
meshlinks["Soln"] = f"{solution.split()[0]} : LastAdaptive"
else:
meshlinks["Soln"] = self.p_app.nominal_adaptive
elif solution.split()[0] not in self.p_app.existing_analysis_setups:
raise ValueError("Setup does not exist in current design.")
# parameters
meshlinks["Params"] = {}
Expand All @@ -964,7 +955,7 @@ def add_mesh_link(
meshlinks["ForceSourceToSolve"] = force_source_to_solve
meshlinks["PreservePartnerSoln"] = preserve_partner_solution
meshlinks["ApplyMeshOp"] = apply_mesh_operations
if self.p_app.design_type != "Maxwell 2D" or self.p_app.design_type != "Maxwell 3D":
if self.p_app.design_type not in ["Maxwell 2D", "Maxwell 3D"]:
meshlinks["AdaptPort"] = adapt_port
self.update()
self.auto_update = auto_update
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ class FfdSolutionData(object):
Examples
--------
>>> from ansys.aedt.core
>>> from ansys.aedt.core import Hfss
>>> from ansys.aedt.core.visualization.advanced.farfield_visualization import FfdSolutionData
>>> app = ansys.aedt.core.Hfss(version="2023.2", design="Antenna")
>>> data = app.get_antenna_data()
Expand Down
5 changes: 3 additions & 2 deletions src/ansys/aedt/core/visualization/plot/matplotlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
from matplotlib.patches import PathPatch
from matplotlib.path import Path
import matplotlib.pyplot as plt
import matplotlib.ticker as ticker
except ImportError:
warnings.warn(
"The Matplotlib module is required to run some functionalities of PostProcess.\n"
Expand Down Expand Up @@ -730,9 +731,9 @@ def _update_grid(self):
self.ax.grid(which="minor", color=self.__grid_color)
if self._has_minor_axis:
if self.__grid_enable_minor_x:
self.ax.xaxis.minorticks_on()
self.ax.xaxis.set_minor_locator(ticker.AutoMinorLocator())
if self.__grid_enable_minor_y:
self.ax.yaxis.minorticks_on()
self.ax.yaxis.set_minor_locator(ticker.AutoMinorLocator())
self.ax.tick_params(which="minor", grid_linestyle="--")

@property
Expand Down
2 changes: 1 addition & 1 deletion src/ansys/aedt/core/workflows/hfss/choke_designer.py
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,7 @@ def main(extension_args):
hfss.modeler.create_region(pad_percent=1000)

# Create setup
setup = hfss.create_setup("Setup1")
setup = hfss.create_setup("Setup1", setup_type="HFSSDriven")
setup.props["Frequency"] = "50MHz"
setup.props["MaximumPasses"] = 10

Expand Down
1 change: 0 additions & 1 deletion tests/system/general/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@
# Initialize default desktop configuration
default_version = "2024.2"


if inside_desktop and "oDesktop" in dir(sys.modules["__main__"]):
default_version = sys.modules["__main__"].oDesktop.GetVersion()[0:6]
config = {
Expand Down
Loading

0 comments on commit d3bd7ce

Please sign in to comment.