# Find dependent view where element is visible

**URL:** <https://forum.dynamobim.com/t/find-dependent-view-where-element-is-visible/16874>\
**Category:** Revit\
**Tags:** revit, clockwork\
**Created:** [November 27, 2017, 7:16pm UTC](https://forum.dynamobim.com/t/find-dependent-view-where-element-is-visible/16874 "2017-11-27T19:16:39Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Julie\_Kidder](https://avatars.discourse-cdn.com/v4/letter/j/f17d59/32.png) [@Julie\_Kidder](https://forum.dynamobim.com/u/Julie_Kidder)\
**Post date:** [November 27, 2017, 7:16pm UTC](https://forum.dynamobim.com/t/find-dependent-view-where-element-is-visible/16874/1 "2017-11-27T19:16:39Z")

</div>

I’m using Clockwork’s node Element.OwnerView to get the views that revision clouds appear in. It works great, except I get the primary views, rather than the sheeted dependent view where the cloud is visible. How can I find out which dependent view the cloud is visible in?

I’m trying to create a script that lists revision clouds, their comments and the sheets they appear on - I have an older one that primarily relies on borrowed python, and while it works it is really slow and becomes unusable on large projects.

---

<div class="post-metadata">

**Author:** ![awilliams](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/awilliams/32/114496_2.png) [@awilliams](https://forum.dynamobim.com/u/awilliams)\
**Post date:** [November 27, 2017, 9:28pm UTC](https://forum.dynamobim.com/t/find-dependent-view-where-element-is-visible/16874/2 "2017-11-27T21:28:06Z")

</div>

Hmm could you show a screenshot or elaborate more on how you are collecting the revision clouds that you are passing through the Element.OwnerView node? Hard to tell without seeing what you are currently working with, but maybe the “Elements in view by category” node from the MEPover package could help…

 ![elements in view](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/2/b/2bac249d968d7fb076d1575ba6774824cbf658ef.png)

Note the List.Flatten node’s sublists 0 and 1 both have a Revision Cloud with the same Element ID - this is because the second view is a dependent of the first view

---

<div class="post-metadata">

**Author:** ![Nick\_Boyts](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/nick_boyts/32/76313_2.png) [@Nick\_Boyts](https://forum.dynamobim.com/u/Nick_Boyts)\
**Post date:** [November 27, 2017, 9:53pm UTC](https://forum.dynamobim.com/t/find-dependent-view-where-element-is-visible/16874/3 "2017-11-27T21:53:04Z")

</div>

Archi-lab also has a few nodes - Sheet.Revisions will list all revisions on a sheet and RevisionCloud.Revision will get the revision instance from a revision cloud. You could use these to compare all Revision Clouds in the project to the Revisions on sheets.

---

<div class="post-metadata">

**Author:** ![Julie\_Kidder](https://avatars.discourse-cdn.com/v4/letter/j/f17d59/32.png) [@Julie\_Kidder](https://forum.dynamobim.com/u/Julie_Kidder)\
**Post date:** [November 27, 2017, 10:25pm UTC](https://forum.dynamobim.com/t/find-dependent-view-where-element-is-visible/16874/4 "2017-11-27T22:25:34Z")

</div>

Below is an image of what I was trying for: Getting all the revisions on the sheet, and then finding where the host views are. I was looking for a way to loop any primary views through some nodes that would identify the dependent views where the revision cloud is available.

It looks like the MEPover node could work if I pair it with other code to get the revisions directly on the sheet (and use the Springs.Sheet.Views+ node to get the views, since I have area plans on a sheet that cause the default node to fail) but I’d prefer to just run it on the dependent views of the identified host, so I’ll have to see if I can identify those views.

 ![Revision nodes](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/9/3/93cd8aad706eaa3d7dde6ea2201d9ab3b973fce9.png)

---

<div class="post-metadata">

**Author:** ![Julie\_Kidder](https://avatars.discourse-cdn.com/v4/letter/j/f17d59/32.png) [@Julie\_Kidder](https://forum.dynamobim.com/u/Julie_Kidder)\
**Post date:** [November 27, 2017, 10:28pm UTC](https://forum.dynamobim.com/t/find-dependent-view-where-element-is-visible/16874/5 "2017-11-27T22:28:45Z")

</div>

Sheet.Revisions just identifies the revisions a sheet has had. I don’t need the older revisions, and can get the current ones with a Revit schedule. RevisionCloud.Revision doesn’t solve the problem of identifying the location of the revision clouds.

---

<div class="post-metadata">

**Author:** ![Nick\_Boyts](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/nick_boyts/32/76313_2.png) [@Nick\_Boyts](https://forum.dynamobim.com/u/Nick_Boyts)\
**Post date:** [November 27, 2017, 10:35pm UTC](https://forum.dynamobim.com/t/find-dependent-view-where-element-is-visible/16874/6 "2017-11-27T22:35:55Z")

</div>

Ah never mind. I thought RevisionCloud.Revision was getting an instance of that revision.

---

<div class="post-metadata">

**Author:** ![awilliams](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/awilliams/32/114496_2.png) [@awilliams](https://forum.dynamobim.com/u/awilliams)\
**Post date:** [November 27, 2017, 11:52pm UTC](https://forum.dynamobim.com/t/find-dependent-view-where-element-is-visible/16874/7 "2017-11-27T23:52:00Z")

</div>

This got me curious of how to find the dependent views with the API, so I ended up quickly writing this python script out and I think it is achieving what you’re aiming for:

 ![revision cloud dependent views](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/7/f/7f9b58260d8c6dafa74ec4b77c908c380c42259e.png)

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

clr.AddReference('RevitServices')
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
doc = DocumentManager.Instance.CurrentDBDocument

views = UnwrapElement(IN[0])
dependents = []

for view in views:
	els = []
	ids = view.GetDependentViewIds()
	for id in ids:
		els.append(doc.GetElement(id))
	dependents.append(els)

OUT = dependents
```

---

<div class="post-metadata">

**Author:** ![Nick\_Boyts](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/nick_boyts/32/76313_2.png) [@Nick\_Boyts](https://forum.dynamobim.com/u/Nick_Boyts)\
**Post date:** [November 27, 2017, 11:59pm UTC](https://forum.dynamobim.com/t/find-dependent-view-where-element-is-visible/16874/8 "2017-11-27T23:59:44Z")

</div>

Dangit, Amy. I was just about to post this. 😄

---

<div class="post-metadata">

**Author:** ![awilliams](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/awilliams/32/114496_2.png) [@awilliams](https://forum.dynamobim.com/u/awilliams)\
**Post date:** [November 28, 2017, 12:04am UTC](https://forum.dynamobim.com/t/find-dependent-view-where-element-is-visible/16874/9 "2017-11-28T00:04:20Z")

</div>

Hah @Nick_Boyts ! I had to try it for myself!! 🤣

I was about to edit to add, however, that the list structure is lost in the Python script so some added work after the python script would need to be done to associate the Revision Clouds to the views… I think you’d have a better idea on how to fix that within the Python code. I noticed the list structure remains if I exclude the `doc.GetElement` part, but then there would need to be an “Element from ID” node afterwards 🤔

 ![revision cloud dependent views](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/2/5/253f16c6f02c2973b68d31d6ce4bc4475d346f99.png)

---

<div class="post-metadata">

**Author:** ![jacob.small](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/jacob.small/32/161030_2.png) [@jacob.small](https://forum.dynamobim.com/u/jacob.small)\
**Post date:** [November 28, 2017, 1:49am UTC](https://forum.dynamobim.com/t/find-dependent-view-where-element-is-visible/16874/10 "2017-11-28T01:49:25Z")

</div>

Out of curiosity, what happens if you get the workset from the revision cloud itself?

---

<div class="post-metadata">

**Author:** ![Nick\_Boyts](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/nick_boyts/32/76313_2.png) [@Nick\_Boyts](https://forum.dynamobim.com/u/Nick_Boyts)\
**Post date:** [November 28, 2017, 2:17pm UTC](https://forum.dynamobim.com/t/find-dependent-view-where-element-is-visible/16874/11 "2017-11-28T14:17:15Z")

</div>

You need one more nested list.

```
for view in views:
	els = []
	ids = view.GetDependentViewIds()
	for id in ids:
		els.append(doc.GetElement(id))
	dependents.append(els)
OUT = dependents
```

---

<div class="post-metadata">

**Author:** ![awilliams](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/awilliams/32/114496_2.png) [@awilliams](https://forum.dynamobim.com/u/awilliams)\
**Post date:** [November 28, 2017, 4:13pm UTC](https://forum.dynamobim.com/t/find-dependent-view-where-element-is-visible/16874/12 "2017-11-28T16:13:56Z")

</div>

Ah thank you @Nick_Boyts that makes sense now that I see it 😅 I edited my post with the code so it works with the initial list structure now

> [@jacob.small](#):
>
> Out of curiosity, what happens if you get the workset from the revision cloud itself?

@jacob.small sorry to answer your question for the original post-er, but I got curious myself as well;  
querying the revision cloud’s Workset only returns the primary views the same way that the Element.OwnerView node does… in retrospect, it makes sense, because it is a single element that is not duplicated or changed when it appears in dependent views, so I’d think it would need additional parameters to house information related to any dependent views it appears in

---

<div class="post-metadata">

**Author:** ![Julie\_Kidder](https://avatars.discourse-cdn.com/v4/letter/j/f17d59/32.png) [@Julie\_Kidder](https://forum.dynamobim.com/u/Julie_Kidder)\
**Post date:** [November 28, 2017, 11:57pm UTC](https://forum.dynamobim.com/t/find-dependent-view-where-element-is-visible/16874/13 "2017-11-28T23:57:59Z")

</div>

Thank you both for your help!  
@jacob.small I originally tried the workset route - the problem I was running into was that I could get a name, but not the view element, so I couldn’t get other data from it.

I ended up creating two different versions, which I’ll split and try on a more complex project to see if there is a time difference. Both use MEPover and Springs packages, the second also uses Clockwork.

- The first uses less nodes and doesn’t require the python script, but only works for the current revision. This is normally all that’s needed, so should be sufficient for most applications. It gets the sheets and then the revisions.

- The second has more nodes. It was based of my origina workflow of getting the revision clouds an then the sheets, but ended up being harder to code. A large code block is dedicated to getting the right sheet for revision clouds in dependent views, and was more clumsy to sort the sheets after identifying comments. The benefit of this script is that it is possible to get data for a revision that is not current.

 ![Revision comments 2 ways](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/5/e/5ee6f42a67a9a09434d54be3eccd912b7b142dc5.png)

---

<div class="post-metadata">

**Author:** ![Julie\_Kidder](https://avatars.discourse-cdn.com/v4/letter/j/f17d59/32.png) [@Julie\_Kidder](https://forum.dynamobim.com/u/Julie_Kidder)\
**Post date:** [November 29, 2017, 12:31am UTC](https://forum.dynamobim.com/t/find-dependent-view-where-element-is-visible/16874/14 "2017-11-29T00:31:42Z")

</div>

Well the second script, getting the revision clouds first and working backwards, definitely runs faster (on a large projects it was 2 minutes, while the other one is at 10 minutes & still going). The data was right on the project I used to build it, but on this larger project there are errors, some nulls get in, so I’ll have to track down what is causing that.

---

<div class="post-metadata">

**Author:** ![Steven](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/steven/32/112504_2.png) [@Steven](https://forum.dynamobim.com/u/Steven)\
**Post date:** [November 29, 2017, 12:58am UTC](https://forum.dynamobim.com/t/find-dependent-view-where-element-is-visible/16874/15 "2017-11-29T00:58:57Z")

</div>

This might be something for a different post but somewhat similar. When you cull the cloud from a Legend view how do you find what sheets it has been placed?

---

<div class="post-metadata">

**Author:** ![cftrevizo](https://avatars.discourse-cdn.com/v4/letter/c/848f3c/32.png) [@cftrevizo](https://forum.dynamobim.com/u/cftrevizo)\
**Post date:** [January 24, 2019, 6:39pm UTC](https://forum.dynamobim.com/t/find-dependent-view-where-element-is-visible/16874/16 "2019-01-24T18:39:30Z")

</div>

Any way you can post a pic with a higher detail to read the node titles or the script itself? I have a 3rd party tool that can export/report the data for revision info, but the script has utility for other situations. Thank you.

---

<div class="post-metadata">

**Author:** ![Julie\_Kidder](https://avatars.discourse-cdn.com/v4/letter/j/f17d59/32.png) [@Julie\_Kidder](https://forum.dynamobim.com/u/Julie_Kidder)\
**Post date:** [January 24, 2019, 7:13pm UTC](https://forum.dynamobim.com/t/find-dependent-view-where-element-is-visible/16874/17 "2019-01-24T19:13:15Z")

</div>

This is the script as it stands now. It works great in Dynamo 1.3, but if I try to open it in Dynamo 2.0 it crashes both dynamo and Revit, so I’ll need to see about recreating it from the image myself

Hopefully this is readable - I had to scale it down to meet the forum requirements.

 ![3-small](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/1/e/1ecf73ab509e866451953c80d0addc33e5da3c0d.png)

---

<div class="post-metadata">

**Author:** ![cftrevizo](https://avatars.discourse-cdn.com/v4/letter/c/848f3c/32.png) [@cftrevizo](https://forum.dynamobim.com/u/cftrevizo)\
**Post date:** [January 24, 2019, 7:26pm UTC](https://forum.dynamobim.com/t/find-dependent-view-where-element-is-visible/16874/18 "2019-01-24T19:26:23Z")

</div>

Sweet. Just one last request. What’s the Python Script found in the group “Find dependent views from the primary & replace them in the list”? Is it the stuff @awilliams & @Nick_Boyts posted?

---

<div class="post-metadata">

**Author:** ![Julie\_Kidder](https://avatars.discourse-cdn.com/v4/letter/j/f17d59/32.png) [@Julie\_Kidder](https://forum.dynamobim.com/u/Julie_Kidder)\
**Post date:** [January 24, 2019, 8:29pm UTC](https://forum.dynamobim.com/t/find-dependent-view-where-element-is-visible/16874/19 "2019-01-24T20:29:41Z")

</div>

Yes, its their scripts

---

<div class="post-metadata">

**Author:** ![csarkitek](https://avatars.discourse-cdn.com/v4/letter/c/7cd45c/32.png) [@csarkitek](https://forum.dynamobim.com/u/csarkitek)\
**Post date:** [June 11, 2021, 8:55am UTC](https://forum.dynamobim.com/t/find-dependent-view-where-element-is-visible/16874/20 "2021-06-11T08:55:50Z")

</div>

Hi awilliams,

I followed exact same steps but I got a _dereferencing a non pointer_ error. What would you suggest me to do? Thank you

 ![Capture](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/b/f/bf70c4d1b018fa387ffa6e81273f77056af1e4b3.jpeg)

[Next page](https://forum.dynamobim.com/t/find-dependent-view-where-element-is-visible/16874.md?page=2)
