0

I want to color in Revit with Pyrevit some Elements: all Walls in Black, the windows in green and Doors in Pink.

I found this solution but it´s not working:

Example

"""
All elements of Category
Get all elements of the specified category from Model.
"""

#Imports.
import csv
from Autodesk.Revit.DB import FilteredElementCollector, BuiltInCategory, BuiltInParameter
from Autodesk.Revit import revit,DB
from pyrevit.coreutils import colors

# We will need to access the active document. The UIApplication instance is referenced by the `__revit__` builtin variable, provided by pyRevit execution engine
doc = __revit__.ActiveUIDocument.Document
uidoc = __revit__.ActiveUIDocument

classpyrevit.coreutils.colors.RGB(name='default', red=0, green=0, blue=0):
    ALICEBLUE = RGB('aliceblue', 240, 248, 255)
    PINK = RGB(name='pink', red=255, green=192, blue=203)
    DARKVIOLET = RGB(name='darkviolet', red=148, green=0, blue=211

walls = FilteredElementCollector(doc).OfCategory(BuiltInCategory.OST_Walls).WhereElementIsNotElementType()

for wall in walls
    colors.COLORS['pink']

door_collector = FilteredElementCollector(doc).OfCategory(BuiltInCategory.OST_Doors).WhereElementIsNotElementType()
for door in door_collector
    colors.COLORS['aliceblue']

window_collector = FilteredElementCollector(doc).OfCategory(BuiltInCategory.OST_Windows).WhereElementIsNotElementType()
for window in window_collector
    colors.COLORS['darkviolet']

May you can help me!! Thanks a lot. Regards

Sofia
  • 1
  • I don't know `revit`, but in your `for` loops you did not change the loop variable, e.g. `wall` or `door`. It seems it should be `door.color = colors.COLORS['aliceblue']` or something like this. – am.rez Jun 16 '20 at 13:23

1 Answers1

0

You are in luck!

The Building Coder just discussed an easy way to change the element colour in a view.

That should exactly fit your bill.

Jeremy Tammik
  • 7,333
  • 2
  • 12
  • 17