Region Area, Can't Fillter by type name, Null value in list, Dereferencing a non-pointer


RegionAreaFilterbyNames.dyn (17.7 KB)

Hi guys, I’m new to Dynamo, I have a difficult problem that I don’t know how to solve. I want to extract the value of the Area instance parameter of the Filled Region elements into the Region Area instance parameter that I created myself, but extract only for the filled region elements that I filtered by name, but in my working file i can’t make it with this approach, can someone help me in this case? I think the error is caused by null value in the list, but I don’t understand why and how to solve it, please help me, many thanks…
Please check with my Revit file for exact details, only when in this file, the error occur…

The background:
So basically your issue is dealing with nulls. Null values will cause issues (warnings) with most functions but only “break” when the null cannot be passed on. In your example Element.Name and String.Contains have errors on the individual items with null values, causing warnings but still allowing the node to execute. List.FilterByBoolMask filters the items into two lists based on a boolean value. Null is not a boolean and therefore won’t get filtered into either list, breaking the node’s functionality.

The fix:
Cleanup your nulls. It’s pretty much always in your best interest to take care of your nulls one way or another. Either filter out the Detail Item elements without an ElementType before getting their name or convert the null values to false values before applying the boolean mask. The former prevents you from having cascading warnings so I’d recommend that solution.

2 Likes


I tried replacing the null value in the list but it still doesn’t work, can you help me by your graph with my revit file :smiling_face_with_tear:

Can someone help me in this case :smiling_face_with_tear: :smiling_face_with_tear: :smiling_face_with_tear: :smiling_face_with_tear:

@luongbaohoanggia1997 ,

Can you try this…

via python

vals = IN[0]

clean = []

for i in vals:
	if i == 0:
		clean.append(0.0)
	elif i == "":
		clean.append(0.0)
	elif i == None:
		clean.append(0.0)
	else:
		clean.append(i)
		
OUT = clean

you can modify the output 0.0 to false or a string “-”


vals = IN[0]

clean = []

for i in vals:
	if i == 0:
		clean.append("-")
	elif i == "":
		clean.append("-")
	elif i == None:
		clean.append("-")
	else:
		clean.append(i)
		
OUT = clean

Can you repost the last image of your graph with the preview bubbles showing? We can’t quite tell what’s going on if we can’t see the inputs and outputs.

Hi @luongbaohoanggia1997,

In your first graph, a “String from Object” node will turn the null values also into strings (and suitable for filtering).

1 Like

i tried every way i know :smiling_face_with_tear:

it not work with my revit file, if you try with my revit file that i posted, you will see…

I downloaded your RVT-file and it works fine for me (R20 and upgrade to R21) with the script below.


RegionAreaFilterbyNames_v02.dyn (20.5 KB)

I’d suggest just filtering out the FilledRegionTypes that come back null. Cut them out immediately and don’t worry about dealing with nulls later on.

The key here is with my revit file, it doesn’t work, if you create a new default revit file it will run successfully, but my revit file is a file that has integrated templates and a lot things according to my company’s way of working… , so it’s not the same as the default file. Can you use the “Test3” revit file that i posted to test, it doesn’t work, thanks if you can help me in this case, with the revit file i posted

Can you show me the way how you will use graph of node to handle this step, thanks a lot

I’d use IsNull and FilterByBoolMask.


sorry if i bother you but since i am new to dynamo, after filter FilledRegionTypes to remove null value, I don’t know how to get node that have input FilledRegionTypes and output return element objects to then proceed setparameter by name, please show me the node or the way to do that, thanks

You have your full list of FilledRegionTypes. FilterByBoolMask splits that list into those that are null (in) and those that aren’t (out). You can then use that new list of FilledRegionTypes to continue throughout your graph.


i just know some basic node, i can’t finish that, can you share your graph with node to help me :smiling_face_with_tear: thanks

@luongbaohoanggia1997

you are feeding elements with bools, presort your elements with FilterByBoolMask

1 Like

Sorry, I assumed you were getting nulls from the ElementTypes, but you’re actually getting it from the Element.Name. Put the Element.Name node between the ElementTypes and IsNull nodes. You’re trying to filter the elements that are giving a null, so that’s where you want to check.

1 Like