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.
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.
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.
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