Go to the end to download the full example code
Enabling Control Program in a Maxwell 2D Project#
This example shows how you can use PyAEDT to enable control program in a Maxwell 2D project. It shows how to create the geometry, load material properties from an Excel file and set up the mesh settings. Moreover, it focuses on post-processing operations, in particular how to plot field line traces, relevant for an electrostatic analysis.
Perform required imports#
Perform required imports.
from pyaedt import downloads from pyaedt import generate_unique_folder_name from pyaedt import Maxwell2d
Set non-graphical mode#
Set non-graphical mode.
"PYAEDT_NON_GRAPHICAL" is needed to generate
You can set
non_graphical either to
non_graphical = False
Download .aedt file example#
Set local temporary folder to export the .aedt file to.
temp_folder = generate_unique_folder_name() aedt_file = downloads.download_file("maxwell_ctrl_prg", "ControlProgramDemo.aedt", temp_folder) ctrl_prg_file = downloads.download_file("maxwell_ctrl_prg", "timestep_only.py", temp_folder)
Launch Maxwell 2D#
Launch Maxwell 2D.
m2d = Maxwell2d(projectname=aedt_file, specified_version="2023.1", new_desktop_session=True, non_graphical=non_graphical)
Set active design#
Set active design.
m2d.set_active_design("1 time step control")
Get design setup#
Get design setup to enable the control program to.
setup = m2d.setups
Enable control program#
Enable control program by giving the path to the file.
Save project and close AEDT#
Save the project and close AEDT.
Total running time of the script: ( 0 minutes 55.229 seconds)