Grid bubble on/off

Hello all,

I am trying to turn off all bobbles in the lower left and turn on all bobbles in the top right. I have developed a scrip to determine what end of the grid is in this location. I have tried the different methods show in this thread but cannot get them to work.

@Ben_Osborn post seamed the most promising. Works off an intersection point of a line and the grid. I fed in the end points of the side I want to turn off but it is turning off the heads on both sides. Does anyone know why this is happening?

Grid Bubbles on or off.dyn (21.0 KB)

Thanks

Ok I got it to mostly work but now I am confused at the outcome. I got it to turn on the grid bobbles on one end and off on the other. This is the most I have ever done in python so I might have messed up the IF statement but I am not sure.

before I run the script

After script is ran

Some of the grid bobbles are flipped from the others. I am not sure why this is happening.

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

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

for i in a:
	if b:
		i.HideBubbleInView(DatumEnds.End1,v)
		i.ShowBubbleInView(DatumEnds.End0,v)
	else:
		i.HideBubbleInView(DatumEnds.End0,v)
		i.ShowBubbleInView(DatumEnds.End1,v)
	
TransactionManager.Instance.TransactionTaskDone()

doc.Regenerate()

OUT = a

Any help is much appreciated.

Grid Bubbles on or off2.dyn (14.6 KB)

1 Like

@Steven why can’t you use @Ben_Osborne script?

I think you get that result because of the way grids were drawn.

His was not turning the bubbles off and on correctly. I know the end being turned off or on depends on what direction the grids were drawn. This is why I got the end points and added the X and Y to find which end is in the top right eliminating the problem of the direction.

I will have to do more testing on Ben’s it could have been that Grid.Curve was getting the whole grid line rather than the 2d crop. Then the points would not have been lying on the grid line in the view. (just thought of this as I was typing my response).

Solved the problem in another post. Please see link below for the code in the python node. Thanks @Lknapton for providing the base of the code (99% of it) and @Nick_Boyts for helping with the IF statement.

just noticed that dependent view won’t work, any solution?

Hello all,

New to dynamo and trying to use the “Grid Bubbles on or off” script. can someone please explain to me how this works or if i need to do something prior to running the script. I ran it but nothing happened to by grid bubbles.

Thanks!

Hello @ssamuel466QW :slight_smile:

Some advice to get help on the forum:

  • Create a new thread, don´t post into an old one.
  • Never ever post in a 4 year old one^^
  • Make sure to add a screenshot of your graph, error messages and also the python code you are using

Then you will get the help you need.

Some threads on the topic:

Change the Curve that determines the 2D extents of Grids in Each View - Dynamo (dynamobim.com)
Set Grid Extents and Bubbles - Dynamo (dynamobim.com)
Python for Loop - Hide Grid Bubbles - Dynamo (dynamobim.com)

1 Like

Thanks, I will do that.

1 Like