Turn On Top & Left Grid Bubbles Only (Troubleshooting Help)

Hello all,

New to Dynamo and I found a topic where @kmechengineer @Nick_Boyts helped to make a script that turns on bubbles at the Top and Left sides of gridlines in a view. When I run the script, however, it only works in some cases (some bubbles are still on at the Right and Bottom sides). Can someone please explain to me what each section of the script is doing so I can understand how to address this issue. I will attach dynamo script and link to original post here. (NOTE: Spring Nodes and Archi-labs packages are needed for the script.)

Thank you!

Grids Top Left_FG.dyn (33.8 KB)



Grid After

Can you also post a screenshot (use Export as Image) of your graph, with all the node preview bubbles pinned, so that we can see what’s going on on your end?

Hi Nick,

I updated my post with a screenshot.

Can you repost that image with all the node preview bubbles pinned so we can see the data? It looks like you’re taking the absolute value of the coordinates which will cause problems for some grids.

ok, reposted with node preview bubbles pinned.

Thank you. Unfortunately you’re too far zoomed out to read the node names now. Make sure you’re using Export as Image with names visible.

Sorry about that. I hope this is better.

We need to be able to see both the previews and the node names to have a full understanding of what’s going on. You don’t have to fit the full graph inside the workspace when exporting the image, you just need to be zoomed in enough that node names are legible.

Hi Nick,

Please review again. is this better?

The image looks better, yes. However you’re still comparing the absolute value of X. You also haven’t shown us the python code where all of this is going down. We can’t comment on what we can’t see.

Here is my code. I haven’t modified it from the original. should i remove the Math.Abs node for X?

import clr
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *

clr.AddReference("RevitNodes")
import Revit
clr.ImportExtensions(Revit.Elements)

clr.ImportExtensions(Revit.GeometryConversion)

clr.AddReference("RevitServices")
import RevitServices

from RevitServices.Persistence import *
from RevitServices.Transactions import TransactionManager
from System.Collections.Generic import *

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

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

g = UnwrapElement(IN[0])
bx = UnwrapElement(IN[1])
by = UnwrapElement(IN[2])
v = UnwrapElement(IN[3])

TransactionManager.Instance.EnsureInTransaction(doc)

for g, bx, by in zip(g, bx, by):
	if bx and by:
		g.ShowBubbleInView(DatumEnds.End1,v)
		g.HideBubbleInView(DatumEnds.End0,v)
	elif bx:
		g.HideBubbleInView(DatumEnds.End1,v)
		g.ShowBubbleInView(DatumEnds.End0,v)
	elif by:
		g.ShowBubbleInView(DatumEnds.End1,v)
		g.HideBubbleInView(DatumEnds.End0,v)	
	else:
		g.HideBubbleInView(DatumEnds.End0,v)
		g.ShowBubbleInView(DatumEnds.End1,v)
	
TransactionManager.Instance.TransactionTaskDone()

doc.Regenerate()

OUT = g

Yes, otherwise a larger negative number would show that it’s “more positive” than a smaller negative number. That shouldn’t affect your vertical grids though so you’ll have to check the conditions and see if any of them don’t make sense for the grids that aren’t flipping.