Export local variables from existing AEDT project

Ansys Staff
Ansys Staff Member, Employee Posts: 24
Ansys Employee Name Dropper First Comment Photogenic
✭✭✭✭

In an existing Ansys Electronic Desktop project, I have defined a list of variables (Design Properties > Local Variales). I want to export the variables and the values, so I can reuse them in a Python script with AEDTLib. How can I do that?

Tagged:

Best Answers

  • Ansys Staff
    Ansys Staff Member Posts: 29
    10 Comments
    Answer ✓

    Open the IronPython command window from Tools > Open Command Window.

    p = oDesktop.GetActiveProject()
    d = p.GetActiveDesign()
    vars = d.GetVariables()
    for v in vars:
      print (v, d.GetVariableValue(v))
    

    This should list all defined local variables like this:

    ('Stator_OD', '1800mm')
    ('Rotor_OD', '1510mm')
    ...
    
  • Samuel Lopez
    Samuel Lopez Member, Employee Posts: 22
    5 Answers 10 Comments First Anniversary Ansys Employee
    ✭✭✭✭
    Answer ✓

    With PyAEDT, you can access this data with the variable_manager:

    aedtapp = Hfss()
    aedtapp.variable_manager