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.
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:
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
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.
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!
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.