Retrieve parameters and values

Pernelle Marone-Hitz
Pernelle Marone-Hitz Member, Moderator, Employee Posts: 871
100 Answers 500 Comments 250 Likes First Anniversary
✭✭✭✭
edited November 2023 in Structures

Is it possible to retrieve information on the parameters defined in the Parameter Set of a WB project schematic?

Tagged:

Answers

  • Pernelle Marone-Hitz
    Pernelle Marone-Hitz Member, Moderator, Employee Posts: 871
    100 Answers 500 Comments 250 Likes First Anniversary
    ✭✭✭✭
    edited November 2023

    This script will work from the WB project schematic.

    parameter_list = Parameters.GetAllParameters() # retrieve all parameters
    input_parameter_list = [item for item in parameter_list if item.Usage =='Input'] # work only with input parameters
    for index,value in enumerate(input_parameter_list):
        try:
            print(input_parameter_list[index].Name)
            print(input_parameter_list[index].DisplayText)
            print(input_parameter_list[index].Expression)
            print(input_parameter_list[index].Value.Value)
            print(input_parameter_list[index].Value.Unit)
        except:
            print(input_parameter_list[index].Name)
            print(input_parameter_list[index].DisplayText)
            print(input_parameter_list[index].Expression)
            print(input_parameter_list[index].Value)
            print('NA')