Export select information from excel to family parameters of revit

Hello,

i have a problema trying to import a determined information from an Excel i already have to Revit.
The idea is: i have an Excel where i clasify the rooms depending of its use with a code. In this list there are lots of uses ( all you can fine in different Project)

What i am trying to do with dynamo is to relate this code ( diferrent for each type of room) with a family room parameter called “ID_USO_ZONA”.

The problem is that i dont know how can i in dynamo combine my list of rooms from de Revit Project and the general list from Excel so as to identify which of these rooms are in the Project and include its correct identity code.

I have introduced in dynamo the columns of the Excel table i am interested in and also the parameters of the rooms ( name and ID_uso_zona) which i want to relate with, but i dont know how to continue.


Any help Will be welcome!!! thankssss

Get your list of room names from Excel and your your list of room names from Revit. Use List.ContainsItem to find which room names in Excel are also present in Revit. Filter the room names (and other parameters) from Excel that match using FilterByBoolMask. Sort your list of Revit rooms (by name) and your list of Excel data (by name) using SortByKey. Both lists should now be in the same order with the same rooms.

Thanks a lot !!! it seems it Will work but i dont really know how list.sortByKey Works… and also how can i make posible that the ID_usos_zona from Excel became the same as the Revit one. In the Revit model this parameter is empty, i want to complete it with this dynamo (if it is posible)

You’ll want to use FilterByBoolMask to filter your sublists of room data (Excel rows) for the rooms that exist in Revit. Then you’ll want to sort your Revit rooms by room name, and separately sort your Excel data by room name - both using SortByKey. SortByKey just lets you sort one list (list) by another list of values (keys).
image

okey and when i have this list how can i relate it to the ID column? this should also be related to the Excel ID row

i have empty in Revit the id parameter and i want it to become the same as in the id from Excel, that depends on the name of the room i listed before.

thanks for your time!!!

Once everything is in the same order you can just use Element.SetParameterByName to set the Revit value.

With the Revit value you mean the Id value number from Excel?
I understood how i filtered and list the names, but i cant make up my mind how to assign to them the Excel number information in relation with the room name……

thanks again!!

Sort everything by Room Name so all your data is in the same order. Then you just get the Id values from Excel and assign them to the Revit elements.

okey now i understand!! the problem is that i have for example multiple rooms that have the same name and should have also the same ID. It just affect the first rooms depending on how many ID recognised ( in this case the 5 first one) and the other take the last number. it doesnt work for all the rooms


i really appreciate your help!!

If you have multiple rooms with the same name / same number you can use GroupByKey after SortByKey.

but the multiple rooms are in Revit model not in Excel…

That is fine. You would sort everything so both lists are in the same order, then you would use GroupByKey to group the Revit rooms by name. So item [0] in your list of Excel Ids would go with list [0] of Revit rooms. As long as you use the correct list levels everything will work.

i dont know why but the values dont fix with the name… in Revit the values arent the ones that have to be…

it is almost done.!!thanksss

You need to use list levels. You want the value to be assigned to the entire sublist. Try elements @L2 with value @L1.

The problem i have is that it doesnt recognise the name with its associate number… i mean if the room call Oficina should be 50024 it doesnt appear that one. i dont know which criteria it use…

Then you’re not getting them sorted properly. Can you share all your files? (.rvt, .dyn, .xls)

i am new user so i cant attach document i dont know why…

You can post to Dropbox, Google Drive, or any other file sharing service.

can you give me your email in order to send you everything? thankss a lot

You had to clean up the room types from excel that weren’t in the model. Then you could group all the rooms by type and your lists would match. I cleaned up some of the filtering and grouping and it works now.

1.extraer-de-excel.dyn (29.8 KB)