I am exporting data from Revit to Excel and then importing that (updated) data back into Revit. I’m using the unique element IDs to ensure the correct elements are being updated in Revit. What I have works, but takes a LONG time to run because during the import portion I am comparing two lists with approximately 3000 items in each. The number of elements (rows) in the spreadsheet will not change. However, from the time the data is exported to the time it is imported, Revit elements may be added or deleted. Therefore, I must filter both lists by elements common in both. BTW, I am already filtering the Revit elements for only those types that were exported. Is there a better way?
Why is there a need in comparing the unique ids?? why cant you just get element by unique ids??
Good point. What if some of those elements no longer exist in the model? I still need to make sure both lists match.
@Jason_Seck You can use the List.IndexOf node to make the comparison faster. If the ID is not found it will return -1 for that ID and hence we check for values >=0.
Other alternatives include using these nodes:
but since you are looking for a Boolean mask, I would suggest you go for the 1st option.
You’d probably be better off with a database-approach, rather than Excel & Dynamo list functions
Far quicker- although a bit of work to set up
I’ve attached an SQLite export of one of the Revit sample models. You’ll need something like SQLite Studio (free) to open it. The below Dynamo graph uses the Slingshot package
RevitExport.txt (1.7 MB)
do you know how to use python?? you can easily try and search for it, and skip if not found.
EDIT: pseudo code
doc = DocumentManager.Instance.CurrentDBDocument
uiapp = DocumentManager.Instance.CurrentUIApplication
app = uiapp.Application
for uniqueid in uniqueids:
ele = doc.GetElement(uniqueid)
if ele: #element found in model
#Do your stuff here
else:
#Do your stuff here
@ Andrew_Hannell Thank you for the suggestion. I’d like to keep everything in Revit/Excel to keep it simple for the end users. I will keep this workflow in mind though.
@ AmolShah Thanks for the suggestion. List.IndexOf seems much faster than my original approach. I did try List.SetIntersection, but as you stated, I was looking for a Boolean Mask.