Filter for hidden Revision clouds on a sheet

Filter for hidden Revision clouds on a sheet

Anonymous
Not applicable
1,559 Views
8 Replies
Message 1 of 9

Filter for hidden Revision clouds on a sheet

Anonymous
Not applicable

Hi,

I am working on an addin that hides/unhides the revision clouds of a certain revision on the sheets.

My filter to get the clouds looks like this:

 

clouds = new FilteredElementCollector(vs.Document, vs.Id).OfCategory(BuiltInCategory.OST_RevisionClouds).OfClass(typeof(RevisionCloud));

 

But this filter only finds the clouds which are not hidden.

I don't know how to modify this filter that the hidden clouds are also found?

I hope somebody can help me.

Thank you in advance.

0 Likes
Accepted solutions (1)
1,560 Views
8 Replies
Replies (8)
Message 2 of 9

bhprest
Advocate
Advocate

Revision clouds are dependent to the view that they are drawn in. So you can use the Element.GetDependentElements() method to retrieve all clouds on a sheet or in a view.

 

In python:

 

# This filter targets only RevisionClouds
filter = ElementCategoryFilter(BuiltInCategory.OST_RevisionClouds)

# GetDependentElements retrives all revision clouds 
# (in this case, in the active view)
elementIds = doc.ActiveView.GetDependentElements(filter)


tx = Transaction(doc, "Unhide hidden clouds")
tx.Start()

doc.ActiveView.UnhideElements(elementIds)

tx.Commit()

 

Hope this helps!

0 Likes
Message 3 of 9

Anonymous
Not applicable

Thank you for your answer.

"GetDependentELements" seems not to work with views/sheets.

Is this possible?

 

0 Likes
Message 4 of 9

bhprest
Advocate
Advocate

It definitely works for sheets and views. I tested the code above before replying. If you want, you can post your code, and I can take a look.

0 Likes
Message 5 of 9

Anonymous
Not applicable

Sorry. That was my fault. I forgot to mention that I create this addin for a project done in Revit 2018. I just read in the Internet that the method "GetDependentElements" was new to Revit 2019.

Maybe you have an idea how to do this in an other way?

 

0 Likes
Message 6 of 9

bhprest
Advocate
Advocate

Next thing that I would try is collecting all clouds in the entire document, and filtering them using the OwnerViewId property to get just the clouds on the view you’re interested in. 

This should return clouds regardless of visibility.

0 Likes
Message 7 of 9

Anonymous
Not applicable

What is the best way to filter all the clouds in the document inclusive the hidden ones?

0 Likes
Message 8 of 9

bhprest
Advocate
Advocate
Accepted solution

Just use a FilteredElementCollector, but don't specify a view Id.

 

So your code from your original post becomes:

clouds = new FilteredElementCollector(vs.Document).OfCategory(BuiltInCategory.OST_RevisionClouds).OfClass(typeof(RevisionCloud))

 

which can actually be improved upon:

 

clouds = new FilteredElementCollector(vs.Document).OfCategory(BuiltInCategory.OST_RevisionClouds).WhereElementIsNotElementType()

 

it appears to me that your OfClass and OfCategory calls are more or less overlapping, and shouldn't be necessary. The function WhereElementIsNotElementType() also helps filter out elements that are representing a type of element rather than a placed element.

0 Likes
Message 9 of 9

Anonymous
Not applicable

It works.

Thank you very much.

0 Likes