Place Legend on sheet by Revit selection


Hello fellow contributors,

I have an issue I am trying to solve. Some of the members here helped me get a script working which places legends on sheets at specified coordinates. I am now looking to expand this tool to place by selection. For some reason while playing with it the only results I am getting are placement on a single selected sheet or placement on every sheet in the project. I’ve played with the settings and nodes quite a bit over the last 2 weeks and I am stumped. Any help would be greatly appreciated. Also under the view selection node is it possible to omit anything that isnt a legend? I have been looking for a solution there as well.


What errors are you getting? It could be that your Python input is expecting a list.
Have you looked into Data Shapes’ UI nodes? They are great for selecting sheets in a project.


I am not getting any errors it works just not as intended. On this attempt it placed the Legend on sheet “3207174” But ignored “3764420” even though I have both selected within Revit. I’ll take a look and see if that node you mentioned is one I have tried or not. I tried a few with no luck so far. This is the closest I have gotten.


You have them selected but you only have one Sheet going into your Python node.


That is my problem with this. I’m trying to understand why its dropping the adl sheets when I select more than 1.


The python node doesn’t care about what you have selected. It’s only running on the input sheets. Your codeblock a[0] is getting the item at index zero from your list, which happens to be a list of a single item. That’s the only sheet being run through python. If you’re selecting the sheets you want legends placed on then you want all of them going into the python node, there’s no need for a[0].

You also don’t need those nodes to have cross-product lacing. It’s not doing anything in this instance.


So If I understand correctly the problem is that the sheets are split into multiple lists and the python node is looking for s single list at index 0. So it sounds like 2 things are of concern, My sheets being split into multiple lists and that I am only including the sheets at index 0. Thank you for sharing that with me. I’ll give it another go. I just learned a little about how lacing works at Autodesk university last week but I am still struggling to wrap my head around it fully.


So your advice got it working thank you so much!. I removed the index 0 designation and changed my lacing to longest.


Most nodes don’t require lacing for a single list. Dynamo is smart enough to know that if you have a list of inputs for a node that you usually want the node to run on all items in that list. Lacing is usually necessary for multi-dimensional lists or functions that run on multiple lists.


Ah okay so when working with one list it doesn’t really matter then?

This image was used to teach us about its use during the workshop.


Correct. You’ll notice that each lacing option shows two lists. With a single list, there’s no lacing to be done. Dynamo just runs the node on all items.

This is slightly different for nodes that require a list as an input. Think of Flatten for example; normally it will Flatten the input into a single 1D list. However, if you want to Flatten sublists within the input list instead of the entire input, you can use Longest lacing to tell the node to treat each sublist like the input list.


That adds alot more clarity to how this all works thank you.