Python Script Graphic Override not assigned to Spaces

There’s been some success using this script (with walls) in a Sample Model.

Script is based on Autodesk link:

trans = Transaction(doc, “Space Graphics Filled”)
categories = List[ElementId()
parameterFilterElement = ParameterFilterElement.Create(doc, “Filtering parameters”, categories)

parameterCollector = FilteredElementCollector(doc, view.Id)
parameter = parameterCollector.OfClass(SpatialElement).OfCategory(BuiltInCategory.OST_MEPSpaces).FirstElement().LookupParameter(“Comments”)

filterRules = List[FilterRule()
filterRules.Add(ParameterFilterRuleFactory.CreateNotEqualsRule(parameter.Id, “foo”, True))

filterSettings = OverrideGraphicSettings()
#outline walls in red
filterSettings.SetProjectionFillColor(Color(255, 0, 0))
view.SetFilterOverrides(parameterFilterElement.Id, filterSettings)


The cause of the problem was that the spaces had no graphics to override (being blank).

I found a way around this using Solid Filled Regions to mimic a colour filter.

Do let me know if you’d like to see the code used.