Electronics

Electronics

Topics related to HFSS, Maxwell, SIwave, Icepak, Electronics Enterprise and more.

How to run python script from command line?

    • gswilsons
      Subscriber

      I am trying to run a python script that I wrote for ANSYS HFSS without the need to open up ANSYS and click tools > run script file >... etc. and would like to run the script from my windows command line instead. Would anyone happen to have any experience doing this sort of thing?


       


      Thus far I have discovered that assuming I am in the proper directory I can type the command "ansysedt.exe" to open HFSS, and I have found online that you can type things like "ansysedt.exe -R doStuff.wbjn" to run workbench journal files. However, when I try to use "ansysedt.exe -R doStuff.py" I just get an error about how I cannot open the project even though I am trying to run a script that builds a project from scratch.


       


      In short, does anyone know the command to run a python script without the need to manually run that script within the GUI? Ideally I would like to run ANSYS without the GUI entirely and just export the results from my simulation for post processing elsewhere.

    • Sorceress Gia
      Ansys Employee

      Non-graphical script execution is a beta feature in AEDT 2019 R3. You can enable it be going to 'Tools > Options > General Options' and then pressing the 'Beta Options' under General > Desktop Configuration.


      Then you can run a script non-graphically from the command line like this:


      "C:Program FilesAnsysEMAnsysEM19.5Win64ansysedt.exe" -features=beta -ng -runscriptandexit script_name.py aedt_file_name.aedt


       


       

    • gswilsons
      Subscriber

      This is exactly what I needed! Thank you so much for your help.

    • DongLe
      Subscriber
      Hi Peter,n If we use command line to run python script like this:n ansysedt.exe -features=beta -ng -runscriptandexit script_name.py aedt_file_name.aedtnin python script, Could you tell me how to get path of aedt file?nThank you.n
Viewing 3 reply threads
  • The topic ‘How to run python script from command line?’ is closed to new replies.