Cant get Phase name to populate

I have been at this for some time and cant get it to read out the correct Phase created name. I just keep getting Phase and an Id number. What am I doing wrong. I even tried to write a python script (that I found on here somewhere and that didn’t work as well it kept pulling Empty list). any help would be greatly appreciated.

import clr
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *

items = UnwrapElement(IN[0])
phasecreated = list()

for item in items:
    try:
        if item.CreatedPhaseID.IntegerValue == -1:
           phasecreated.append(list())
        else:
             phasecreated.append(item.Document.GetElement
             (item.CreatedPhaseId))
                
    except:
        phasecreated.append(list())
        
OUT = phasecreated

Phase is an element. You can get the name just by getting the name of the element, either with the Element.Name node or using the Name property in python.

1 Like

That was it always thank you Nick!

I need to understand the phase of each element, so I followed a process similar to the one described above. I don’t understand how I could extract the information. To summarize: I need to create two lists of elements, those created in the ‘new construction’ phase and those created in the ‘existing’ phase. Is it possible to achieve this result?

You need to look into how FilterByBoolMask works. The list input is the list of items to be sorted into either the in output (true) or out output (false). The mask input is a list of boolean values (true or false) based on some filtering condition. You need to check the phase name. You can either do this with a conditional (name == [some value]) or you could use GroupByKey to just group the elements by name.