Temporary Hide Python script Error

Got the following python code from an previous posts temporary-hide-in-dynamo

import clr

clr.AddReference(‘RevitAPI’)
from Autodesk.Revit.DB import *
from System.Collections.Generic import *
clr.AddReference(“RevitServices”)
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager

doc = DocumentManager.Instance.CurrentDBDocument

elements = UnwrapElement(IN[0])
view = UnwrapElement(IN[1])
ids = list()
booleans = [ ]

for item in elements:
ids.append(item.Id)
ielements = ListElementId
TransactionManager.Instance.EnsureInTransaction(doc)
try:
view.HideElementsTemporary(ielements)
booleans.append(True)
except:
booleans.append(False)

TransactionManager.Instance.TransactionTaskDone()
OUT = (view,elements,booleans)

But I’m encountering the following error and am trying to understand it and resolve it.
image

Thanks in advance
Eddie

@EddieSaez change line 19 to

ielements = List[ElementId]

Thankyou… appreciate your assitance.
Seems I’m getting tunnel vision and could not see that square brackets missing.
Time to have a break.

Thanks again

1 Like

Hmm… OK that’s resolved, no more errors but nothing is temporarily hiding

You need to create a custom node.
Element.TemporarilyHideInView.dyf (13.1 KB)

or modify the code to work with a list

Trying this with model groups and it doesn’t seem to work. It runs with out errors and enables Temporary hide but doesn’t actually hide the selected groups. Works fine when I change the category to walls or other model geometry.