Change phase filter of View not working

Hi guys,

I’m trying to change the phase filter of a view. I couldn’t find a node for this. So I’m trying to code this.
Here is what I got:

It runs without warning, but nothing has changed in view. There must be something wrong in the code and I can’t figure why.

Thanks in advance.

Edit: I´m really sorry, the preformatted text works depending on something that I have not found yet…so, I´ll have to leave the code as it is for now.

You´re almost there, you just forgot a couple of things:

  1. Unwrap the phase filter too, it is a Revit element as the view.

  2. After the unwraping, you will have to use the transaction manager.

    #enable Python support and load DesignScript library
    import clr
    from Autodesk.DesignScript.Geometry import *

    import RevitServices
    from RevitServices.Persistence import DocumentManager
    from RevitServices.Transactions import TransactionManager

    import Autodesk
    from Autodesk.Revit.DB import *

    doc = DocumentManager.Instance.CurrentDBDocument

    #the inputs to this node will be stored as a list in the IN variables.
    view = UnwrapElement(IN[0])
    phaseFilter = UnwrapElement(IN[1])

    #place your code below this line

    #assign your output to the OUT variable.
    OUT =

1 Like

Thanks! very helpful

Sorry for reviving this thread, will this work with ViewTemplates? I need to change the phase filters in multiple view templates…

I don’t understand phyton code. But since ViewTemplates are views too, i’m thinking if i can wire them to IN[0]