Automation with Python in ANSYS Electronic Desktop

Population of an electrical machine’s stator slot with 240 conductors in ANSYS Electronic Desktop. The conductor’s position is determined by an outer boundary and coordinates which are randomly drawn from a uniform distribution.

Demo of the Algorithm

Example Code

import gc
from comtypes.client import CreateObject

iMaxwell = CreateObject("Ansoft.ElectronicsDesktop", clsctx=None, machine=None, interface=None, dynamic=True,
                        pServerInfo=None)
oDesktop = iMaxwell.GetAppDesktop()
oDesktop.RestoreWindow()
oProject = oDesktop.NewProject("Project")
oProject.InsertDesign("Maxwell 2D", "Design1", "Electrostatic", "")
oDesign = oProject.SetActiveDesign("Design1")
oEditor = oDesign.SetActiveEditor("3D Modeler")
oEditor.SetModelUnits(
    [
        "NAME:Units Parameter",
        "Units:=", "mm",
        "Rescale:=", False
    ]
)

# Enter your Automation here. Use the documentation or "Tools" -> "Record Script to File" to find commands. 

del oEditor
del oDesign
del oProject
del oDesktop
del iMaxwell
gc.collect()