Node Select.ByElementId - warrnings in some range of ID's

Hello everyone

I’ve got a problem with node Select.ByElementId.
Node shows warrnings while I induce numbers from range 300k-900k.

For example two situations:

First - 200k of ID’s range 100k-300k.
No warrnings, script is correct.

Second - same numbers of ID’s, range 300k-500k.
Warrning: Select.ByElementId operation failed

Have you any suggestions why is this happen?

Best wishes

if you do the same thing with a revit file comming from the template None, what happens?
just askin

On default Revit template it works without warrnings (even for 1 milion IDs)

edit: think i dont want this to sound too harsh

It looks like it’s a problem with my template.

I open my template again, in this time with audit.
I let script again. No warrnings, but still in background shows this wierd lines.

Do you know what it means?

No worries, it wasn’t :slight_smile:

1 Like

rebuild your template.
It may be a legacy problem, or someone that did it that no longer works at your company, abandon it i’d say, found the needle in the haystack

Not all elements can be directly selected as they may no longer be valid elements (but they are still in the database). Can you send a copy of the Revit file that causes this issue?

I send you the file in private message.

If we find a solution it will publish here, ofc :slight_smile:

Why do you need to select Revit elements in such an arbitrary way?

I need to rename all elements in template.
And this script is like “Ctrl+A” and “Ctrl+F” - I input all elements to script, next find those which have some phrase I want to change.

If you know a better way, I’m open for suggestions :slight_smile:

Would a filtered element collector help? You can use filters to collect elements with certain names or attributes.

import clr
import RevitServices
from RevitServices.Persistence import DocumentManager

import Autodesk
from Autodesk.Revit.DB import FilteredElementCollector, LogicalOrFilter, ElementIsElementTypeFilter

doc = DocumentManager.Instance.CurrentDBDocument
OUT = FilteredElementCollector(doc).WherePasses(LogicalOrFilter(ElementIsElementTypeFilter(False), ElementIsElementTypeFilter(True))).ToElements()

Do you know what is wrong?

Paste code into Python Script node instead of Python Script From String
Code blocks require script body to be put between parentheses and closed with semicolon.

1 Like

It worked without warrnings.
For sure, it’s more economic way than mine :slight_smile: Thank you.

But still there are the same wierd lines.
Do you know which elements can make this?

Those might leftovers from imports or other things. Please mark post as solved if your main question was answered.

Okay, I know what is it… It’s objects from the template under magnification so it’s nothing dangerous.
Thanks a lot for help!

1 Like