Skip to content

Commit 9b2610d

Browse files
authored
fix q3d dynamic link (#4220)
* fix link type name based on aedt version * clean * return object * fix aedt version * improve q3d link * raise error
1 parent 82f373a commit 9b2610d

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

pyaedt/twinbuilder.py

+13-8
Original file line numberDiff line numberDiff line change
@@ -374,8 +374,8 @@ def add_q3d_dynamic_component(
374374
375375
Returns
376376
-------
377-
bool
378-
``True`` when successful, ``False`` when failed.
377+
:class:`pyaedt.modeler.cad.object3dcircuit.CircuitComponent` or bool
378+
Circuit component object if successful or ``False`` if fails.
379379
380380
References
381381
----------
@@ -481,7 +481,10 @@ def add_q3d_dynamic_component(
481481
port_info_list.extend(port_info_list_A)
482482
port_info_list.extend(port_info_list_B)
483483
if not state_space_dynamic_link_type or state_space_dynamic_link_type == "RLGC":
484-
state_space_dynamic_link_type = "{}RLGCTBLink".format(design_type)
484+
if dkp.aedt_version_id >= "2024.1": # pragma: no cover
485+
state_space_dynamic_link_type = "Q3DRLGCLink"
486+
else:
487+
state_space_dynamic_link_type = "{}RLGCTBLink".format(design_type)
485488
q3d_model_type = 1
486489
ref_pin_style = 5
487490
enforce_passivity = False
@@ -566,8 +569,10 @@ def add_q3d_dynamic_component(
566569
]
567570
)
568571

569-
self.modeler.schematic.create_component(component_library="", component_name=component_name)
570-
571-
if is_loaded:
572-
app.close_project(save_project=False)
573-
return True
572+
component = self.modeler.schematic.create_component(component_library="", component_name=component_name)
573+
if component:
574+
if is_loaded:
575+
app.close_project(save_project=False)
576+
return component
577+
else: # pragma: no cover
578+
raise ValueError("Error in creating the component.")

0 commit comments

Comments
 (0)