Get Elements by same parameter with different value


I’m trying to get a selection of all views on sheets and all sheets with at view placed on them.
Right now I’m able to get each group of elements, but the list structure doesn’t align, which I need to continue to modify the groups.

The views has “Sheet Name” as a parameter to find out if they are on sheets, and with this parameter can then select the filtered sheets and the corresponding views by their “Sheet Name” parameter.

The problem is that the sheets are sorted by the order they are selected in, and I want to order them by the “sheet Name” parameter just like the views, which i group by their sheet name key.

Basically, I need the list of sheets to have the same order of index as the grouped list of views on the sheets.

I think it might be easier to fit he other direction with this.

Start with all sheets, then get all views on each sheet. I believe Rhythm, Clockwork, Archi-Lab, or Genius Loci has a Sheet.Views node, and if not the Revit API certainly does: GetAllPlacedViews Method

Thanks for the quick reply JacobSmall.

I’ve been able to get a nested list with all views sorted, but I cant seem to get a filter for the sheets going.
Can you maybe point me in the right direction of what I’m doing wrong.
The management of list and nested list is not my strongest side.

I have two solution based on what I found on this forum as you can see in the picture.

The code block just iterates through the list and appends true or false to a list:

# Load the Python Standard and DesignScript Libraries
import sys
import clr
from Autodesk.DesignScript.Geometry import *

# The inputs to this node will be stored as a list in the IN variables.
dataEnteringNode = IN

SheetList = IN[0]
SheetParameterNames = IN[1]
# Place your code below this line
BooleanList = []

for i in SheetList:
	if i in SheetParameterNames:

# Assign your output to the OUT variable.
OUT = BooleanList

Hard to visualize what you’re after, but I think you have a list of views on each sheet right after your all elements of category node for sheets. Filter the sheet list from all elements of category where the sublists (@L2) is empty.

Im after a nested list of views matching with a list of sheets, to name a sheet parameter based on its containing view parameter, so it can be showed on a sheet schedule.

I hope this concept script is a bit clearer on what I want to do.

The problem I’m facing is getting a sheetlist and viewlist with matching index.

It looks to me like you have those already.

Sheet list would be in Red. View list would be in Cyan. :slight_smile:

Of course. I saw the empty lists as a probability of error. Thus needing to remove all the empty entries as well as the “empty” sheet.

The sorting is exactly as they need to be.

Thanks a lot for your help JacobSmall.

1 Like

Happy to help.

Your intuition is right about the empty lists being a potential point of failure. Using the empty test at level two to filter out sheets with no views from sheets with views may still be advisable for that reason. I think you can then use a List.Clean without preserving indices to keep the matching view-sheet list structure for the sheets with views, dealing with sheets without views separately.

1 Like