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:

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
import Autodesk
from Autodesk.Revit.DB import *

#Import DocumentManager and TransactionManager
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()

#Transaction start:

for i in views:
	for j in elems:
		output.append(i.SetElementOverrides(j.Id, ogs))	

#Transaction end:

#Assign your output to the OUT variable.
OUT = 0

OverrideGraphicsInViews.dyn (7.8 KB)


Many thanks @Martin_Spence! I tried exactly your solution but does not seam to work on Revit 2020.2 and Dynamo 2.3.
Attached you a screenshot of the nodes and the error.


Hi @jaialcan,

Yeah this was from before we got forground/background control. I cant check this right now, but Im guessing you could make it work by changing the line




Cant tell you for sure if you’ll run into trouble further down the line, since Im on a Phone atm. Otherwise i might be able to look into it later.

1 Like

Thanks @MartinSpence for your fast response. I made the change but it looks there is another error. Attached you the screenshot.

Yes I can see the methods have been changed to accomodate the functionality. Ill have to look into it later, unless some one beats me to it :slightly_smiling_face:

1 Like

Many thanks @MartinSpence ! I finally got it working with the Genius Locci package. Attached the screenshot as it may be of help to others.