How to hide a Revit Element based on Dynamo IF Condition


Can someone, please, tell me how can I hide a one of Two Revit Elements create by Dynamo based on an IF Condition, let’s say I have made Two Walls in Revit By using Dynamo and I applied a simple condition that when it is true, Wall No.1 in Revit must be deleted and if it False then Wall No.2 will be deleted (or Hide at least).

It works completely to hide a Dynamo element based on an IF condition, but when it goes to Revit Elements, I can only delete them and the Delete Node I got from “Spring” are not doing what I want.

Cheers mates, and thanks in advance


Element.OverrideInView gives the option to hide/unhide elements.

1 Like

Many Thanks dear
Not really working it gives me this error, any idea?

Warning: One or more of the input types are not matching. Couldn’t find a version of OverrideInView that takes arguments of type (string,null)

Warning: One or more of the input types are not matching. Couldn’t find a version of OverrideInView that takes arguments of type (string,bool)

For Overrides, you need to use the OverrideGraphicSettings.ByProperties node. If all you want to do is Hide the element, you don’t need to connect anything at all to the Overrides input. And set Hide to “true” to hide it.

1 Like

thanks dear, but how i can choose a specific element to hide, like a wall?

Where is the Element input that allows me to select the element?

Oh, it looks like you had that part right in your script; Your code is creating a wall and hiding it in the current view.

Or do you want to hide existing wall elements? There’s numerous ways to do that, depends on which walls you want to hide.

1 Like

I thank you again for your valuable feedback, my case is this:
I want to create two walls or two elements (Revit Elements), linked to (IF Condition), so lets say if my condition is met (True) then wall No.1 will be hidden, if the condition is (False) then Wall No.2 will be hidden.
So there main thing is to know how to hide a specific wall based on a condition

1 Like

Assuming you’re giving two walls to the Element.OverrideInView node:

1 Like

Still mate, not working

Don’t attach anything to the Overrides input. It’s for changing lineweights, patterns, etc.

The Element.OverrideInView ONLY works in the current/active view that you have open.

1 Like

The warning message has gone!! but nothing hidden, sorry to disturb you, many thanks again

Change lacing to Auto instead of shortest maybe? Edit: also maybe try connecting an empty OverrideGraphicSettings.ByProperties node to Overrides.

1 Like

I did

I just tested, yes you need to connect an empty OverrideGraphicSettings.ByProperties node


Many thanks mate!!! you saved the day!!! the lower wall now can be hide and unhide per condition!!! I thank you again, Can I make the other get the reverse effect!! so only one of them hide and the other unhide and vise verca !!! :slight_smile:


I did changed the True, false and reverse it!!! it is now 100% working

I really really appreciate your help!! it took me forever to do it and with you it took me only one hour!!!

this is my personal email:
I am happy to stay connected to such talented person as you

1 Like

I am glad you worked this out, but wanted to point something out:

This is very inefficient. Extremely so. It’s effectively saying ‘We don’t know if we should have turkey or ham for grandma’s birthday dinner, so let’s go to the grocery store and buy both meals and all the associated sides and such for each, cook both and prepare everything as if we were gonna eat twice, bring them both to grandma’s house, have her smell them so we know which one she prefers, drive back home and throw out the less preferred option, and then drive back to her place where we will consume the preferred version.’ If that seems like a lot of back and forth for dinner… well it is. Imagine instead calling grandma and asking which she prefers, and just cooking that. Waaaaaay easier right?

You would be well served to decode the logic behind the if statement in Dynamo directly, and then only travel once. That isn’t always an option, but the conversion from Dynamo to Revit and back is often the most time consuming part of the process so avoid it when possible.

Mate, I would have agreed with you if my design was as the majority of designs (as a steady-state) case, where you want to think first, about the script and let Dynamo order Revit make the dinner :slight_smile:

But in the design I have, I am facing a dynamic situation, were Dynamo needs to divide a curve according to a fixed length, provided as an input by the user, (Cover each equal part with Adaptive Component), and then see the small remaining part (IF ANY), check if it is possible to be clad with the same AC or not, Dynamo has to check the Sub-Component of the AC of this small remaining part, and see is it gonna make crash and if it is applied to the manufacturer or not, So the final judgment is depending on applying Revit Adaptive Component in 3D Revit View, Dynamo is returning and extracting these values, put them in the (IF Condition) and then decided whether to remove this small AC as it is not matching the codes and replace it with totally different type of AC, used in joinery and corners only.

So the script I am making is dealing with design possibilities plus the need to check after you apply the Adaptive Components and return data to Dynamo again to substitute the unfit ones, and I need to Hide those AC that found unfit dear Jacob, I could not make the decisions while I am still in 2D phase nor when I was in Dynamo as each input value of the use cause different set of possibilities in the design result.
Plus now I am hungry cause of you are talking about Food!! hahaha

1 Like