Override element in a specified view

Hello everybody, hope you are all fine.
I’ve seen a node called Element.OverrideInView in wich you can override elements in the Active view
i need a node to override elements in a specified view. It is nearly equal to the mentioned node, the only difference is that it takes a view as an input.

Thanks in advance for your help!

PS: I’ve alson seen the node View.SetCategoryOverrides, wich overrides elements in view of a specified category… unfortunately it won’t do the work for my current Graph

Hi :slight_smile:

Not an expert, but if there is a node that allows you to switch from the active view to antoher (making the latter the active view), you could simply use the Element.overrideInView node :slight_smile:

But maybe there isn’t such a node…


You could play around with this python script and instead of the “doc.ActiveView.” part you could feed it the views in which you want to override the settings.
Furthermore you can edit other properties (not only line color) by looking at this:
http://www.revitapidocs.com/2018.1/8dba94a9-d575-d4db-1858-dd47140efd7c.htm

Thanks for your help @GregX but i don’t understand anything of the Revit API… That seems unearthly to me hehehe

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)

4 Likes