Hello all, I have to show and hide 100’s of bubbles in the level head. So I wrote a small bit of python code by referring to this
but unfortunately it throws an error. The code follows
import clr
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *
import Autodesk
clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
clr.AddReference("RevitNodes")
import Revit
clr.ImportExtensions(Revit.Elements)
doc = DocumentManager.Instance.CurrentDBDocument
uiapp = DocumentManager.Instance.CurrentUIApplication
app = uiapp.Application
uidoc = DocumentManager.Instance.CurrentUIApplication.ActiveUIDocument
levels = IN[0]
view = uidoc.ActiveView
check = []
TransactionManager.Instance.EnsureInTransaction(doc)
for level in levels:
level = UnwrapElement(level)
level.IsBubbleVisibleInView(DatumEnds.End0, view)
#The line below works and returns True or False
#check.append(level.HasBubbleInView(DatumEnds.End0, view))
TransactionManager.Instance.TransactionTaskDone()
#OUT = check
OUT = levels
Error it show is
Warning: IronPythonEvaluator.EvaluateIronPythonScript operation failed.
Traceback (most recent call last):
File "<string>", line 30, in <module>
Exception: The datum plane cannot be visible in the view.
Parameter name: view
I am confused since the code works for “HasBubbleInView” but not for “IsBubbleInView” or “ShowBubbleInView”