Yes/No Parameter without value

Is it possible to remove values from a yes/no parameter, changing it to blank, similarly to when they are first created?

I don’t believe so. The only way I know of is if the parameter is removed and recreated.

What about this? I use this to control my ‘sheet index list’ checkbox.

1 Like

When parameter is first created it looks like its grey-ed out which in reality means its set to False. What @Myles_Martin suggested below is the correct answer - just set it back to False.

But it’s kind of not false at the same time though right? It’s pretty much non-existent and empty. If you were to do, == False these values would say they do not equal false in Dynamo.

No, it should be set to False by default (0 in Revit case since it uses 1 and 0 to represent True/False). Try scheduling them, if they are not touched and have that default value they will report as False. I am not sure why Dynamo would think otherwise. Booleans can be nulled as well, maybe that’s what’s tripping it. Try comparing it to null.

1 Like

There it is! I could have sworn this was different when I answered this 3 months ago.:flushed:

1 Like

So, I have to revive this topic, because I have the same issue:

I am using a parameter to set the status of an element. It is either approved, rejected, or neither (for example, this could represent “not reviewed”.

Is it possible to set the neutral value of the element in dynamo?

To clarify, I don’t believe you can “reset” the value to null (neither). Some parameters allow for a default value of none or null but cannot be reset after accepting a valid value. The reason a null value reads as False in Dynamo is because it’s being read as a string. String objects will be read as True unless they are a blank string, which is read as False.

Nulls don’t read as false in dynamo. If i select an element without a true / false, no value is returned.

I use this often with filtering in views and schedules. I have to filter with equals to yes, or equal to no. All other values are yet to be determined.

There is a clearvalues method which is available in the API, but I am clueless when it comes to python. :frowning:


1 Like

I’m specifically talking about the point that was made above: If you compare null == false then Dynamo will return true. This is due to how Dynamo compares strings as booleans. In Revit, the null does not directly equate to false.

You can use something like this:

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

dataEnteringNode = IN
elements = UnwrapElement(IN[0])
paramName = IN[1]
out = []

for element in elements:
	param = element.LookupParameter(paramName)
	check = param.ClearValue()
	out.append(check)

OUT = out

Keep in mind that “This method will only succeed for Shared parameters that have their HideWhenNoValue property set to true.” Which means you’ll likely have to change some parameter properties before utilizing this method. You can find more discussion on this topic here.

Hi Nick,

Thank you very much for the help. I am not even a novice when it comes to scripting, and this helps me tremendously. I saw the HideWhenNoValue setting in the shared-parameters file discussion, but thank you for that link as well. It will be easier to find in 6 months when I ask myself “how does this work again?”

Thank you!!!

Cheers,
Matt