diff --git a/src/ansys/aedt/core/modeler/circuits/object_3d_circuit.py b/src/ansys/aedt/core/modeler/circuits/object_3d_circuit.py index 324640a4364..a0ebb31b43e 100644 --- a/src/ansys/aedt/core/modeler/circuits/object_3d_circuit.py +++ b/src/ansys/aedt/core/modeler/circuits/object_3d_circuit.py @@ -1086,6 +1086,23 @@ def create_pin_def(pin_name, x, y, angle): self._circuit_components.oeditor.MovePins(self.composed_name, -0, -0, 0, 0, ["NAME:PinMoveData"]) return True + @property + def component_path(self): + """Component definition path.""" + component_definition = self.component_info["Info"] + component_data = self._circuit_components.o_component_manager.GetData(component_definition) + if not component_data: + self._circuit_components._app.logger.warning("Component " + self.refdes + " has no path") + return False + if len(component_data[2][5]) == 0: + for data in component_data: + if isinstance(data, list) and isinstance(data[0], str) and data[0] == "NAME:CosimDefinitions": + if len(data[1][12]) == 0: + return component_data[17][2][4] + return (data[1][12][1].split(" ")[1])[1:-1] + else: + return component_data[2][5] + class Wire(object): """Creates and manipulates a wire.""" diff --git a/tests/system/general/test_21_Circuit.py b/tests/system/general/test_21_Circuit.py index b6e53eb1bc4..57266196724 100644 --- a/tests/system/general/test_21_Circuit.py +++ b/tests/system/general/test_21_Circuit.py @@ -1011,3 +1011,10 @@ def test_53_import_table(self): assert self.aedtapp.delete_imported_data(table) assert table not in self.aedtapp.existing_analysis_sweeps + + def test_54_get_component_path(self): + model = os.path.join(TESTS_GENERAL_PATH, "example_models", test_subfolder, "test.lib") + assert self.aedtapp.modeler.schematic.create_component_from_spicemodel(model) + assert list(self.aedtapp.modeler.components.components.values())[0].component_path + assert self.aedtapp.modeler.components.create_component(component_library="", component_name="RES_") + assert not list(self.aedtapp.modeler.components.components.values())[1].component_path