Color Splasher in pyRevit 🍾

This is something I always wanted to do myself but never got the time or skills to do it at the time:

Porting the Color Splasher from C# to pyRevit python

Where from?

Historically, the Color Splasher is a tool that has been developed by the very first devs :muscle: behind BIMTrack (now Newforma Konekt) at BIM One inc. while working on the Québec Airport Project.

In 2014, BIMTrack did not even exist at the time.

What it does.

The original Color Splasher tool allowed you to color the elements of the active view according to their parameter values.

Nonica ported the open source code from C# to python just recently.

I asked if I could take it further and bring it into pyRevit and got Jaime from Nonica a Go.
Its version also allows for color legend creation.

BIM One Consulting, the company I work for also gave me some time ($) to work on the port :pray: .
I added the possibility to also create view filters.

  • Based on ColorSplasher by BIMOne - MIT License - 2021 BIM One Inc.
  • First Dynamo - Python edition December 2023: Nonica by Estudio Alonso Candau SLP - Jaime Alonso Candau - See specific non-commercial license agreement for Nonica in the script
  • Refactored, pyRevit-ed and added View Filters Creation version by Jean-Marc Couffin, December 2023

Tested against 2024 and should work from Revit 2021 version

One issue I got, moving it from my Extension to the pyRevit Tools set was

global name 'DataTable' is not defined

IronPython.Runtime.UnboundNameException: global name ‘DataTable’ is not defined
à IronPython.Runtime.Operations.PythonOps.GetVariable(CodeContext context, String name, Boolean isGlobal, Boolean lightThrow)
à IronPython.Compiler.LookupGlobalInstruction.Run(InterpretedFrame frame)
à Microsoft.Scripting.Interpreter.Interpreter.Run(InterpretedFrame frame)
à Microsoft.Scripting.Interpreter.LightLambda.Run4[T0,T1,T2,T3,TRet](T0 arg0, T1 arg1, T2 arg2, T3 arg3)
à IronPython.Compiler.PythonCallTargets.OriginalCallTarget3(PythonFunction function, Object arg0, Object arg1, Object arg2)
à CallSite.Target(Closure , CallSite , Object , Object , EventArgs )
à System.Dynamic.UpdateDelegates.UpdateAndExecute3[T0,T1,T2,TRet](CallSite site, T0 arg0, T1 arg1, T2 arg2)
à Scripting(Object[] , Object , EventArgs )
à System.Windows.Forms.ComboBox.OnSelectedIndexChanged(EventArgs e)
à System.Windows.Forms.ComboBox.WmReflectCommand(Message& m)
à System.Windows.Forms.ComboBox.WndProc(Message& m)
à System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

The issue was resolved making the pyRevit engine persistent at the bundle level with:

  persistent: true

reference: python - NameError raised by IUpdater registered through pyRevit - Stack Overflow


The latest installers from the develop branch are available from here:

1 Like

That’s very cool. It also reminds me of a tool that ‘Naviate for Revit’ has. The exact name of the tool button on that toolbar eludes me but it also allows for coloring based on parameter values.

I’m going to inform our bim team about this!

1 Like

You are thinking about the Colour Elements from Naviate:

One filter from DiRoots has a similar functiunality, but maybe not as complete.

Have a good day.
It’s cool that you added this feature to the pyRevit. This is a really useful thing. Thanks!
It would also be great to be able to create a color template like it was in the original version. Tell me, maybe there is such a function that I did not notice? Are there any plans to add the ability to create a color template?
In our company, we use specific colors to paint concrete elements on drawings (depending on the elevation or type). That’s why it doesn’t work for us without a color template. But I would like to use your the already installed in pyRevit tool.

1 Like

@Baev94 Indeed, and no it is not implemented, but feel free to have a go

1 Like

It’s a very cool tool, thanks for adding it to PyRevit!
However, I noticed one difference compared to the original Splasher tool. “Save schema” and “Load schema” are not provided in Color Splasher in PyRevit. These are beneficial functions to unify colors and create templates. That would be great if these functions could be added soon

Thanks for sharing Jean-Marc! We keep working and hopefully we can release soon the save/load color scheme feature.

1 Like

I am encountering the unhandled exception error of ‘DataTable’ is not defined. I’ve checked the bundle file and it already has the persistent engine set to true. This is with v4.8.14 and Revit 2023.


Yeah, annoying and mostly inconsistent. I did not find a way to repeat the error consistently and figure out what is going wrong.
I got a revised version. Of the code by and need to pyrevitify it a bit before.