All Instances from Element Type

Hello all,

I am missing something really simple here but for the life of me I cannot figure it out. I am trying to select all Text Instances of a Particular type. I know I can run All elements of type with TextNote rather than TextNoteType or all Elements of Category but that takes a long time to collect all the text notes. I only need the text notes of one of the text note types.

Thank you for all of your help,

I’m honestly drawing a blank on whether or not this is possible without Python :thinking: here’s the Python code I have for this:

import clr
import RevitServices
from RevitServices.Persistence import DocumentManager
from Autodesk.Revit.DB import *
doc = DocumentManager.Instance.CurrentDBDocument

texttype = UnwrapElement(IN[0])

if not isinstance(IN[0], list): texttype = [texttype]
alltext = FilteredElementCollector(doc).OfCategory(BuiltInCategory.OST_TextNotes)

texts = []

for type in texttype:
	for x in alltext:
		if x.TextNoteType.Id == type.Id:

OUT = texts

IN[0] should be the TextNoteType you are pulling with your x[0] Code Block but it can also accept a list of TextNoteTypes


That makes me feel better. I spent some time trying to figure this out. Thanks for the code @awilliams

You probably could do this:

I can’t find a way to get the elements without iterating through all text notes in document. The Python code above also does the same. Both are not ideal as number of texts in a project can be quite a lot.

I could be wrong on this, but I was under the assumption that the background processing of filtering elements in Python was faster than directly filtering through them in Dynamo… I have experienced myself that filtering a collection of all elements of a type in Dynamo tends to take longer than doing so in Python; If someone could correct me on this if I am wrong, I would truly appreciate it :blush:

1 Like

My assumption is that, even if Python runs faster, it takes longer to learn and, as Dynamo was meant to give access to coding for non-coders, using it is supposed to be the fastest way…

1 Like

I looked at doing it this way however it takes 1-2 minutes to gather each instance of text. I figured there was a way to grab all instances of a type but I guess not.

Thanks for the reply hzaman