Place Legends that corresponds to matching sheet

Very recently I posted on this from with a question on how to create legends base of a sheet list from a excel file and was pointed to some good information and was able to produce a dynamo script to successfully duplicate a legend based of sheet numbers in excel. So if I had sheet A101, A102, A103, I can duplicate a legend and It would be L101,L102,L103. Now I am trying automate the process of placing the legends onto existing sheets. I need legend L101 to be put on A101, L102 placed on A102 and so forth . With examples found on this forum I can create a dynamo file to place a single legend on multiple sheets but am struggling to get the work flow that I described about placing legends to corresponding sheets. Any help is appreciated.

Hi @dmillerSNYXQ,

If the legend names and sheet names match (at least partially) and list lengths also match you could sort these lists in order and they should be in equivalent pairs. You can then run both lists into whichever node you are using to place legends and that should do the trick.

However, you will need additional logic if sheets and legend names don’t match or if the lists are of unequal length. One way of automating this process from what you describe could be by finding all legends that begin with L, then replacing legend names character β€œL” with an β€œA” and then finding all sheets that match that name. This way you have equivalent lists in the same order and ready pass to the legend placer.

Cheers,
Dan

Thank you for your input. When I get back to the office I will focus on trying to filter my list to be matching lists. Still learning on how to manipulate the lists in Dynamo to give me what I need.

I am not sure what I am doing wrong. I am trying to familiarize my self with what needs to happen. I am just tying to create a list that contains created legends and a list that contains created sheet. Then use that to place the legends onto the sheets. I am still learning and have generated the lists but I get an error when trying to place the legends on the sheet. I am just trying to develop a proof of concept so that I can develop my skills and continue to develop a usable more complex graph. Again any help is greatly appreciated. I apologize if I am way off with a properly constructed graph, still just getting into the dynamo word.


I was able to get this graph to place matching legend to matching sheet. I am assuming that in my previous posted graph I was passing the wrong type of information. Now I need to work on how to handle the list when the legend list and sheet list do not match. For example I have 10 sheets but only 6 legends. Any suggestions would be appreciated. Again thanks.

hi @dmillerSNYXQ,

Apologies for the late reply, I have been exceptionally busy.

I have a node already that does what you want so thought I would just post it here

GetSheetsByName.dyn (6.3 KB)

This will find all the sheets in the project that either match perfectly or contain a string value. Just plug the legend view names (as string) into the ViewNames port (IN[0] and a boolean for whether you want to search with string contains filter IN[1].

Cheers,
Dan

1 Like

Thank you for all the help.

1 Like