We have an exciting announcement about badges coming in May 2025. Until then, we will temporarily stop issuing new badges for course completions and certifications. However, all completions will be recorded and fulfilled after May 2025.
电子产品

电子产品

1、 如何用Python启动AEDT并执行其他脚本?

    • Yang Zhao
      Ansys Employee
    • Yang Zhao
      Ansys Employee

      以下3种最简单的方法:

      1、 Copy以下2句到录制的脚本前面,便可以直接在Python中运行

      2、 # Mthod 1

      3、 # This method imports ScriptEnv to run aedt and script

      4、 import sys

      5、 sys.path.append(r'C:\Program Files\AnsysEM\v222\Win64\PythonFiles\DesktopPlugin')

       

      2、使用以下AEDT初始化方法,删除录制脚本中前面有效的4

      6、 #Method 2

      7、 #run aedt

      8、 from win32com import client

      9、  

      10、                   oApp = client.Dispatch("Ansoft.ElectronicsDesktop.2022.2")

      oDesktop = oApp.GetAppDesktop()

      oDesktop.RestoreWindow()

      oProject = oDesktop.NewProject()

       

      3、运行特定脚本这个需求是以下这两句来实现

      ##

      YourScript = r'C:\Program Files\AnsysEM\v222\Win64\syslib\Toolkits\HFSS\Wavelength Calculator.py'

      oDesktop.RunScript(YourScript)

Viewing 1 reply thread
  • 主题 ‘1、 如何用Python启动AEDT并执行其他脚本?’ 已关闭新回复.