Revit tags host association

Hi There, I’m trying to make a script which autopopulates which revit family type tag is used based on certain parameter information of the host element. I got something to kind of work in dynamo which assigns family type tags based on a list of values… but there is nothing to match to make sure the tag is properly referencing the value from it’s specific element. My question is – does anyone know a good way to tap into revits api either in dynamo or in python shell to grab which tags are associated with what elements specifically?

Hi @acher92, let me google that for you :wink:

The first result for the terms “revit api tags association” is this article from jeremy tammik, that states that there is no direct way to do that, but offers a couple of workarounds.

The most direct way to do this would be:

  • Get elements you want to query
  • Get all tags of given type
  • Ask them for their tagged elements
  • Check which of those tags are tagging the original elements

Key methods/properties to use along the way:

Example of a filtered element collector targeting a builtin parameter:

REVIT_DOC = revit.doc
BIP_TYPENAME = DB.BuiltInParameter.SYMBOL_NAME_PARAM

col_rule  = DB.ParameterFilterRuleFactory.CreateEqualsRule(DB.ElementId(BIP_TYPENAME), "Your type name", False)
col_filt  = DB.ElementParameterFilter(col_rule)
viewportTypes_all = DB.FilteredElementCollector(REVIT_DOC).WhereElementIsElementType().WherePasses(col_filt).ToElements()

Tagged elements:

Hope that helps!

1 Like