Gridbubbles

Hello

I’ve made the following script to hide the gridbubbles.

With this script I can select the concerning grids in a project.

I want to be able to choose the side of the grid on which a bubble should be hidden.
Can anyone help me with this. The script contains the following Python code. I’m not experienced enough with Python to alter it.

Hoi Kbosh

Are you getting any errors?
We can help troubleshooting if we know what’s not working in your script.

There are zero errors and the script works like a charm. However I want the script to hide the bubble on the other side of the selected grid if I select the concerning grids again, or an extra toggle in the menu to hide the segments end or start.

Your explanation is a little confusing. Can you explain in detail what your graph is doing now and what you want it to do in the end?

It sounds like you want it to do one thing the first time you run it and a different thing the next time. That’s a little tricky but you could essentially have it check for Outcome1 (the first thing it should do) before running and if that intended result is the current condition of the element then run Outcome2, otherwise run Outcome1.

Yeah, my english can be a litle tricky sometimes :wink:

The script now only hides the grid bubbles surrounded by a red square.
I want to build in a switch so that the other side of the grid bubbles can be hidden instead of the red ones.

Could you please paste the Python script as text in here? :slight_smile:

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 = 0

I hope i understood you correctly…

Something like this?


stramienen.dyn (35.9 KB)
image

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])
k = IN[3]
TransactionManager.Instance.EnsureInTransaction(doc)

for i in a:
	if b:
		if k==1:
			i.HideBubbleInView(DatumEnds.End0,v)
			i.ShowBubbleInView(DatumEnds.End1,v)
		if k==0:
			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 = 0
2 Likes

Since you’re meddling with grid lines, i’d like to share a script that will come in handy aswell. I found it on here somewhere but i can’t remember who made it.

This script sets ALL grids in view to 2D, so you can drag the ends without dragging the grids in 3D. The process of manually setting al grid ends to 2D is such a pain…
Stramienlijnen 2D.dyn (9.9 KB)

1 Like

Thanks… that was exactly what I was looking for!

1 Like

Thanks for the second script aswell. You deserve a medal :1st_place_medal:

1 Like

Hello @kboschJGDNZ
If this swicthing ends is already what you wanted it´s ok, but i just wanted to add that we have python codes on the forum that will set the grid ends to the cropbox and the bubbles to a specific end, in this case always the top and left side. This will also work if the view has been rotated.

ezgif.com-gif-maker

2 Likes