Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FIX: Back compatibility with Example repository #5888

Merged
merged 17 commits into from
Mar 10, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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/5888.fixed.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Back compatibility with Example repository
6 changes: 6 additions & 0 deletions src/ansys/aedt/core/application/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.

import re

from ansys.aedt.core.generic.general_methods import pyaedt_function_handler


Expand Down Expand Up @@ -50,6 +53,9 @@ def _fix_dict(p_list, p_out):
p_out[p] = val

input_str = child_object.GetDataModel(level, 1, 1)
if input_str:
input_str = re.sub(r'("value":\s*)(-?inf)(?=[,}])', r"\1null", input_str)

props_list = json.loads(input_str)
props = {}
_fix_dict(props_list, props)
Expand Down
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 @@ -393,7 +393,7 @@ def setup_sweeps_names(self):
val = k.split(" : ")
if len(val) == 2 and val[0] == el:
sweep_list[el]["Nominal"] = val[1]
if "GetSweeps" in dir(self.oanalysis):
if self.solution_type != "Eigenmode" and "GetSweeps" in dir(self.oanalysis):
try:
sweep_list[el]["Sweeps"].extend(list(self.oanalysis.GetSweeps(el)))
except Exception:
Expand Down Expand Up @@ -2132,7 +2132,7 @@ def _export_touchstone(
else:
if sweep_name is None:
for sol in self.existing_analysis_sweeps:
if setup_name == sol.split(":")[0].strip():
if setup_name == sol.split(":")[0].strip() and ":" in sol:
sweep_name = sol.split(":")[1].strip()
break

Expand Down
8 changes: 7 additions & 1 deletion src/ansys/aedt/core/generic/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -870,7 +870,13 @@ class Circuit(object):
class Mechanical(object):
"""Provides Mechanical solution types."""

(Thermal, Structural, Modal, SteadyStateThermal) = ("Thermal", "Structural", "Modal", "Steady-State Thermal")
(Thermal, Structural, Modal, SteadyStateThermal, TransientThermal) = (
"Thermal",
"Structural",
"Modal",
"Steady-State Thermal",
"Transient Thermal",
)


class SETUPS(object):
Expand Down
2 changes: 1 addition & 1 deletion src/ansys/aedt/core/icepak.py
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ def assign_openings(self, air_faces):
Parameters
----------
air_faces : list
air_faces : list or :class:`ansys.aedt.core.modeler.cad.elements_3d.FacePrimitive`
List of face names.
Returns
Expand Down
30 changes: 25 additions & 5 deletions src/ansys/aedt/core/mechanical.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,11 @@ def assign_em_losses(
----------
>>> oModule.AssignEMLoss
"""
if self.solution_type not in (SOLUTIONS.Mechanical.Thermal, SOLUTIONS.Mechanical.SteadyStateThermal):
if self.solution_type not in (
SOLUTIONS.Mechanical.Thermal,
SOLUTIONS.Mechanical.SteadyStateThermal,
SOLUTIONS.Mechanical.TransientThermal,
):
raise AEDTRuntimeError("This method works only in a Mechanical Thermal analysis.")

if surface_objects is None:
Expand Down Expand Up @@ -398,7 +402,11 @@ def assign_uniform_convection(
----------
>>> oModule.AssignConvection
"""
if self.solution_type not in (SOLUTIONS.Mechanical.Thermal, SOLUTIONS.Mechanical.SteadyStateThermal):
if self.solution_type not in (
SOLUTIONS.Mechanical.Thermal,
SOLUTIONS.Mechanical.SteadyStateThermal,
SOLUTIONS.Mechanical.TransientThermal,
):
raise AEDTRuntimeError("This method works only in a Mechanical Thermal analysis.")

props = {}
Expand Down Expand Up @@ -443,7 +451,11 @@ def assign_uniform_temperature(self, assignment, temperature="AmbientTemp", name
----------
>>> oModule.AssignTemperature
"""
if self.solution_type not in (SOLUTIONS.Mechanical.Thermal, SOLUTIONS.Mechanical.SteadyStateThermal):
if self.solution_type not in (
SOLUTIONS.Mechanical.Thermal,
SOLUTIONS.Mechanical.SteadyStateThermal,
SOLUTIONS.Mechanical.TransientThermal,
):
raise AEDTRuntimeError("This method works only in a Mechanical Thermal analysis.")

props = {}
Expand Down Expand Up @@ -581,7 +593,11 @@ def assign_heat_flux(self, assignment, heat_flux_type, value, name=""):
----------
>>> oModule.AssignHeatFlux
"""
if self.solution_type not in (SOLUTIONS.Mechanical.Thermal, SOLUTIONS.Mechanical.SteadyStateThermal):
if self.solution_type not in (
SOLUTIONS.Mechanical.Thermal,
SOLUTIONS.Mechanical.SteadyStateThermal,
SOLUTIONS.Mechanical.TransientThermal,
):
raise AEDTRuntimeError("This method works only in a Mechanical Thermal analysis.")

props = {}
Expand Down Expand Up @@ -624,7 +640,11 @@ def assign_heat_generation(self, assignment, value, name=""):
----------
>>> oModule.AssignHeatGeneration
"""
if self.solution_type not in (SOLUTIONS.Mechanical.Thermal, SOLUTIONS.Mechanical.SteadyStateThermal):
if self.solution_type not in (
SOLUTIONS.Mechanical.Thermal,
SOLUTIONS.Mechanical.SteadyStateThermal,
SOLUTIONS.Mechanical.TransientThermal,
):
raise AEDTRuntimeError("This method works only in a Mechanical Thermal analysis.")

props = {}
Expand Down
2 changes: 1 addition & 1 deletion src/ansys/aedt/core/modeler/cad/primitives.py
Original file line number Diff line number Diff line change
Expand Up @@ -3168,7 +3168,7 @@ def sweep_along_vector(self, assignment, sweep_vector, draft_angle=0, draft_type
----------
assignment : list, str, int, :class:`ansys.aedt.core.modeler.cad.object_3d.Object3d`
Name or ID of the object.
sweep_vector : float
sweep_vector : list
List of ``[x1, y1, z1]`` coordinates or Application.Position object for
the vector.
draft_angle : float, optional
Expand Down
2 changes: 1 addition & 1 deletion src/ansys/aedt/core/modeler/cad/primitives_2d.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def create_circle(
----------
origin : list
ApplicationName.modeler.Position(x,y,z) object
radius : float
radius : float or str
Radius of the object.
num_sides : int, optional
Number of sides. The default is ``0``, which is correct for a circle.
Expand Down
6 changes: 4 additions & 2 deletions src/ansys/aedt/core/modeler/cad/primitives_3d.py
Original file line number Diff line number Diff line change
Expand Up @@ -800,7 +800,7 @@ def create_circle(self, orientation, origin, radius, num_sides=0, is_covered=Tru
:class:`ansys.aedt.core.constants.PLANE` Enumerator can be used as input.
origin : list
List of ``[x, y, z]`` coordinates for the center point of the circle.
radius : float
radius : float or str
Radius of the circle.
num_sides : int, optional
Number of sides. The default is ``0``, which is correct for a circle.
Expand Down Expand Up @@ -2553,12 +2553,14 @@ def create_choke(self, input_file):
num_seg=segment_number)
returned_list = returned_list + list_object
else:
success = list_object[0].set_crosssection_properties(type=section, width=w_dia, num_seg=segment_number)
success = list_object[0].set_crosssection_properties(section=section, width=w_dia, num_seg=segment_number)
returned_list.append(list_object)

number_duplication = 1
for key in values["Number of Windings"].keys():
if values["Number of Windings"][key]:
number_duplication = int(key)

if number_duplication >= 2:
if values["Mode"]["Common"] and number_duplication == 2:
if isinstance(list_object[0], list):
Expand Down
2 changes: 1 addition & 1 deletion src/ansys/aedt/core/modeler/circuits/primitives_nexxim.py
Original file line number Diff line number Diff line change
Expand Up @@ -1902,7 +1902,7 @@ def set_sim_option_on_hfss_subcircuit(self, component, option="simulate"):
Parameters
----------
component : str
component : str or :class:`ansys.aedt.core.modeler.circuits.object_3d_circuit.CircuitComponent`
Address of the component instance. For example, ``"Inst@layout_cutout;87;1"``.
option : str
Set the simulation strategy. Options are ``"simulate"`` and ``"interpolate"``. The default
Expand Down
2 changes: 1 addition & 1 deletion src/ansys/aedt/core/modules/design_xploration.py
Original file line number Diff line number Diff line change
Expand Up @@ -1160,7 +1160,7 @@ def add(
----------
variable : str
Name of the variable.
start_point : float or int
start_point : float, int or str
Variation Start Point if a variation is defined or Single Value.
end_point : float or int, optional
Variation End Point. This parameter is optional if a Single Value is defined.
Expand Down
10 changes: 5 additions & 5 deletions src/ansys/aedt/core/modules/solve_setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,13 +161,13 @@
.adaptive_settings.adaptive_frequency_data_list[0]
.adaptive_frequency
)
intrinsics["Phase"] = "All"
intrinsics["Phase"] = "0deg"
return intrinsics
except Exception:
settings.logger.debug("Failed to retrieve adaptive frequency.")
if self._app.design_type in ["Twin Builder"]:
if "Tend" in self.properties:
intrinsics["Time"] = "All"
intrinsics["Time"] = "0s"

Check warning on line 170 in src/ansys/aedt/core/modules/solve_setup.py

View check run for this annotation

Codecov / codecov/patch

src/ansys/aedt/core/modules/solve_setup.py#L170

Added line #L170 was not covered by tests
elif "StartFrequency" in self.properties:
intrinsics["Freq"] = "All"
return intrinsics
Expand All @@ -176,7 +176,7 @@
i in self.props
for i in ["TransientData", "QuickEyeAnalysis", "AMIAnalysis", "HSPICETransientData", "SystemFDAnalysis"]
):
intrinsics["Time"] = "All"
intrinsics["Time"] = "0s"
else:
intrinsics["Freq"] = "All"
return intrinsics
Expand All @@ -189,9 +189,9 @@
else:
intrinsics[i] = "All"
elif i == "Phase":
intrinsics[i] = "All"
intrinsics[i] = "0deg"
elif i == "Time":
intrinsics[i] = "All"
intrinsics[i] = "0s"
return intrinsics

def __repr__(self):
Expand Down