Get GroupType by name? Is this possible?


Hello everyone, how are you doing?
I’m new to Dynamo.
I’m trying to find a way to simplify the creation of shared parameters in mechanical equipment families, and I came across a very interesting tutorial that does this. The developer is Mr. @AussieBIMGuru.
However, I’m encountering this error.
Can anyone help me???

Ok so if you followed the tutorial. Gavin will know what is happening here. Otherwise for the most part you have emailed the mechanic a picture of your car and asked them how to fix it with no additional information.

Save us some time watching his tutorial please and provide us with error messages and data from nodes in a complete snip of your graph :slight_smile:

I’m sorry, I didn’t intend to waste anyone’s time, but you’re right, my information isn’t sufficient for them to help me. I’m new here and also new to Dynamo, and I thought it would be easy to convert a String into a GroupType, which is why I only sent a snippet. Anyway, I appreciate it and will send the complete image.

Also, here is a link to the Excel spreadsheet with the source of the data.

https://controlarengenharia907-my.sharepoint.com/:x:/g/personal/wesleyoliveira_controlarengenharia907_onmicrosoft_com/ETH4qOZAt55LnpT37vaSzaEBfP9ALeqPrNggzEAQu-yMdA?e=jz9udo

Oh thats probably the way you needed to phrase that then. I have renamed the subject to indicate your intentions.

Ill look on monday for you :slight_smile:

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