Find Temporarily Hidden Elements In Revit View

Find Temporarily Hidden Elements In Revit View

smith.preston2
Observer Observer
1,428 Views
4 Replies
Message 1 of 5

Find Temporarily Hidden Elements In Revit View

smith.preston2
Observer
Observer

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? 

 

The question is also posted on StackOverflow: in case people want points there 🙂

 

http://stackoverflow.com/questions/42071103/find-temporarily-hidden-elements-in-revit-view

0 Likes
1,429 Views
4 Replies
Replies (4)
Message 2 of 5

matthew_taylor
Advisor
Advisor

Hi @smith.preston2,

Have you tried using elem.IsHidden(viewToCheck) ?

 

Or are you talking about an element that is hidden *temporarily* in the temporary 'reveal hidden elements'? Either way, I'd be surprised if the suggested code didn't work. Let me know!

 

Cheers,

 

-Matt


Cheers,

-Matt
_______________________________________________________________________________
Marking a post as a 'solution' helps the community. Giving a post 'Kudos' is as good as saying thanks. Why not do both?
Message 3 of 5

FAIR59
Advisor
Advisor

manually hidden:

 

You mean  right click on element(s), [ Hide in View ] [Elements] ??

Message 4 of 5

jeremytammik
Autodesk
Autodesk

Preston answered his own question on StackOverflow:

 

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.

 

Cheers,

 

Jeremy



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

Message 5 of 5

smith.preston2
Observer
Observer

Sorry, was just coming back around here to say the same (thanks Jeremy)

 

My only issue is that it seems that almost none of the TemporaryModes seem to work with View.IsElementVisibleInTemporaryViewMode()

 

Excluding: 

 

TemporaryViewMode.TemporaryHideIsolate,

 

Each of these will throw the aforementioned exception when looking for an element

 

//TemporaryViewMode.ExplodedView,
//TemporaryViewMode.Raytrace,
//TemporaryViewMode.RevealConstraints,
//TemporaryViewMode.RevealHiddenElements,
//TemporaryViewMode.TemporaryViewProperties,
//TemporaryViewMode.WorksharingDisplay

 

 

0 Likes