I am looking for a way to form a Dynamo script that ensures that values which are red from a spreadsheet are assigned to the object it is meant for, but I need a little push in the right direction.
I have a Revit project that has several objects (wall, beams, columns and so on), but for this example let us say that my project just contains 10 walls. Each of them is given a unique ID: E.g. Wall-1 to Wall-10. Now I use Dynamo to export the information about these walls to an Excel spreadsheet, and then I send the spreadsheet to a co-worker. He updates the values and send it back to me. And when I want to import the values into my Revit project from the spreadsheet, my problem appears: What if I have made changes to my model (added, deleted or splitted walls) in between my co-worker gets the spreadsheet and sends it back to me , how can I be sure that Wall-3 gets the info for Wall-3 from the Excel sheet and not the info for Wall-4? I have experienced that Revit can change a wall’s position in a list when changes have been made. So, I want a code where I can be a 100 % sure that values are assigned to the correct object.
I think the solution might be to sort both the Excel list and the Revit list by my unique object ID. But I haven’t been able to find a working code for this yet.
You need to use the GUIDs for selection and tracking for this to work. Write the GUIDs out when you export to excel, and then have the coworker do their stuff (not modifying the GUID values), and use the GUID to select the items in the correct order when you go to push the values from excel back into Revit.
I believe Archi-Lab has a package for the selection, referring only to ID in the name (Select.ByID maybe?).
As an alternative to Jacob’s answer (which is probably the easiest), the other option is to use some kind of lookup- using a unique identifier such as the wall mark. Ideally, the solution should be able to cope with a missing record in either the model or the spreadsheet- so not rely on having exactly the same number of records in both, or on the sort order.
You can achieve this using Dynamo dictionaries, or a database lookup- there are examples of this on the forum.
It depends a bit on how many & what type of parameters (assume they are all instance parameters) are being updated in Excel
I think this will work, but if anyone sees that it could mix up my data I’m pleased to be informed. I know that one node will give a warning if the length of the Excel list doesn’t equal number of walls with ID number in Revit.
You might consider the Springs node I used rather than the standard ones since you can set a default value where there is not a matching key e.g. “unknown” or “not in spreadsheet” and this would prevent your error.
I don’t quite understand what you are doing with the string replace nodes- the parameter looks like it is numeric