Get GroupType by name? Is this possible?

Good Morning (NZ Time) @wesleyJHXGK

Hopefully this works for you. Given a list of strings, the code will check to see if the string matches any of the parameter grouptypes in the project and if there is, it will output it as a string for you to input into your list as required.

The handling of a not matching item is not strictly correct, but i’m assuming that your input list is perfect :wink:

I hope this answers your question, Have a great day!

Python Script
#Made by pyXam
#https://forum.dynamobim.com/u/pyxam

import clr
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import BuiltInParameterGroup
import System

# Collect the parameter groups and convert them to a string list
parameter_groups_enum = System.Enum.GetValues(BuiltInParameterGroup)
parameter_groups = [System.Enum.GetName(BuiltInParameterGroup, group) for group in parameter_groups_enum]

# Input from the user, ensure it's a list
input_strings = IN[0] if isinstance(IN[0], list) else [IN[0]]

# Initialize an empty list to store the matching results
output = []

# Iterate through each input string
for input_string in input_strings:
    # Initialize a flag to check if a match is found
    match_found = False
    
    # Convert the input string to lowercase for case-insensitive comparison
    input_string_lower = input_string.lower()
    
    # Iterate through the parameter groups and check for a match (as strings)
    for group in parameter_groups:
        if input_string_lower == group.lower():
            output.append(group)  # Append the matching group to the output
            match_found = True
            break  # Exit the loop once a match is found
    
    # If no match is found for the input string, append "No Match"
    if not match_found:
        output.append("No Match")

# Output the list of matching strings or "No Match" for each input
OUT = output