Override Revision Clouds in Multiple Views

I’m stuck on a script. I found this topic that seemed to help, but the Python script doesn’t seem to work on Revision clouds:

I’m trying to set previous Revision’s RevClouds to halftone in all views across the model. Filters can’t apply to annotation elements unfortunately, so I have to override the individual RevCloud elements. The built-in Revit node only works on the active view.

Can anyone better at Python than me help out? Thanks!

I think you would need to feed it a list of views, the use a Filtered Element Collector to get all the rev clouds in that view, compare to the rev you want if needed, then modify them as needed.

See this post may help too.

Hi, @steinah6!
That was a very specific task, so not sure that it will work for your situation.
You need to loop through each view, then get all elements of Revision Cloud category(OST_RevisionClouds) on that view and only then set graphical overrides for each element:
image

code for copy/pastimg:

import clr
clr.AddReference("RevitAPI")
from Autodesk.Revit.DB import *
clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
doc = DocumentManager.Instance.CurrentDBDocument

#input_list = IN[0]
#views = UnwrapElement(input_list[0])
#el_top_list = UnwrapElement(input_list[1])

line_pattern = UnwrapElement(IN[2])
#fill_pattern = UnwrapElement(IN[3])
color_input = IN[4]
color_l= color_input.split(" ")
color = Color(int(color_l[0]),int(color_l[1]),int(color_l[2]))
line_weight = IN[6]
halftone = IN[7]
ogs = OverrideGraphicSettings()		
ogs.SetProjectionLineColor(color)
#ogs.SetCutLineColor(color)
#ogs.SetCutLineWeight(line_weight)
ogs.SetProjectionLineWeight(line_weight)
ogs.SetHalftone(halftone)
#ogs.SetSurfaceTransparency(IN[5])
#ogs.SetProjectionFillColor(color)
#ogs.SetProjectionFillPatternId(fill_pattern.Id)
#ogs.SetCutFillPatternId(fill_pattern.Id)
#ogs.SetCutFillColor(color)
ogs.SetProjectionLinePatternId(line_pattern.Id)
#ogs.SetCutLinePatternId(line_pattern.Id)

TransactionManager.Instance.EnsureInTransaction(doc)

for view in UnwrapElement(IN[1]):
	view_elements = FilteredElementCollector(doc, view.Id).OfCategory(BuiltInCategory.OST_RevisionClouds).WhereElementIsNotElementType().ToElements()
	for el in view_elements:
		view.SetElementOverrides(el.Id, ogs)

TransactionManager.Instance.TransactionTaskDone()
OUT = 0

Thank you Dmytro! Almost there.

I’m having some trouble. I noticed that for view in UnwrapElement(IN[1]): should be IN[0] to get the views. But I think your code is taking all Revision Cloud elements on the sheets. I need it to affect only specific ones, but I’m having trouble modifying the code.

Here’s my graph:

And here’s my modified code:

import clr
clr.AddReference(“RevitAPI”)
from Autodesk.Revit.DB import *
clr.AddReference(“RevitServices”)
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
doc = DocumentManager.Instance.CurrentDBDocument

input_list = IN[0]
views = UnwrapElement(input_list[0])
el_top_list = UnwrapElement(input_list[1])

#line_pattern = UnwrapElement(IN[2])
#fill_pattern = UnwrapElement(IN[3])
#color_input = IN[4]
#color_l= color_input.split(" ")
color = Color(int(color_l[0]),int(color_l[1]),int(color_l[2]))
#line_weight = IN[6]
halftone = IN[7]
ogs = OverrideGraphicSettings()
#ogs.SetProjectionLineColor(color)
#ogs.SetCutLineColor(color)
#ogs.SetCutLineWeight(line_weight)
#ogs.SetProjectionLineWeight(line_weight)
ogs.SetHalftone(halftone)
#ogs.SetSurfaceTransparency(IN[5])
#ogs.SetProjectionFillColor(color)
#ogs.SetProjectionFillPatternId(fill_pattern.Id)
#ogs.SetCutFillPatternId(fill_pattern.Id)
#ogs.SetCutFillColor(color)
#ogs.SetProjectionLinePatternId(line_pattern.Id)
#ogs.SetCutLinePatternId(line_pattern.Id)

TransactionManager.Instance.EnsureInTransaction(doc)

for view in UnwrapElement(IN[0]):
view_elements = FilteredElementCollector(doc, view.Id).OfCategory(BuiltInCategory.OST_RevisionClouds).WhereElementIsNotElementType().ToElements()
for el in view_elements:
view.SetElementOverrides(el.Id, ogs)

TransactionManager.Instance.TransactionTaskDone()
OUT = 0

I need to change the View Elements to accept the IN[1] input you see in my graph. Can you finish it up? Much appreciated!

Now i get what are you trying to achive, nice idea!
As you already have all the input data, you just need to go ahead with a single loop. Try this:

Python node:

import clr
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *
clr.AddReference('RevitServices')
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
doc = DocumentManager.Instance.CurrentDBDocument

views = UnwrapElement(IN[0])
elements = UnwrapElement(IN[1])

ogs = OverrideGraphicSettings()
ogs.SetHalftone(IN[2])

TransactionManager.Instance.EnsureInTransaction(doc)

for el,view in zip(elements, views):
    view.SetElementOverrides(el.Id, ogs)

TransactionManager.Instance.TransactionTaskDone()
OUT = 0
1 Like

This works perfectly, thank you! This will help me learn how to modify a few other script nodes as well :slight_smile:

1 Like

Newbie…Revit proficient, Dynamo not so much…Can someone explain how to use this???

Thanks for all of the previous posts. I’ve taken what was posted here and updated/altered it to be slightly more user friendly for my needs. Overall, it’s more than a bit rough-and-tumble.

The script can be used to either override or reset the graphic settings of revision clouds across multiple views. The user has to connect the element output to the corresponding input node for either of these functions.

Override Cloud Color by Revision_v5.dyn (34.4 KB)

I modified the Python Script to tailor it to modifying revision cloud elements and accept RGB from the Color Palette node.

import clr
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *
clr.AddReference('RevitServices')
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
doc = DocumentManager.Instance.CurrentDBDocument

views = UnwrapElement(IN[0])
elements = UnwrapElement(IN[1])
line_pattern = UnwrapElement(IN[3])
color_R = IN[4]
color_G = IN[5]
color_B = IN[6]
color = Color(int(color_R),int(color_G),int(color_B))

ogs = OverrideGraphicSettings()
ogs.SetHalftone(IN[2])
ogs.SetProjectionLinePatternId(line_pattern.Id)
ogs.SetProjectionLineColor(color)

TransactionManager.Instance.EnsureInTransaction(doc)

for el,view in zip(elements, views):
    view.SetElementOverrides(el.Id, ogs)

TransactionManager.Instance.TransactionTaskDone()
OUT = 0

My Python-Fu is feral and if anyone can optimize the nodes or the script, please feel free to.