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 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 .
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:
engine:
persistent: true
reference: python - NameError raised by IUpdater registered through pyRevit - Stack Overflow