Collect Tags

Why is it so hard to get all the tags in a view? What am I missing. Please help!

My first (unlikely) guess is the active view may not be what you think it is. In this case I can get window tags using either method. If a null is returned my guess is there aren’t any. Double check you have a single space between those names too, looks like it could be 2.

It appears some collectors don’t pick up tags which is frustrating, so if that node uses a similar collection method that could also be why (more likely, but can’t see the node’s innards), see below for an example:

image

As a desperate measure, this method exhausts most categories and seems to get the tags also. I use the ElementView node from my package (Crumple) to filter out all elements not specific to the view, so you’re left with mostly tags, dimensions, textnotes etc.

1 Like

Hi @michael.bronson are you using english version of Revit? Maybe try the same node of Springs package
Cheers

Hey there,

I suggest an alternative approach using the OwnedByView method. With that you can retrieve all view specific elements and from then on filter them to target the tags.

Here are the nodes and the Python snippet :

import clr

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

clr.AddReference('RevitServices')
import RevitServices
from RevitServices.Persistence import DocumentManager

doc = DocumentManager.Instance.CurrentDBDocument

active_view = IN[0]

view_specific_elements = FilteredElementCollector(doc).WhereElementIsNotElementType().OwnedByView(ElementId(active_view.Id)).ToElements()

OUT = view_specific_elements

So why does yours work, and mine does not? What Dynamo version are you using? I just installed Revit 2020 and 2021.

This is what I get.

Thanks for any help,
frustrated Mike

I ran a test on a new project with all doors, windows and walls tagged - and it works perfect as shown via Gavin’s response.(Thank you)

If I start a new project, add a link, tag all linked elements, it give me the error. Why would a linked element cause the “All Elements of Category” node to crash?

Thanks,
Mike

Hi,

This is indeed the reason.
Use the Collect.ElementsInView node from Spring Nodes or the SelectByCateOrType node of the Genius Loci package.
select

That’s exactly what was happening. Your solution worked perfect.

HUGE thank you to Alban. You saved my !#@@#%^&.

Mike in Maryland