Something like this:
Python script:
import clr
#Import the Revit API
clr.AddReference('RevitAPI')
import Autodesk
from Autodesk.Revit.DB import *
#Import DocumentManager and TransactionManager
clr.AddReference('RevitServices')
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
#Reference the active Document and application
doc = DocumentManager.Instance.CurrentDBDocument
#Start scripting here:
elems = [UnwrapElement(i) for i in IN[0]]
views = [UnwrapElement(i) for i in IN[1]]
rgb = IN[2]
output = []
#Get the solid fillpattern:
fpe = FilteredElementCollector(doc).OfClass(FillPatternElement)
solidPatternId = 0
for i in fpe:
pattern = i.GetFillPattern()
if pattern.IsSolidFill == True:
solidPatternId = i.Id
#Create the color
color = Autodesk.Revit.DB.Color(rgb[0],rgb[1],rgb[2])
#Create the OverridesGraphicsSettings
ogs = OverrideGraphicSettings()
ogs.SetProjectionFillColor(color)
ogs.SetProjectionFillPatternId(solidPatternId)
ogs.SetProjectionFillPatternVisible(True)
#Transaction start:
TransactionManager.Instance.EnsureInTransaction(doc)
for i in views:
for j in elems:
output.append(i.SetElementOverrides(j.Id, ogs))
#Transaction end:
TransactionManager.Instance.TransactionTaskDone()
#Assign your output to the OUT variable.
OUT = 0
OverrideGraphicsInViews.dyn (7.8 KB)