Element color override in viewS

Hello guys,
I am trying to color some elements in multiple views. I was trying to use the ootb node “Element.OverrideColorInView” but then I realized that it just works in the active view! I guess what I’d need is exactly the same node but additional to the “element” and “color” inputs also an input where I say in which views I want to color the elements
I tried a node in “hot gear” package, but unfortunately it didnt work, i, using revit 2018

any help ?

1 Like

Hi @anthony.hindi

You can use OOTB nodes also:
image

2 Likes

hello @Kulkul
thank you for your reply,
but i think the OOTB node will override elements in the active view,
i would like to specify the view(s) i want to color override elements in

Thank you

Your Override Graphic Settings node is looking for Projection Pattern Id but you’re giving it a color. You can probably leave that input empty if you don’t need to change the fill pattern.

Also, you could just set up a filter.

Hi @Nick_Boyts
I tried removing the color node still didnt work,
i can’t use filter, actually im trying to override some walls using element ID coming from an excel file in multiple 3d views,
i succeed to do it in the acive 3d view only,

I’m trying to color specific elements that come from a list (from the filter by bool mask) not categories or other.
Any help ?

You might have to try Python. Most of the custom nodes that use the active view are in Python so you could use them as a starting point.

1 Like

I’m also looking for a way to color specific elements in specific views. In my case, highlight specific walls (a list of lists) in specific views (a list).

So far I’m left with two options:
a) create a filter for each view based in parameters of the walls. I’m trying to avoid this, because I don’t want to fill my project with 100+ different filters

b) figure out how to change a node that uses ‘active view’ to accept a list of views.

@Nick_Boyts, is there a way to access the script from built in nodes as OverrideInView?

I found a way!

I edited the Clockwork node OverrideElementTransparency.
By editing the python code is possible to set other overrides than Transparency.

For example, I used it to set a pattern and a pattern color (changes marked wih #)
Don’t forget to set the lacing to longest!

I have been trying to do the same as the previous post. I’am looking for a way to override different colors of elements in multiple views.
The original Python script with transparency works fine but when I change it like above there is no result.
My idea is to change the input in Line 17 to: color = IN[2] and line 24 to: Override.SetCutFillColor(color). I have tried a lot of options by changing other lines, but I’am not familiair with Python so can anybody help me to get this to work.

Here’s an example of a Python script that overrides Tags by view. Keep in mind that list of Elements and list of Views have to match in length.

Here’s Python script:

# Copyright(c) 2019, Konrad K Sobon
# @arch_laboratory, http://archi-lab.net

import clr
clr.AddReference("RevitNodes")
import Revit
clr.ImportExtensions(Revit.Elements)

clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
doc = DocumentManager.Instance.CurrentDBDocument

clr.AddReference("RevitAPI")
import Autodesk
from Autodesk.Revit.DB import *

import sys
pyt_path = r'C:\Program Files (x86)\IronPython 2.7\Lib'
sys.path.append(pyt_path)

def ConvertColor(e):
	return Autodesk.Revit.DB.Color(e.Red, e.Green, e.Blue)

def OverrideColorPattern(e, c, f, view):
	gSettings = OverrideGraphicSettings()
	gSettings.SetProjectionLineColor(c)
	gSettings.SetProjectionLinePatternId(UnwrapElement(f).Id)
	UnwrapElement(view).SetElementOverrides(UnwrapElement(e).Id, gSettings)
	return e

try:
	errorReport = None
	TransactionManager.Instance.EnsureInTransaction(doc)
	
	c = ConvertColor(IN[1])
	output = []
	for i, j in zip(IN[0], IN[3]):
		output.append(OverrideColorPattern(i, c, IN[2], j))

	TransactionManager.Instance.TransactionTaskDone()
except:
	import traceback
	errorReport = traceback.format_exc()

if errorReport == None:
	OUT = output
else:
	OUT = errorReport

Obviously I just did lines because I was overriding tags, so they don’t have solid geometry, but for someone who wants to override walls, you might want to also add surfaces to the override routine. The API is referenced here:

https://apidocs.co/apps/revit/2020/bd467fbb-a9da-7cf1-1ef5-f0f3568db0ac.htm

It’s a different API for Revit 2020 which is what I am using for demonstration above. Keep in mind that some older methods available in 2017 or 2018 were removed in 2020.

Script:

2_colorByView.dyn (12.3 KB)

Cheers!

3 Likes

Hello Konrad, Thanks for the input, but because I have no knowledge of Python, I can’t make it to work.
There is a Node called “Override Projection Lineweigth in View” by Bakery. I have tried to change this one to make it work with “Color” but the result is null.
Below is the script. I would be very greatfull if you could tell me what I would need change in this script to make it work for CutFillColor and ProjectionFillColor.
Thanks.

#Created by DPS Design, dpsdesign.org
import clr
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *

# Import ToDSType(bool) extension method
clr.AddReference("RevitNodes")
import Revit
clr.ImportExtensions(Revit.Elements)

# Import DocumentManager and TransactionManager
clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager

from System.Collections.Generic import *

# Import RevitAPI
clr.AddReference("RevitAPI")
import Autodesk

doc = DocumentManager.Instance.CurrentDBDocument
uiapp = DocumentManager.Instance.CurrentUIApplication
app = uiapp.Application

##
##Pat = FilteredElementCollector(doc).OfClass(FillPatternElement).ToElements()
##


#The inputs to this node will be stored as a list in the IN variable.
dataEnteringNode = IN
listlength = IN[3]

#unwrap all elements to use with API
elements = []
for i in IN[0]:
	elements.append(UnwrapElement(i))

viewlist = []
for j in IN[2]:
	viewlist.append(UnwrapElement(j))
#create graphic overrides properties
gSettings = Autodesk.Revit.DB.OverrideGraphicSettings()


#set Projection Line weight
gSettings.SetProjectionLineWeight(IN[1])
##gSettings.SetCutLineWeight(IN[1])


# "Start" the transaction
TransactionManager.Instance.EnsureInTransaction(doc)

result = []
#apply lineweight override to elements in an input list
for k in listlength:
	try:
		id = elements[k].Id
	###	color[k].Id
		viewlist[k].SetElementOverrides(id, gSettings,)
		result.append("success")
	except:
		result.append("failure")
	

# "End" the transaction
TransactionManager.Instance.TransactionTaskDone()

#Assign your output to the OUT variable
OUT = elements, result

Hi,

There is a YouTube I got help.

Dynamo - Color Overrides [Advance]

Hope this is helpful!