Element.ParameterSet to Elements in groups

I’m trying to add new parameters and assign parameter values to objects that are in groups (sometimes nested multiple levels of groups / families) in Revit, but I’m running into two problems:

  1. The AddParameterKey.ByName component wont add the new parameter to objects in groups.
    Another question: Is there a way to add a new parameter to only certain elements?

  2. Element.ParameterSet returns the error:
    "1. :heavy_check_mark: Changes to groups are allowed only in group edit mode. Use the Edit Group command to change to all instances of a group type. You may use the “Ungroup” option to proceed with this change by ungrouping the changed group instances. {3399193, 7985823, 7985824, 7985825, 7985826, 7985827, 7985828, 8007971, 8007972, 8007973, 8007974, 8007975, 8007976} "

Is there a way to get around this?

Thanks

Hey @bushdylanj
I’m gonna answer your second question first. Revit API does not have support for editing groups as of yet. However, the Revit engine will allow the API to make changes to a group as long as there is only One instance of that group in the model.

In regards to the AddParameterKey.ByName, the component creates a Project Parameter and ties that to all Revit categories. So it will definitely show up on the grouped elements as well. However Revit will not allow the user to change the address unless Revit is in “Edit Group” context.

Hope this helps. Let me know if you need more info,

1 Like

Thanks Ehsan,

After looking through some Revit forums, I found that I was able to assign parameter values to grouped elements by first creating the parameter, and then Manage tab > Project Parameters > Modify …
and then under Parameter Data, changing the setting to “Values can vary by group instance”

Not a perfect workaround, since I’ll have to cycle through each group instance to apply the values, but it’ll get the job done.

1 Like