Skip to content

Commit 0ac994a

Browse files
authored
Add name in create sbr antenna method (#4455)
2 parents 728c5a9 + 5ca4ca1 commit 0ac994a

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

_unittest/test_04_SBR.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,10 @@ def init(self, aedtapp, local_scratch):
5858
def test_01_open_source(self, source):
5959
assert self.aedtapp.create_sbr_linked_antenna(source, target_cs="feederPosition", fieldtype="farfield")
6060
assert len(self.aedtapp.native_components) == 1
61+
assert self.aedtapp.create_sbr_linked_antenna(
62+
source, target_cs="feederPosition", fieldtype="farfield", source_name="LinkedAntenna"
63+
)
64+
assert len(self.aedtapp.native_components) == 2
6165

6266
def test_02_add_antennas(self):
6367
self.aedtapp.insert_design("add_antennas")

pyaedt/hfss.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1115,6 +1115,7 @@ def create_sbr_linked_antenna(
11151115
thin_sources=True,
11161116
power_fraction="0.95",
11171117
visible=True,
1118+
source_name=None,
11181119
):
11191120
"""Create a linked antennas.
11201121
@@ -1140,6 +1141,9 @@ def create_sbr_linked_antenna(
11401141
The default is ``"0.95"``.
11411142
visible : bool, optional.
11421143
Visualize source objects in target design. The default is ``True``.
1144+
source_name : str, optional
1145+
Name of the source.
1146+
The default is ``None`` in which case a random name is assigned.
11431147
11441148
References
11451149
----------
@@ -1162,8 +1166,12 @@ def create_sbr_linked_antenna(
11621166
if self.solution_type != "SBR+":
11631167
self.logger.error("Native components only apply to the SBR+ solution.")
11641168
return False
1165-
compName = source_object.design_name
1166-
uniquename = generate_unique_name(compName)
1169+
1170+
if source_name is None:
1171+
uniquename = generate_unique_name(source_object.design_name)
1172+
else:
1173+
uniquename = generate_unique_name(source_name)
1174+
11671175
if source_object.project_name == self.project_name:
11681176
project_name = "This Project*"
11691177
else:

0 commit comments

Comments
 (0)