Find sheet for certain view

Hello all,
This is probably a really dumb question but here it goes…
I am making a script to print multiple sheets with different sizes at the same time.

Is there a node to get the sheet that belongs to the view?
To specify:
I used a filter by boolmask because this is the only way i know how but the bool is always true in my case so i doubt its needed…
image

To clarify, i need to get the output of the boolmask from the A0++ object without those nodes in between.

@Garbage_Collector

the other way around would be getting placed views from a sheet. try the following first, then you just find if a view is in the collection of placed views of a sheet.

test = []
for sheet in FilteredElementCollector(doc).OfClass(ViewSheet).WhereElementIsNotElementType():
	temp = [ sheet.Name, [doc.GetElement(v_id).Name for v_id in sheet.GetAllPlacedViews()] ]
	test.append(temp)
OUT = test

2 Likes

Hello Jshial,

Thank you for your response.
I copied your code but i get the following error:

File “”, line 11, in
NameError: name ‘FilteredElementCollector’ is not defined

I am probably missing something simple…

Here is a larger part of the script:

image

It’s just complaining “what is FilteredElementCollector” since it lives in RevitAPI.

More comprehensive introduction could be found here:
https://primer.dynamobim.org/10_Custom-Nodes/10-5_Python-Revit.html

try this, replace everything in the Python Node with the following.

import clr

clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *

clr.AddReference('RevitServices')
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager

doc = DocumentManager.Instance.CurrentDBDocument
uidoc = DocumentManager.Instance.CurrentUIApplication.ActiveUIDocument
sel = uidoc.Selection

test = []
for sheet in FilteredElementCollector(doc).OfClass(ViewSheet).WhereElementIsNotElementType():
	temp = [ sheet.Name, [doc.GetElement(v_id).Name for v_id in sheet.GetAllPlacedViews()] ]
	test.append(temp)

OUT = test
1 Like

Thanks, the script works now!

But i dont think the output is correct. :frowning:
Below i circled the output i need, which are the actual sheets and from your script the output is sheet name.
Could this be achieved by changing sheet.name to sheet in your script?

Also, the output gives me all the sheet names available, and i need only the sheets that correspond with the sizes you see on the left part of the screen

import clr

clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *

clr.AddReference('RevitServices')
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager

clr.AddReference('RevitNodes')
import Revit
clr.ImportExtensions(Revit.GeometryConversion)
clr.ImportExtensions(Revit.Elements)

doc = DocumentManager.Instance.CurrentDBDocument
uidoc = DocumentManager.Instance.CurrentUIApplication.ActiveUIDocument
sel = uidoc.Selection

test = []
for sheet in UnwrapElement(IN[0]):
	temp = [ sheet.Name, [doc.GetElement(v_id).Name for v_id in sheet.GetAllPlacedViews()] ]
	test.append(temp)

OUT = test

How’s this?

1 Like

Thanks for your quick responses!!

that node is expecting sheet view. the current output of Watch node is FamilyInstance.

What does Sheet width filter do?

"EDIT; I feel like i am just missing a node that matches the familyinstance with the sheets corresponding with it… Cant dynamo find the sheet that belongs to this family instance
Its a custom node made to filter sheet width parameter.

The input is all sheets with a height corresponding with an A0 sheet, and filters it further based on the sheet width so the output only sends A0++ in this case.

(The screenshot shows A2 because this node is used for all paper sizes)

I was able to get the correct output when i used a bool filter that matched a string with a titleblock name like below:
The problem is that i cant use titleblock names for filtering since they are different depending on the client

Im making a script to print all sheets in a selected viewset to pdf.
Since all our clients use different titleblock names i have to filter on sheet width and height, expecially since a lot of them also use sheet sizes which arent standard.

The next step in the sheet is matching the filtered sheets to a print setting, but i need the actual sheet for this

why the output of your custom node is FamilyInstance? you sure you are not filtering the family? image

I’m slightly confused…

To clarify,

This is the first part of the script:

When i double click the ID in the output of the sheet width filter, Revit opens the corresponding sheet so i am not sure why i cant just make Dynamo tell me what sheet it is…

Would it help if i uploaded the script? Its in Dynamo 2.0.3

of course, helpful for gathering help from more people.

The custom nodes used:
Sheet afmeting filter.dyf (31.1 KB) Sheet width filter.dyf (29.9 KB)
Sheet filter.dyf (9.1 KB)

The script:

Batch plot script.dyn (406.2 KB)

This seems to be doing the trick…
Does feel like a very, very long way around to find what i am looking for,

You should use a Sheet to Titleblock node and use list management or Element.OwnerView to return to your sheet.
Sheet to Titleblock

Titleblock to sheet

1 Like

Element ownerview does exactly what i was looking for!
Thanks!

I am rather new to dynamo, is the sheet the owner of the element or not?
I feel like there are some essential things about dynamo i just dont know…

Yes, the sheet is a view and owns 2D elements (such as titleblock, revision cloud, detail line…)

1 Like