Updating the objects after renaming them #5486
Replies: 5 comments
-
this is the message i'm getting, even though the property name is changed, when I'm printing imported bodies I'm getting this list **C:\Users\TE544300\python_venv_automation\Scripts\python.exe C:\To_be_copied\automation\aedt\ProgramsforMaxwell\trialdelete.py Process finished with exit code 0** |
Beta Was this translation helpful? Give feedback.
-
Hi @SK-mechcoder, You are used to the AEDT API, which indeed is not object-oriented. So when you modify a property of an object in the way you did, PyAEDT is not able to grab the update, and the only solution would be save the project and reload the PyAEDT object again, which I do not like because it is time consuming. I would use a more pythonic way, which is one of the main "powers" of PyAEDT:
As you can see "obj" is a python object which has all the information, properties and methods to manipulate it. Thanks, |
Beta Was this translation helpful? Give feedback.
-
Hello Samuelopez, I tried this code, the obj name has changed in the Electronics desktop but the imported bodies still produce same out before and after the property change. I attached my code below.
here are the messages from the console.
as you can see the references are not updated. |
Beta Was this translation helpful? Give feedback.
-
@SK-mechcoder You need to get the list of objects again: new_imported_bodies = SR6_relay.modeler.model_objects |
Beta Was this translation helpful? Give feedback.
-
Hello @Samuelopez-ansys , it worked perfectly, thanks for the help. |
Beta Was this translation helpful? Give feedback.
-
Hello, Good day,
This is the code I developed, the idea here is that I need to rename the object after importing it into the Ansys electronics desktop, but
Renaming through ChangeProperty works to update the name of the object, but it does not update the object’s reference in the model_objects list.
how to achieve that the object's reference is also get updated.
I attached my code below for reference.
Many thanks for considering my request.
Beta Was this translation helpful? Give feedback.
All reactions