Re-Order Excel list to match Revit Floorplan order

Reorder Excel.dyn (16.6 KB)

Reorder Excel.xlsx (11.8 KB)

Hi, I’m new to Dynamo and I’m having trouble reordering a Excel sheet to match up with my floorplan views.

In my Excel sheet I have the drawing numbers generated and broken down in to columns. Where I get Dynamo to create the levels and then views. I want my Dynamo graph to copy existing views that have been set up within the Revit File which have been called "MASTER - "
Views Masters

What I’m trying to achieve is copying the views and renaming them from the data from the Excel file. As following :-

The boxed number are in the wrong place.

But as you can see this is not happening. The associated levels to the views name do not match.
When the data is read from the Excel file it is read in a order grouped by the “drawing type” and then the “level”. But once a level as been created in Revit and viewed it is shown as being in alphabetically order.

First Time Rename

How do I reorder and rename a view that is read from Excel, to maintain the order that is read from Revit in order to rename the correct view associated the corresponding level.

I think I ether need to alternated the numbers to the views, or some how find a key value to rename all “Copy 1” = 600 and all “Copy 2” as 500,

I’m really at a point now where I’ve looked at this so much that I cant see the forest for the trees.

any help would be appreciated.

I can’t really up the whole graph as I played around and created some custom nodes.

if your case as i understand just to change Copy 1 to 600 & Copy 2 to 500

just get view name parameter then replace the values you want!

after that use set parameter tool to replace view name with new one

Khuzaimah, i tried this but found if i have more than the two drawing types (which start from 600…699 and 500…599) the drawing levels from Revit will not become associated to different amounts of levels, the list still then falls out of sync.

i require a base point to refer back to and relabel the correct level.

I’m unsure how i can create an unique list of 600’s 500’s (and what ever other number i require) count how many copies i have and assign that amount and rename them.

If anyone as an example of this i could give that a go in my graph.

Use Count and List.Cycle to get the necessary number of levels.

Thanks Nick for getting back, before a try this can i just run something by you.

If i have masters views created and i needed to duplicate the view would i count the number of copies and the number of drawing types to compare them in order to determine how many to rename?

Excel Screen Shot

From the screen shot above the green and blues in the list need to be duplicates of the masters levels/views already setup in the project, Where as the blue and yellows need to be dependant of the previous created blue duplicate. Would i need to count this information from the excel spread sheet. Because once the masters are created, both lists fall out of sync, as the Revit list would be listed alphabetically where as my excel sheet is grouped in to drawing types to help the engineers see how many drawings need to be create easily.

My uploaded dynamo graph shows what I have, and how I’m trying to pair up the information. But running this for the dependent views I get errors from the Code Block with the “IF” statements in, this is due to the value “1”…“3”… will/could never always be in the Revit views list.

Reorder Excel Info

I hope this is clear to all, and i hope you understand what i’m trying to explain. if you require any more info please ask and i’ll try my best.


After trying your suggestion, I’m still in the same situation as before.

I need to reorder the drawing types (600 - 500…) which are read from my excel sheet to fall in line with the alphabetically list that comes back out of Revit. see post below (above (5/5))

If they are named the same then just sort both lists by the same method (alphabetically in this case).

1 Like

Hi all I’ve had to but this on the back burnner for a while, and now i’ve had time to return back to it.

Is there a way to match up the order of one list with the orginal order of the source. I’m sure there is, but I can’t find a way of doing it.

That way the data will match up with the source data in the correct order for the output data to be correct.(if that make sence)

Normally i order lists as below but cross product can be very slow when there are lots fo data on your list.

Thanks Yam, I’ll give that ago

Try nodes like List.GetItemAtIndex and List.IndexOf, they are really useful whern trying to ‘remember’ the order of a given list.