Hi all, trying out Dynamo to solve some issues again.
As the title states, I’m having difficulty extracting only the element ID from a list with null values and element IDs.
I’ve tried the element ID code block but it doesn’t produce the results I want because of null values.
In the list, I want to retain the position of the null value in the list but still extract the element IDs from the list. Is there a way? I’ve been googling but I can’t seem to find a way. Does anyone have a link or guide where i can refer to? It’ll really help me to understand what codes i should use.
import clr
clr.AddReference(‘ProtoGeometry’)
from Autodesk.DesignScript.Geometry import *
Import RevitAPI
clr.AddReference(‘RevitAPI’)
import Autodesk
#The inputs to this node will be stored as a list in the IN variable.
dataEnteringNode = IN
elements = []
for i in IN[0]:
elements.append(UnwrapElement(i))
elementIds, idString, guid = [], [], []
for i in elements:
elementIds.append(i.Id)
idString.append(i.Id.ToString())
guid.append(i.UniqueId)
#Assign your output to the OUT variable
OUT = elementIds, idString, guid
Thanks alot!