Filter Piping system type


I’m trying to export the system types of the pipe accessories in the model. By dynamo nodes I get this result:

However, then the problems is that the Element.Name function doesn’t work due to the undefined items. So I get null, sometimes error/warning due to undefined elements (the software is not stable here).

I tried to solve this using filterbyboolmask or if, but I can’t get it to work. Thing is I need a complete list including unknow, as this is to be merged with other data. I have no need for list of elements only with defined system type.

Any help appreciated!

Edit: The warning says: “Warning: Internal error, please report: Dereferencing a non-pointer”

Figured it out, posting in case someone else is googling and wondering.

There is probably some smarter and easier way to do it, but this works at least.

python script:

import clr
from Autodesk.DesignScript.Geometry import *
#The inputs to this node will be stored as a list in the IN variables.
dataEnteringNode = IN

#Assign your output to the OUT variable.

structList = IN[0]
names = IN[1]
l = IN[2]
OUT = ['Undefined']*l
for i in range(len(structList)):
	sublist = structList[i]
	for j in sublist:
		OUT[j] = names[i]