Set Phase Status Presentation with Python

Hi everyone,

I tried to set a phase status presentation with a python script but the value is “Null”…

This is the script :

phasefilters = UnwrapElement(IN[0])

new =

for phasefilter in phasefilters:
news = phasefilter.SetPhaseStatusPresentation(ElementOnPhaseStatus.Temporary,PhaseStatusPresentation.DontShow)
new.append(news)

OUT = new

Does the script need a transaction (if so, I don’t really understand why I can get the phase status presentation without a transaction…)?

Thank you in advance!

You’ll need a reference to the Revit API if you don’t already have that, and then the script will return null because SetPhaseStatusPresentation is a void method so doesn’t return anything after it changes the status presentation. If you want to return something out of the node then you could return the phasefilter itself.

If you’re only going to be changing one phase filter at a time then you don’t need the loop in Python but I’ve left it in here for the time being

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

phasefilters = UnwrapElement(IN[0])

new = []

for phasefilter in phasefilters:
	phasefilter.SetPhaseStatusPresentation(ElementOnPhaseStatus.Temporary, PhaseStatusPresentation.DontShow)
	new.append(phasefilter)

OUT = new

Hope this helps,
Thomas

1 Like

Thank you Thomas for your reply,

I didn’t read the Revit API correctly :

I didn’t insert the references/modules from my script in the topic…my bad :sweat_smile:.
Also, I forgot that when I want to create/modify something in revit, I need a transaction…

Well that was a newbie error my apologies ahah.