Skip to content

Commit

Permalink
Merge branch 'main' into fix/issue_launch_toolkit_from_aedt
Browse files Browse the repository at this point in the history
  • Loading branch information
Samuelopez-ansys committed May 10, 2024
2 parents f3c9a8f + bd9d18c commit c798e1a
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 22 deletions.
File renamed without changes.
4 changes: 2 additions & 2 deletions _unittest/test_21_Circuit.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
diff_proj_name = "differential_pairs"
netlist1 = "netlist_small.cir"
netlist2 = "Schematic1.qcv"
touchstone = "SSN_ssn.s6p"
touchstone = "SSN_1.5_ssn.s6p"
touchstone_custom = "SSN_custom.s6p"
touchstone2 = "Galileo_V3P3S0.ts"
ami_project = "AMI_Example"
Expand Down Expand Up @@ -317,7 +317,7 @@ def test_24_new_connect_components(self):

def test_25_import_model(self):
self.aedtapp.insert_design("Touch_import")
touch = os.path.join(local_path, "example_models", test_subfolder, "SSN_ssn.s6p")
touch = os.path.join(local_path, "example_models", test_subfolder, touchstone)
t1 = self.aedtapp.modeler.schematic.create_touchstone_component(touch)
assert t1
assert len(t1.pins) == 6
Expand Down
2 changes: 2 additions & 0 deletions pyaedt/modeler/circuits/PrimitivesCircuit.py
Original file line number Diff line number Diff line change
Expand Up @@ -403,6 +403,8 @@ def _parse_ports_name(file, num_terminal):

if not model_name:
model_name = os.path.splitext(os.path.basename(input_file))[0]
if "." in model_name:
model_name = model_name.replace(".", "_")
if model_name in list(self.o_model_manager.GetNames()):
model_name = generate_unique_name(model_name, n=2)
num_terminal = int(os.path.splitext(input_file)[1].lower().strip(".sp"))
Expand Down
2 changes: 1 addition & 1 deletion pyaedt/modeler/modeler3d.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ def create_3dcomponent(
else:
native_objs = [obj.name for _, v in self.user_defined_components.items() for _, obj in v.parts.items()]
objs = [obj for obj in self.object_names if obj not in native_objs]
if not native_components and native_objs:
if not native_components and native_objs and not auxiliary_dict:
self.logger.warning(
"Native component objects cannot be exported. Use native_components argument to"
" export an auxiliary dictionary file containing 3D components information"
Expand Down
18 changes: 14 additions & 4 deletions pyaedt/modules/MeshIcepak.py
Original file line number Diff line number Diff line change
Expand Up @@ -1067,8 +1067,13 @@ def _get_design_mesh_operations(self):
"Icepak",
)
)
except Exception as e:
self._app.logger.error(e)
except TypeError:
# design_properties not loaded, maybe there are mesh region, we need to warn the user
self._app.logger.warning("No mesh operation found.")
self._app.logger.debug("Failed to get mesh operation from `design_properties`.")
except KeyError:
# design_properties loaded, mesh region related keys missing, no need to warn the user
self._app.logger.debug("Failed to get mesh operation.")

return meshops

Expand Down Expand Up @@ -1104,8 +1109,13 @@ def _get_design_mesh_regions(self):
if el in meshop.__dict__:
meshop.__dict__[el] = dict_prop[el]
meshops.append(meshop)
except Exception as e:
self._app.logger.error(e)
except TypeError:
# design_properties not loaded, maybe there are mesh region, we need to warn the user
self._app.logger.warning("No mesh region found.")
self._app.logger.debug("Failed to get mesh region from `design_properties`.")
except KeyError:
# design_properties loaded, mesh region related keys missing, no need to warn the user
self._app.logger.debug("Failed to get mesh region.")

return meshops

Expand Down
33 changes: 18 additions & 15 deletions pyaedt/modules/PostProcessor.py
Original file line number Diff line number Diff line change
Expand Up @@ -2537,11 +2537,12 @@ def get_scalar_field_value(
else:
variation.append("Freq:=")
variation.append(intrinsics)
variation.append("Phase:=")
if phase: # pragma: no cover
variation.append(phase)
else:
variation.append("0deg")
if self._app.design_type not in ["Icepak", "Mechanical", "Q3D Extractor"]:
variation.append("Phase:=")
if phase: # pragma: no cover
variation.append(phase)
else:
variation.append("0deg")

file_name = os.path.join(self._app.working_directory, generate_unique_name("temp_fld") + ".fld")
self.ofieldsreporter.CalculatorWrite(file_name, ["Solution:=", solution], variation)
Expand Down Expand Up @@ -2719,11 +2720,12 @@ def export_field_file_on_grid(
else:
variation.append("Freq:=")
variation.append(intrinsics)
variation.append("Phase:=")
if phase:
variation.append(phase)
else:
variation.append("0deg")
if self._app.design_type not in ["Icepak", "Mechanical", "Q3D Extractor"]:
variation.append("Phase:=")
if phase:
variation.append(phase)
else:
variation.append("0deg")

export_options = [
"NAME:ExportOption",
Expand Down Expand Up @@ -2870,11 +2872,12 @@ def export_field_file(
else:
variation.append("Freq:=")
variation.append(intrinsics)
variation.append("Phase:=")
if phase:
variation.append(phase)
else:
variation.append("0deg")
if self._app.design_type not in ["Icepak", "Mechanical", "Q3D Extractor"]:
variation.append("Phase:=")
if phase:
variation.append(phase)
else:
variation.append("0deg")
if not sample_points_file and not sample_points:
if objects_type == "Vol":
self.ofieldsreporter.EnterVol(assignment)
Expand Down

0 comments on commit c798e1a

Please sign in to comment.