How to run pyaedt script on an already loaded project. #4112
Replies: 2 comments 2 replies
-
Hello, Let's say I have a generic script that I would like to run in my current project, which can be an instance of any EDT app, then how can I load it without having to specify the app? Best regards, |
Beta Was this translation helpful? Give feedback.
2 replies
-
Thanks a lot! that one seems much easier to implement, thank you |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Question: How to run pyaedt script on an already loaded project.
Answer: I can see 3 ways to do it:
Using the console
*Use the relevant import:
-Hfss for HFSS
-Hfss3dLayout for HFSS 3D Layout
-…
Now you can enter any command like in a script
Below you see a sample of pyaedt command in the console
-When you want to stop using the console you have to type:
-h3dl.save_project() if you want to save
-h3d.release_desktop(close_projects=False, close_desktop=False) if you want to keep the project open
Caution
It is mandatory to release the desktop so AEDT can be released.
If you don't do it, you will not be able to close AEDT after stopping the console (except from killing the process from the task manager). >In case you open the console and don't do anything you will have to enter the following command:
desktop.release_desktop(close_projects=False, close_on_exit=False)
For more information on command, you can look in documentation: https://aedt.docs.pyansys.com/version/stable/
Project after closing the console
Run a python script
Using PyAEDT Menu select "Run PyAEDT script
-AEDT is launched and a project is loaded
-In PyAEDT Menu select "Run PyAEDT script"
-From the window select the script to run and click Open
Below is a simple script that will create and add a setup in HFSS 3D Layout design:
Project after script is executed
Adding a Icon linked to a specific script
-It is possible to add an icon in the “Automation” bar. This is documented here:
https://aedt.docs.pyansys.com/version/0.7/API/_autosummary/pyaedt.desktop.Desktop.add_script_to_menu.html#pyaedt.desktop.Desktop.add_script_to_menu
-Close and reopen the project to see the icon AddSetup
-Click AddSetup icon to execute the script
Beta Was this translation helpful? Give feedback.
All reactions