I’ve run a search of previous posts but no solution found yet, so here goes:
I’m trying to select several room elements using a list of their Element IDs. I’m using Dynamo 1.2 and the latest release of the archi-lab nodes. The ID to Element node isn’t working when I plug in the list but it does work when I use a simple number node. This looks like a datatype problem, so I’m hoping there the solution here is fairly straightforward?
The output of List.ReplaceItemAtIndex wasn’t working as a valid input for the ID to Element node, so I’ve connected together the String from Object and String to Number nodes to make 100% sure I’m not being an idiot and feeding a non-number into this archi-lab node. Still - no dice!
Any help / pointers would be much appreciated. Thanks for reading!
Things just got stranger. I deleted the String.ToNumber node because I know Konrad’s node can take strings as well. But, it’s only recognising a few IDs, not all of them. Again, just to test, I’ve tested the same node against a code block, with a successful result.
Hi @T_Pover, thanks for the quick response.
I’ve just tried as you suggested and their types are 100% “System.Int32”, so a 32-bit integer.
Hi @Konrad_K_Sobon , does this look odd to you? This is an awesome node package, btw, I use it every day, so thanks for making it!
However, it won’t recognise some particular rooms, which is worrying.
Note: to the right I’ve brought over a watch node from another part of the graph, just to make sure rooms with this ID definitely do exist!
I’m beginning to worry I might have some corrupt room data…
@T_Pover Oh, could it be that this node doesn’t want to list the same room element twice? That might explain why we’re getting most, but not all of the rooms
I would think it would just return double rooms. I can’t take a look under the hood of Konrad’s node, but it should be something like this:
import clr
clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
doc = DocumentManager.Instance.CurrentDBDocument
ids = IN[0]
OUT = [doc.GetElement(x) for x in IN[0]]
if you copy paste that into a python node and input al the integers it should return the rooms you are looking for or return an error message that might give us a bit more insight into what’s going on.
import clr
clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
doc = DocumentManager.Instance.CurrentDBDocument
clr.AddReference("RevitAPI")
import Autodesk
from Autodesk.Revit.DB import *
ids = IN[0]
elements = [ElementId(x) for x in ids]
OUT = [doc.GetElement(x) for x in elements]
Hi @Kulkul unfortunately that can’t be recommended, it’s a large and relatively unhealthy file. I could potentially upload the Dynamo definition if that would help to clarify how the information is being treated?
@Kulkul Hmm… actually I can’t! “The following Element IDs are invalid and won’t be used: 16059285”.
I can select all of the IDs which @T_Pover 's code / Konrad’s node are finding, but none of the Element IDs which their nodes aren’t finding. Instead I just get that error message…
This mean that there’s something corrupt with my rooms?
Guys, I think I’ve worked it out - there are several overlapping rooms within the model. Deleting a few of these means the Archi-Lab node and T_Povver’s script can detect a few more room IDs.
Blame it on some dodgy modelling. Thanks for all your help I very much hope to return the favour some day!