Export local variables from existing AEDT project

Options
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
    First Comment
    Answer ✓
    Options

    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: 20
    First Anniversary Ansys Employee 5 Likes First Answer
    Answer ✓
    Options

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

    aedtapp = Hfss()
    aedtapp.variable_manager