Skip to content

Commit

Permalink
Merge branch 'main' into adm_aedt_file_3dcomponents_cell
Browse files Browse the repository at this point in the history
  • Loading branch information
Alberto-DM committed Oct 26, 2023
2 parents 20e93cb + 5507831 commit b1d6538
Show file tree
Hide file tree
Showing 11 changed files with 117 additions and 30 deletions.
18 changes: 10 additions & 8 deletions _unittest/test_00_EDB.py
Original file line number Diff line number Diff line change
Expand Up @@ -1387,6 +1387,8 @@ def test_107_create_edge_ports(self):
gap_port.name = "gap_port"
assert gap_port.name == "gap_port"
assert isinstance(gap_port.renormalize_z0, tuple)
gap_port.is_circuit_port = True
assert gap_port.is_circuit_port
edb.close()

def test_108_create_dc_simulation(self):
Expand Down Expand Up @@ -2277,6 +2279,12 @@ def test_131_siwave_ac_simulation_setup(self):
assert sweep.save_rad_fields_only
assert sweep.use_q3d_for_dc

setup1.pi_slider_postion = 0
setup1.pi_slider_postion = 1
setup1.pi_slider_postion = 2
setup1.si_slider_postion = 0
setup1.si_slider_postion = 1
setup1.si_slider_postion = 2
assert setup1.automatic_mesh
assert setup1.enabled
assert setup1.dc_settings
Expand All @@ -2289,16 +2297,14 @@ def test_131_siwave_ac_simulation_setup(self):
assert setup1.include_trace_coupling
assert not setup1.include_vi_sources
assert setup1.infinite_ground_location == "0"
assert setup1.max_coupled_lines == 12
assert setup1.max_coupled_lines == 40
assert setup1.mesh_frequency == "4GHz"
assert setup1.min_pad_area_to_mesh == "1mm2"
assert setup1.min_plane_area_to_mesh == "6.25e-6mm2"
assert setup1.min_void_area == "2mm2"
assert setup1.name == "AC1"
assert setup1.perform_erc
assert setup1.pi_slider_postion == 1
assert setup1.si_slider_postion == 1
assert not setup1.return_current_distribution
assert setup1.return_current_distribution
assert setup1.snap_length_threshold == "2.5um"
assert setup1.use_si_settings
assert setup1.use_custom_settings
Expand All @@ -2323,8 +2329,6 @@ def test_131_siwave_ac_simulation_setup(self):
setup1.min_void_area = "1mm2"
setup1.name = "AC2"
setup1.perform_erc = False
setup1.pi_slider_postion = 0
setup1.si_slider_postion = 2
setup1.return_current_distribution = True
setup1.snap_length_threshold = "3.5um"
setup1.use_si_settings = False
Expand All @@ -2349,8 +2353,6 @@ def test_131_siwave_ac_simulation_setup(self):
assert setup1.min_void_area == "1mm2"
assert setup1.name == "AC2"
assert not setup1.perform_erc
assert setup1.pi_slider_postion == 0
assert setup1.si_slider_postion == 2
assert setup1.return_current_distribution
assert setup1.snap_length_threshold == "3.5um"
assert not setup1.use_si_settings
Expand Down
3 changes: 3 additions & 0 deletions _unittest/test_01_Design.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,9 @@ def test_13_designs(self):

def test_14_get_nominal_variation(self):
assert self.aedtapp.get_nominal_variation() != [] or self.aedtapp.get_nominal_variation() is not None
assert isinstance(self.aedtapp.get_nominal_variation(), list)
assert isinstance(self.aedtapp.get_nominal_variation(with_values=True), list)
assert self.aedtapp.get_nominal_variation(with_values=True) != []

def test_15a_duplicate_design(self):
self.aedtapp.duplicate_design("non_valid1", False)
Expand Down
3 changes: 3 additions & 0 deletions pyaedt/aedt_logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -517,6 +517,9 @@ def clear_messages(self, proj_name=None, des_name=None, level=2):
>>> hfss.clear_messages(level=3)
Clear all messages.
>>> hfss.clear_messages(proj_name="", des_name="", level=3)
"""
if self._log_on_desktop:
if proj_name is None:
Expand Down
13 changes: 11 additions & 2 deletions pyaedt/application/Analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -1091,15 +1091,24 @@ def get_setups(self):
return list(setups)

@pyaedt_function_handler()
def get_nominal_variation(self):
def get_nominal_variation(self, with_values=False):
"""Retrieve the nominal variation.
Parameters
----------
with_values : bool
Whether to return nominal variation or nominal variation with values.
The default is ``False``.
Returns
-------
list of str
List of nominal variations.
"""
return self.available_variations.nominal
if not with_values:
return self.available_variations.nominal
else:
return self.available_variations.nominal_w_values

@pyaedt_function_handler()
def get_sweeps(self, name):
Expand Down
2 changes: 2 additions & 0 deletions pyaedt/edb.py
Original file line number Diff line number Diff line change
Expand Up @@ -3367,6 +3367,8 @@ def create_siwave_syz_setup(self, name=None):
if name in self.setups:
return False
setup = SiwaveSYZSimulationSetup(self, name)
setup.si_slider_postion = 1
setup.pi_slider_postion = 1
self._setups[name] = setup
return setup

Expand Down
65 changes: 55 additions & 10 deletions pyaedt/edb_core/edb_data/siwave_simulation_setup_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -756,29 +756,74 @@ def enabled(self):
"""Whether the setup is enabled."""
return self._edb_sim_setup_info.SimulationSettings.Enabled

@property
def pi_slider_postion(self):
"""PI solider position. Values are from ``1`` to ``3``."""
return self._edb_sim_setup_info.SimulationSettings.PISliderPos

@property
def si_slider_postion(self):
"""SI solider position. Values are from ``1`` to ``3``."""
return self._edb_sim_setup_info.SimulationSettings.SISliderPos

@enabled.setter
def enabled(self, value):
self._edb_sim_setup_info.SimulationSettings.Enabled = value
self._update_setup()

@property
def pi_slider_postion(self):
"""PI solider position. Values are from ``1`` to ``3``."""
return self._edb_sim_setup_info.SimulationSettings.PISliderPos

@pi_slider_postion.setter
def pi_slider_postion(self, value):
if value == 0:
self.include_coplane_coupling = False
self.include_inter_plane_coupling = False
self.include_split_plane_coupling = False
self.include_fringe_coupling = False
self.include_trace_coupling = False
self.max_coupled_lines = 12
elif value == 1:
self.include_coplane_coupling = False
self.include_inter_plane_coupling = False
self.include_split_plane_coupling = False
self.include_fringe_coupling = True
self.include_trace_coupling = False
self.max_coupled_lines = 12
else:
self.include_coplane_coupling = True
self.include_inter_plane_coupling = False
self.include_split_plane_coupling = True
self.include_fringe_coupling = True
self.include_trace_coupling = True
self.max_coupled_lines = 40
self._edb_sim_setup_info.SimulationSettings.UseCustomSettings = False
self._edb_sim_setup_info.SimulationSettings.PISliderPos = value
self._update_setup()

@property
def si_slider_postion(self):
"""SI solider position. Values are from ``1`` to ``3``."""
return self._edb_sim_setup_info.SimulationSettings.SISliderPos

@si_slider_postion.setter
def si_slider_postion(self, value):
if value == 0:
self.include_coplane_coupling = False
self.include_inter_plane_coupling = False
self.include_split_plane_coupling = False
self.include_fringe_coupling = False
self.include_trace_coupling = True
self.max_coupled_lines = 12
self.return_current_distribution = False
elif value == 1:
self.include_coplane_coupling = True
self.include_inter_plane_coupling = False
self.include_split_plane_coupling = True
self.include_fringe_coupling = True
self.include_trace_coupling = True
self.max_coupled_lines = 12
self.return_current_distribution = False
else:
self.include_coplane_coupling = True
self.include_inter_plane_coupling = False
self.include_split_plane_coupling = True
self.include_fringe_coupling = True
self.include_trace_coupling = True
self.max_coupled_lines = 40
self.return_current_distribution = True
self._edb_sim_setup_info.SimulationSettings.UseCustomSettings = False
self._edb_sim_setup_info.SimulationSettings.SISliderPos = value
self._update_setup()
Expand Down
4 changes: 4 additions & 0 deletions pyaedt/edb_core/edb_data/terminals.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,10 @@ def is_circuit_port(self):
"""Whether it is a circuit port."""
return self._edb_object.GetIsCircuitPort()

@is_circuit_port.setter
def is_circuit_port(self, value):
self._edb_object.SetIsCircuitPort(value)

@property
def _port_post_processing_prop(self):
"""Get port post processing properties."""
Expand Down
5 changes: 4 additions & 1 deletion pyaedt/misc/Run_PyAEDT_Script.py_build
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,10 @@ def main():
check_file(python_exe)
check_file(pyaedt_script)
os.environ["PYAEDT_SCRIPT_PROCESS_ID"] = str(oDesktop.GetProcessID())
os.environ["PYAEDT_SCRIPT_VERSION"] = str(oDesktop.GetVersion()[:6])
version = str(oDesktop.GetVersion()[:6])
os.environ["PYAEDT_SCRIPT_VERSION"] = version
if version > "2022.2":
os.environ["PYAEDT_SCRIPT_PORT"] = str(oDesktop.GetGrpcServerPort())
if is_linux:
edt_root = os.path.normpath(oDesktop.GetExeDir())
os.environ["ANSYSEM_ROOT{}".format(version)] = edt_root
Expand Down
5 changes: 4 additions & 1 deletion pyaedt/misc/Run_PyAEDT_Toolkit_Script.py_build
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,10 @@ def main():
check_file(python_exe)
check_file(pyaedt_script)
os.environ["PYAEDT_SCRIPT_PROCESS_ID"] = str(oDesktop.GetProcessID())
os.environ["PYAEDT_SCRIPT_VERSION"] = str(oDesktop.GetVersion()[:6])
version = str(oDesktop.GetVersion()[:6])
os.environ["PYAEDT_SCRIPT_VERSION"] = version
if version > "2022.2":
os.environ["PYAEDT_SCRIPT_PORT"] = str(oDesktop.GetGrpcServerPort())
if is_linux:
edt_root = os.path.normpath(oDesktop.GetExeDir())
os.environ["ANSYSEM_ROOT{}".format(version)] = edt_root
Expand Down
28 changes: 20 additions & 8 deletions pyaedt/modeler/cad/Modeler.py
Original file line number Diff line number Diff line change
Expand Up @@ -2829,9 +2829,7 @@ def duplicate_coordinate_system_to_global(self, coordinate_system):
if name in cs_names:
name = cs.name + generate_unique_name("_RefToGlobal")
face_cs = FaceCoordinateSystem(self, props=cs.props, name=name, face_id=cs.props["FaceID"])
obj = [
obj for obj in self._app.modeler.object_list for face in obj.faces if face.id == face_cs.props["FaceID"]
][0]
obj = [obj for obj in self.object_list for face in obj.faces if face.id == face_cs.props["FaceID"]][0]
face = [face for face in obj.faces if face.id == face_cs.props["FaceID"]][0]
if face_cs.props["Origin"]["PositionType"] == "FaceCenter":
origin = face
Expand Down Expand Up @@ -2868,16 +2866,24 @@ def duplicate_coordinate_system_to_global(self, coordinate_system):
)
if result:
return face_cs
elif isinstance(coordinate_system, ObjectCoordinateSystem):
elif isinstance(cs, ObjectCoordinateSystem):
name = cs.name + "_RefToGlobal"
if name in cs_names:
name = cs.name + generate_unique_name("_RefToGlobal")
obj_cs = ObjectCoordinateSystem(self, props=cs.props, name=name, entity_id=cs.entity_id)
obj = self.objects[cs.entity_id]
objs_by_name_list = [obj for obj in self.object_list if obj.part_coordinate_system == cs.name]
objs_by_id_list = [o for o in self.object_list if o.id == cs.entity_id]
if objs_by_name_list:
obj = objs_by_name_list[0]
elif objs_by_id_list:
obj = [o for o in self.object_list if o.id == cs.entity_id][0]
if cs.props["Origin"]["PositionType"] != "AbsolutePosition":
if cs.props["Origin"]["PositionType"] == "FaceCenter":
origin = [f for f in obj.faces if f.id == cs.props["Origin"]["EntityID"]][0]
elif cs.props["Origin"]["PositionType"] == "EdgeCenter":
elif (
cs.props["Origin"]["PositionType"] == "EdgeCenter"
or cs.props["Origin"]["PositionType"] == "ArcCenter"
):
origin = [e for e in obj.edges if e.id == cs.props["Origin"]["EntityID"]][0]
elif cs.props["Origin"]["PositionType"] == "OnVertex":
origin = [v for v in obj.vertices if v.id == cs.props["Origin"]["EntityID"]][0]
Expand All @@ -2890,7 +2896,10 @@ def duplicate_coordinate_system_to_global(self, coordinate_system):
if "xAxisPos" in cs.props:
if cs.props["xAxisPos"]["PositionType"] == "FaceCenter":
x_axis = [f for f in obj.faces if f.id == cs.props["xAxisPos"]["EntityID"]][0]
elif cs.props["xAxisPos"]["PositionType"] == "EdgeCenter":
elif (
cs.props["xAxisPos"]["PositionType"] == "EdgeCenter"
or cs.props["xAxisPos"]["PositionType"] == "ArcCenter"
):
x_axis = [e for e in obj.edges if e.id == cs.props["xAxisPos"]["EntityID"]][0]
elif cs.props["xAxisPos"]["PositionType"] == "OnVertex":
x_axis = [v for v in obj.vertices if v.id == cs.props["xAxisPos"]["EntityID"]][0]
Expand All @@ -2903,7 +2912,10 @@ def duplicate_coordinate_system_to_global(self, coordinate_system):
if "yAxisPos" in cs.props:
if cs.props["yAxisPos"]["PositionType"] == "FaceCenter":
y_axis = [f for f in obj.faces if f.id == cs.props["yAxisPos"]["EntityID"]][0]
elif cs.props["yAxisPos"]["PositionType"] == "EdgeCenter":
elif (
cs.props["yAxisPos"]["PositionType"] == "EdgeCenter"
or cs.props["yAxisPos"]["PositionType"] == "ArcCenter"
):
y_axis = [e for e in obj.edges if e.id == cs.props["yAxisPos"]["EntityID"]][0]
elif cs.props["yAxisPos"]["PositionType"] == "OnVertex":
y_axis = [v for v in obj.vertices if v.id == cs.props["yAxisPos"]["EntityID"]][0]
Expand Down
1 change: 1 addition & 0 deletions pyaedt/modeler/cad/elements3d.py
Original file line number Diff line number Diff line change
Expand Up @@ -598,6 +598,7 @@ def center(self):
try:
return [float(i) for i in self.oeditor.GetFaceCenter(self.id)]
except: # pragma: no cover
self.logger.clear_messages()
vtx = self.vertices[:]
if len(vtx) > 1:
return GeometryOperators.get_polygon_centroid([pos.position for pos in vtx])
Expand Down

0 comments on commit b1d6538

Please sign in to comment.