prestonsmith
prestonsmith

Reputation: 778

Find Temporarily Hidden Elements In Revit View

I've got a method that checks on some visibility issues in Revit. The problem is that it throws an error on an extremely common issue: "a user manually hiding the element in it's view".

This line of code

public bool IsElementManuallyHidden(View view, Element element)
{
     return view.IsElementVisibleInTemporaryViewMode(TemporaryViewMode.RevealHiddenElements, _element.Id);
}

throws an ArgumentExceptionError stating that: "This view mode is not supported for checking element visibility."

Anyone know of any potential workarounds?

Upvotes: 0

Views: 1070

Answers (1)

prestonsmith
prestonsmith

Reputation: 778

Ok - apparently, two more seconds of work found me a workaround :).

public bool IsElementManuallyHidden(View view, Element element)
{
    return element.IsHidden(view) || view.IsElementVisibleInTemporaryViewMode(TemporaryViewMode.RevealHiddenElements, _element.Id);
}

with element.IsHidden(view) being the key factor. I don't love that I can't check the Temporary modes though so if anyone has a better answer, I'll accept that instead.

Upvotes: 0

Related Questions