How to extract Design Point information using Workbench or Mechanical scripting?

Nikos Kallitsis
Nikos Kallitsis Member, Employee Posts: 24
First Anniversary First Comment Ansys Employee Name Dropper

I'm trying to get the information from the Table of Design Points in the Parameter Set stored as variables. How can I do that using either Workbench or Mechanical scripting?

Best Answer

  • Nikos Kallitsis
    Nikos Kallitsis Member, Employee Posts: 24
    First Anniversary First Comment Ansys Employee Name Dropper
    Answer ✓

    The data in the Table of Design Points is accessible by using Workbench Scripting commands. The most effective and direct way to approach this would be to use Workbench's Scripting console (File > Scripting). With the following script you can retrieve the most essential information regarding the data in the parameters table:

    # Create list of lists containing essential Parameter information
    parameter, parameterName, parameterValueType, parameterValue, parameterValueUnit = ([] for i in range(5))
    for param in Parameters.GetAllParameters():
    parameters = [parameter, parameterName, parameterValueType, parameterValueUnit]
    # Create list of lists containing essential Design Point information
    designPointName, designPointValues = ([] for i in range(2))
    for dp in Parameters.GetAllDesignPoints():
        subList = []
        for param in Parameters.GetAllParameters():
    designPoints = [designPointName, designPointValues]

    The same commands can be executed through Mechanical Scripting. This would, however, require to import the Workbench Journal library (wbjn). An intro guide to this approach can be found here.

    In summary, you would create a parameters_cmd and designPoints_cmd that contain the respective section of the above commands enclosed in triple (''') quotes, and issue a returnValue() function for the parameters and designPoints lists. For example:

    import wbjn
    parameters_cmd = '''
    param = wbjn.ExecuteCommand(ExtAPI,parameters_cmd)
    designPoints_cmd = '''
    dp = wbjn.ExecuteCommand(ExtAPI,designPoints_cmd)


  • M
    M Member, Employee Posts: 230
    First Comment First Anniversary Ansys Employee Solution Developer Community of Practice Member

    This has always been a pain and I am glad Nikos had the ability to figure it out!