Check for Overrides

Hi All,

Has anyone got a way to check if an element has been overridden in the Revit environment (Projection Lines, Cut Patterns etc.) and create a list of these elements.

I am looking to find out what has been ‘fudged’ by some less experienced staff.

Thanks for any help,
Ewan

Overridden by element?

Example.
A column in View 1 is concrete and has a cut pattern of Style 1 set by its material.
But a staff member has changed the cut pattern to Style 2 in View 1.

Something like
Element In->

No Override = 0
Override exists = 1

Separate Outs->

Understood. But overridden individually or by category, or by view template?

I’m assuming individual, (element override).

This figures out which elements are overridden for color in the current active view… I’m having a heck of a time making it work over multiple views.

The custom node (Element.IsColorOverridden) is from Rhythm, I will publish this node soon.

Something like this?


##dynamo file
findOveriddenElements.dyn (6.3 KB)

##python script:

import clr

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

elements = UnwrapElement(IN[0])
view = UnwrapElement(IN[1])

OUT = []
for element in elements:
	o = view.GetElementOverrides(element.Id)
	OUT.append(
	not any([
	o.CutFillColor.IsValid, 
	o.CutFillPatternId > 0, 
	o.CutLineColor.IsValid, 
	o.CutLinePatternId > 0, 
	o.CutLineWeight > 0, 
	o.DetailLevel.ToString() != "Undefined",
	o.Halftone,	
	not(o.IsCutFillPatternVisible),
	not(o.IsProjectionFillPatternVisible), 
	o.ProjectionFillColor.IsValid, 
	o.ProjectionFillPatternId > 0, 
	o.ProjectionLineColor.IsValid, 
	o.ProjectionLinePatternId > 0, 
	o.ProjectionLineWeight > 0, 
	o.Transparency != 0
	])
	)
7 Likes

This is exactly what I was thinking. Legend!

Possible with Linework overrides?

In my current script it does not find the element if the line pattern is overridden, even though it appears to be listed in the python code ‘as pictured’ any ideas out there?

Find Elements that are Overridden in View.dyn (10.4 KB)

The only thing I can think of is that we are comparing ElementIds with integeres. The easiest way to fix this is to add .IntegerValue after all properties that ends with Id. like this:¨

o.CutLinePatternId.IntegerValue > 0

Try that and see if it works better, hope it does.

1 Like

Yep, this now allows the node to identify the overridden line pattern, good tip!

Nice, here is the updated python code:

import clr

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

elements = UnwrapElement(IN[0])
view = UnwrapElement(IN[1])

OUT = []
for element in elements:
	o = view.GetElementOverrides(element.Id)
	OUT.append(
	not any([
	o.CutFillColor.IsValid, 
	o.CutFillPatternId.IntegerValue > 0, 
	o.CutLineColor.IsValid, 
	o.CutLinePatternId.IntegerValue > 0, 
	o.CutLineWeight > 0, 
	o.DetailLevel.ToString() != "Undefined",
	o.Halftone,	
	not(o.IsCutFillPatternVisible),
	not(o.IsProjectionFillPatternVisible), 
	o.ProjectionFillColor.IsValid, 
	o.ProjectionFillPatternId.IntegerValue > 0, 
	o.ProjectionLineColor.IsValid, 
	o.ProjectionLinePatternId.IntegerValue > 0, 
	o.ProjectionLineWeight > 0, 
	o.Transparency != 0
	])
	)
3 Likes

Hi Guys,
Something doesn’t work for me. The Python Script gives this warning:
Warning:
IronPythonEvaluator.EvaluateIronPythonScript operation failed.
Traceback (most recent call last):
File “”, line 11, in
AttributeError: ‘List[object]’ object has no attribute ‘Id’

IN[0] must be a flat list.

Thanks a million.
List.Flatten has done the trick.

Hi Einar_Raknes,

I’m pretty new to python script and try to use yours but it seems not working with error message as shown image, Do you know how to fix this?

Hi @young
This error is occurring because you haven’t plugged in any inputs to the node .

IN[0] a list of the elements
and
IN[1] a view that they are visible in.

It seems another error message popped up after following the same setting as the example above.

Hi @young
Can you please start a new topic and put a link to your comment in there, this is in keeping with forum guidelines as to not compromise the content of solved topics.
I can continue to assist you once this is done :slight_smile:

2 Likes

You’re dealing with a thread from 2016. Revit 19 or 20 changed to allow a background and foreground fill for elements so there’s now a property for each rather than just one.

Check the API for the current properties: OverrideGraphicSettings Members

If you’re not capable with Python, and somebody else in the world has already done the work, I always suggest to just use their nodes. E.g. this one from GeniusLoci. You can then check the values and filter your list in the Dynamo environment and you’ll probably get a lot closer to a result than you will trying to copy paste code from a 6 year old forum without much Python knowledge.

4 Likes