Level "check box" in views

Hello,

I would like to be able to uncheck or check the check box of level heads that display in a view (image attached). I searched an couldn’t seem to pull anything up on the web or this Forum.

Does anyone know if this is possible with “out of the box” Dynamo nodes, or would it require a custom node?

Thank you,
Jac

Hi Jacqueline,

You need Python to hide check box of levels.

And here is the code:

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

doc = DocumentManager.Instance.CurrentDBDocument
uiapp = DocumentManager.Instance.CurrentUIApplication
app = uiapp.Application

a = UnwrapElement(IN[0])
v = UnwrapElement(IN[1])
TransactionManager.Instance.EnsureInTransaction(doc)
for i in a:
	i.HideBubbleInView(DatumEnds.End0,v)
	i.HideBubbleInView(DatumEnds.End1,v)
TransactionManager.Instance.TransactionTaskDone()

OUT = 0
10 Likes

Wow! Thank you so much Kulkul!

I don’t have that “Active View” node you are showing, so I just used “Views” and I selected the view I’m looking at, but I get the following error from the Python Script node…

Warning: IronPythonEvaluator.EvaluateIronPythonScript operation failed.
Traceback (most recent call last):
File “”, line 20, in
AttributeError: ‘Level’ object has no attribute ‘HideBubbleInView’

Thanks,
Jac

The node “Active View” is part of the Spring Nodes package. If you are unsure of what package a node comes from I suggest installing the “Rhythm” package by @john_pierson - http://sixtysecondrevit.blogspot.com/2016/05/dynamobim-what-node.html

2 Likes

That is SUPER helpful! Thanks Tom (and @john_pierson)

Although, I still get the error.

I’m on Dynamo 1.1.0 Revit 2016 and WIN 10

1 Like

@jwarner4 check your Revit version. DatumPlane.HideBubble() – Hides bubble in the specified view will only work on version Revit 2016 onwards. Are you sure your using Revit 2016?

Try updating to Revit 2016 R2. Good Luck!

2 Likes

Once again, you are correct. :slight_smile: I inadvertently had 2015 open.
Thank you again for all of your help! I greatly appreciate it!

Hide GridBubble in View :slight_smile:

If I only have Revit 2015 as an option is there a variation to the script dealing with “HideBubbleInView” that would work?

No, unfortunately it is not exposed in the API in 2015.

How would you adjust this to accept lists of levels and views? I dont know python well enough

I get this error

Add List.Create for both inputs before feeding into python.

1 Like

Thank you! was good to finally see it finally work. Just needed list.create for Select Model Element. I’ve tried all sorts of things but for the life of me cant get this to accept anymore then one thing. Am I missing something simple?

Below is just one of all sorts I tried with chopping lists and creating lists.

 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

doc = DocumentManager.Instance.CurrentDBDocument
uiapp = DocumentManager.Instance.CurrentUIApplication
app = uiapp.Application

a = UnwrapElement(IN[0])
v = UnwrapElement(IN[1])
b = UnwrapElement(IN[2])
TransactionManager.Instance.EnsureInTransaction(doc)

for i in a:
	if b:
		i.HideBubbleInView(DatumEnds.End0,v)
		i.HideBubbleInView(DatumEnds.End1,v)

	else:
		i.HideBubbleInView(DatumEnds.End0,v)
		i.HideBubbleInView(DatumEnds.End1,v)

TransactionManager.Instance.TransactionTaskDone()

#Assign your output to the OUT variable.
OUT = 0

This works but you have to click on a level bubble for it to graphically change on screen after :exploding_head: