Element.ByID

I swear I had this working before, but it’s been a while since I used the Clockwork Element.ByID node.
I mocked up a sample of what I’m trying to do by passing in a list of Element IDs as strings, and nothing matches in the ByID node. Everything comes out unmatched.
Then I found the Archi_lab ByElementID node and it is giving me what I expect.
But, as I said, I swear the Clockworks node worked for me 6 months ago.

I should append that: The first two strings I passed in are valid Element IDs.
The third one (7) is intentionally invalid just to see what output I get.

It has something to do with the input being an INT. A little weird if it was working before.

I thought that was the point of the node…OOOhh!

I just realized that in my full graph, I’m getting these values from Excel. I wonder it that’s why they are INTs instead of strings.

But:
In my simplified example, I AM passing a list of string values.
Where would the INTs would be coming from in that case?

TBH i’m not entirely sure what the issue is. I’ve ran into this a few times as well.

The OOTB node gives an int, which doesn’t work for selection.

You have to convert the int to ElementId: http://www.revitapidocs.com/2017/3acc195c-36fa-4ec9-78e0-370a12fddda5.htm

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

doc = DocumentManager.Instance.CurrentDBDocument

OUT = doc.GetElement(ElementId(IN[0]))
1 Like