Read-only node change in newer Revit versions?

Hey all,

Ive been using the read only node for a while and it works perfectly in revit 2016 with dynamo 1.3.xx. In revit 2018 it does not work the same way. Does anyone know how it has changed ?

In 2016 it reads the parameters and creates a list even when a null is in place. In 2018 it doesnt seem to read anything if your list has nulls. I cant simply remove the nulls because I want to get a listAllIndicesOf after I know what is and isnt read-only.

Can anyone help me ?

I don’t know what causes this, but the Clockwork package has the List.ReplaceNull node, which might help you, that way you won’t have to give nulls as an input and can still get the correct index.

1 Like

It’s a known bug in Dynamo with any property node: if the first item in a list is null or an empty list, the property node (in your case, IsReadOnly node) throws an exception. In your second image you’ll notice the first item in your sublist is null. It won’t be fixed by Dynamo 2.0 according to the Dynamo dev team so you’ll need to clean your list of nulls and empty lists first, or write a custom function in DS, python or C# if you need to maintain your data structure as-is.

I also wrote about handling this problem with a possible solution you could use in the BimorphNodes v2.2 article here. See the ‘Mitigating Dereferencing a Non-pointer Exceptions’ section.


What Thomas_Mahon suggests:

Can probably be easily done with the List.ReplaceNull node from the Clockwork package I talked about.

You can also remove the nulls but record the indices. After everything is done you can re-enter the nulls or whatever else you want back in the correct spot if it really matters.

Wouldn’t that be a whole lot more convoluted than just replacing the nulls with the string “null” or something.

I guess it depends on what you are doing. Sometimes using another value that isn’t what is accepted can just bring another error. For example, using a placeholder “null” string when it needs an integer or a parameter will just be a type error.

To remove and add back in later will be less convoluted when variable types matter and might change depending on the inputs.

1 Like

That’d be true, I am curious how you’d actually plan to pull that off though (but I’m guessing you’re not going to set that up before you know it’s necessary).

A remove and add back in?

A python script like this would get you the indices and remove nulls:

import clr
from Autodesk.DesignScript.Geometry import *
#The inputs to this node will be stored as a list in the IN variables.
list1 = IN[0]
ind = []
final = list(list1)

for i in range(len(list1)):
	if list1[i] is None:

popInd = list(ind)

for i in popInd:

#Assign your output to the OUT variable.
OUT = [final,ind]

[0] would be the output with nulls removed and [1] would have the indices. Another python using a for i in ind: list.insert(i,None) or something similar would work.

Edit: I guess in this post’s case you would have to add a recursive function.


Thank you Thomas,

This has solved my problem.

Ive already used the replace nulls and remove nulls scripts in the script and it would be a lot more work to try and get them back in the same order than just making sure that the first item in the list is not a null.