# Find sheet for certain view

**URL:** <https://forum.dynamobim.com/t/find-sheet-for-certain-view/50946>\
**Category:** Revit\
**Created:** [May 21, 2020, 10:47pm UTC](https://forum.dynamobim.com/t/find-sheet-for-certain-view/50946 "2020-05-21T22:47:22Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Garbage\_Collector](https://avatars.discourse-cdn.com/v4/letter/g/da6949/32.png) [@Garbage\_Collector](https://forum.dynamobim.com/u/Garbage_Collector)\
**Post date:** [May 21, 2020, 10:47pm UTC](https://forum.dynamobim.com/t/find-sheet-for-certain-view/50946/1 "2020-05-21T22:47:22Z")

</div>

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](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/f/0/f0aadd992893a7610695bd7b921e576a7ffdb5ab.png)

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

---

<div class="post-metadata">

**Author:** ![jshial](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/jshial/32/91559_2.png) [@jshial](https://forum.dynamobim.com/u/jshial)\
**Post date:** [May 22, 2020, 2:29am UTC](https://forum.dynamobim.com/t/find-sheet-for-certain-view/50946/2 "2020-05-22T02:29:52Z")

</div>

@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

```

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/2/e/2ea36505d61dafa787f2743b5a1d57927b95fda4.png)

---

<div class="post-metadata">

**Author:** ![Garbage\_Collector](https://avatars.discourse-cdn.com/v4/letter/g/da6949/32.png) [@Garbage\_Collector](https://forum.dynamobim.com/u/Garbage_Collector)\
**Post date:** [May 22, 2020, 8:02am UTC](https://forum.dynamobim.com/t/find-sheet-for-certain-view/50946/3 "2020-05-22T08:02:22Z")

</div>

> [@jshial](#):
>
> ```auto
> 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)
> 
> ```

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](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/8/a/8acabb51ad0d07ae89ffc0e74ca81a1040898a40.png)

---

<div class="post-metadata">

**Author:** ![jshial](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/jshial/32/91559_2.png) [@jshial](https://forum.dynamobim.com/u/jshial)\
**Post date:** [May 22, 2020, 9:00am UTC](https://forum.dynamobim.com/t/find-sheet-for-certain-view/50946/4 "2020-05-22T09:00:10Z")

</div>

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](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
```

---

<div class="post-metadata">

**Author:** ![Garbage\_Collector](https://avatars.discourse-cdn.com/v4/letter/g/da6949/32.png) [@Garbage\_Collector](https://forum.dynamobim.com/u/Garbage_Collector)\
**Post date:** [May 22, 2020, 9:12am UTC](https://forum.dynamobim.com/t/find-sheet-for-certain-view/50946/5 "2020-05-22T09:12:14Z")

</div>

Thanks, the script works now!

But i dont think the output is correct. ☹  
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?

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/7/5/7594571b5127f7b130597f1edda3105541197bc2.png)

---

<div class="post-metadata">

**Author:** ![Garbage\_Collector](https://avatars.discourse-cdn.com/v4/letter/g/da6949/32.png) [@Garbage\_Collector](https://forum.dynamobim.com/u/Garbage_Collector)\
**Post date:** [May 22, 2020, 9:15am UTC](https://forum.dynamobim.com/t/find-sheet-for-certain-view/50946/6 "2020-05-22T09:15:15Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![jshial](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/jshial/32/91559_2.png) [@jshial](https://forum.dynamobim.com/u/jshial)\
**Post date:** [May 22, 2020, 9:16am UTC](https://forum.dynamobim.com/t/find-sheet-for-certain-view/50946/7 "2020-05-22T09:16:11Z")

</div>

```
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?

---

<div class="post-metadata">

**Author:** ![Garbage\_Collector](https://avatars.discourse-cdn.com/v4/letter/g/da6949/32.png) [@Garbage\_Collector](https://forum.dynamobim.com/u/Garbage_Collector)\
**Post date:** [May 22, 2020, 9:18am UTC](https://forum.dynamobim.com/t/find-sheet-for-certain-view/50946/8 "2020-05-22T09:18:35Z")

</div>

Thanks for your quick responses!!

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/8/f/8f376c2b859c09076de2028e6d214a9265956e4f.png)

---

<div class="post-metadata">

**Author:** ![jshial](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/jshial/32/91559_2.png) [@jshial](https://forum.dynamobim.com/u/jshial)\
**Post date:** [May 22, 2020, 9:21am UTC](https://forum.dynamobim.com/t/find-sheet-for-certain-view/50946/9 "2020-05-22T09:21:15Z")

</div>

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

What does Sheet width filter do?

---

<div class="post-metadata">

**Author:** ![Garbage\_Collector](https://avatars.discourse-cdn.com/v4/letter/g/da6949/32.png) [@Garbage\_Collector](https://forum.dynamobim.com/u/Garbage_Collector)\
**Post date:** [May 22, 2020, 9:25am UTC](https://forum.dynamobim.com/t/find-sheet-for-certain-view/50946/10 "2020-05-22T09:25:54Z")

</div>

"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)

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/c/a/ca00809e16da3463ade05edd89c3d08bbf13e911.png)

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

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/4/c/4c6dc1efcdb100091c9f9c74263588934d52423b.png)

---

<div class="post-metadata">

**Author:** ![Garbage\_Collector](https://avatars.discourse-cdn.com/v4/letter/g/da6949/32.png) [@Garbage\_Collector](https://forum.dynamobim.com/u/Garbage_Collector)\
**Post date:** [May 22, 2020, 9:29am UTC](https://forum.dynamobim.com/t/find-sheet-for-certain-view/50946/11 "2020-05-22T09:29:42Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![jshial](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/jshial/32/91559_2.png) [@jshial](https://forum.dynamobim.com/u/jshial)\
**Post date:** [May 22, 2020, 9:40am UTC](https://forum.dynamobim.com/t/find-sheet-for-certain-view/50946/12 "2020-05-22T09:40:18Z")

</div>

why the output of your custom node is FamilyInstance? you sure you are not filtering the family? ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/3/1/3168a9a4794fffa1035e951eac4b52cc18b2da82.png)

I’m slightly confused…

---

<div class="post-metadata">

**Author:** ![Garbage\_Collector](https://avatars.discourse-cdn.com/v4/letter/g/da6949/32.png) [@Garbage\_Collector](https://forum.dynamobim.com/u/Garbage_Collector)\
**Post date:** [May 22, 2020, 9:48am UTC](https://forum.dynamobim.com/t/find-sheet-for-certain-view/50946/13 "2020-05-22T09:48:18Z")

</div>

To clarify,

This is the first part of the script:

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/e/4/e4044de2195d3ff5bc23deb7330d1488f040da7e.png)

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…

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/8/8/88c63e9dbac0c31b0d68aaf41115a454fcb9d579.png)

---

<div class="post-metadata">

**Author:** ![Garbage\_Collector](https://avatars.discourse-cdn.com/v4/letter/g/da6949/32.png) [@Garbage\_Collector](https://forum.dynamobim.com/u/Garbage_Collector)\
**Post date:** [May 22, 2020, 9:48am UTC](https://forum.dynamobim.com/t/find-sheet-for-certain-view/50946/14 "2020-05-22T09:48:36Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![jshial](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/jshial/32/91559_2.png) [@jshial](https://forum.dynamobim.com/u/jshial)\
**Post date:** [May 22, 2020, 9:57am UTC](https://forum.dynamobim.com/t/find-sheet-for-certain-view/50946/15 "2020-05-22T09:57:44Z")

</div>

of course, helpful for gathering help from more people.

---

<div class="post-metadata">

**Author:** ![Garbage\_Collector](https://avatars.discourse-cdn.com/v4/letter/g/da6949/32.png) [@Garbage\_Collector](https://forum.dynamobim.com/u/Garbage_Collector)\
**Post date:** [May 22, 2020, 10:04am UTC](https://forum.dynamobim.com/t/find-sheet-for-certain-view/50946/16 "2020-05-22T10:04:12Z")

</div>

The custom nodes used:  
[Sheet afmeting filter.dyf](https://forum.dynamobim.com/uploads/short-url/1QrwdO80OELKVLf3js0i3frdCRN.dyf) (31.1 KB) [Sheet width filter.dyf](https://forum.dynamobim.com/uploads/short-url/62ExRspW2YELn7bh1kQbXJrDzvO.dyf) (29.9 KB)  
[Sheet filter.dyf](https://forum.dynamobim.com/uploads/short-url/4KANIUqYHV5jXpGiHdS1oZ4OYGy.dyf) (9.1 KB)

The script:

[Batch plot script.dyn](https://forum.dynamobim.com/uploads/short-url/fF5uT1LfSAgNYrjE3V9kBsPiPo2.dyn) (406.2 KB)

---

<div class="post-metadata">

**Author:** ![Garbage\_Collector](https://avatars.discourse-cdn.com/v4/letter/g/da6949/32.png) [@Garbage\_Collector](https://forum.dynamobim.com/u/Garbage_Collector)\
**Post date:** [May 22, 2020, 10:32am UTC](https://forum.dynamobim.com/t/find-sheet-for-certain-view/50946/17 "2020-05-22T10:32:41Z")

</div>

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

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/d/d/dd84fd4fba1df42536591922777fab0b695a13b7.png)

---

<div class="post-metadata">

**Author:** ![Alban\_de\_Chasteigner](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/alban_de_chasteigner/32/39650_2.png) [@Alban\_de\_Chasteigner](https://forum.dynamobim.com/u/Alban_de_Chasteigner)\
**Post date:** [May 22, 2020, 12:36pm UTC](https://forum.dynamobim.com/t/find-sheet-for-certain-view/50946/18 "2020-05-22T12:36:13Z")

</div>

You should use a Sheet to Titleblock node and use list management or _Element.OwnerView_ to return to your sheet.  
 ![Sheet to Titleblock](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/c/4/c4311f96419101ff69a02b02ab74df9914297dcd.png)

![Titleblock to sheet](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/8/a/8a4fe55c66e8c2705280cd6bb9ac636baf223011.png)

---

<div class="post-metadata">

**Author:** ![Garbage\_Collector](https://avatars.discourse-cdn.com/v4/letter/g/da6949/32.png) [@Garbage\_Collector](https://forum.dynamobim.com/u/Garbage_Collector)\
**Post date:** [May 22, 2020, 1:11pm UTC](https://forum.dynamobim.com/t/find-sheet-for-certain-view/50946/19 "2020-05-22T13:11:01Z")

</div>

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…

---

<div class="post-metadata">

**Author:** ![Alban\_de\_Chasteigner](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/alban_de_chasteigner/32/39650_2.png) [@Alban\_de\_Chasteigner](https://forum.dynamobim.com/u/Alban_de_Chasteigner)\
**Post date:** [May 22, 2020, 1:18pm UTC](https://forum.dynamobim.com/t/find-sheet-for-certain-view/50946/20 "2020-05-22T13:18:58Z")

</div>

> [@Garbage\_Collector](#):
>
> is the sheet the owner of the element or not

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

[Next page](https://forum.dynamobim.com/t/find-sheet-for-certain-view/50946.md?page=2)
