The original scripting component in Rhino uses the CodeDom
compiler, which is outdated and doesn’t support many language features.
This plugin replaces the old compiler with the latest Roslyn compiler and benefits both C# and VB.NET components. You may enjoy more language features, such as inlined variable declaration Brep.ClosestPoint(pt, out var closestPt, out var ci, out var s, out var t, 0.0, out var normal)
and the like.
Moreover, users may enable scripting optimizations through in-code switches, a critical feature for high performance manipulation.
Limitations
- Don’t support Rhino 8 WIP with .NET 7 runtime. I think Rhino has already switched to the Roslyn compiler already, so there’s no need using this plugin.
- Don’t support features relying on new .NET runtime, such as Generic Static Interface. Rhino is still running with .NET Framework.
- The script editor would still complain about the new syntax because it is not updated.
- The first-run speed of Roslyn is slightly slower than the older one, while it is faster for later runs.
- Not tested on macos.
Installation
- Through
PackageManager
, search forBetterScriptComponent
. - Through Food4Rhino (page still under review), copy the entire
BSC
folder into the Components (Libraries
) folder and unblock all DLLs. - Run the following script to see if everything goes well. (The file is shipped with the Food4Rhino version). Test_Installation_Successful.gh (5.5 KB)
Enabling Optimization
- For C# users, put
#pragma optimize
afterusing
statements. - For VB.NET users, put
#Const Optimization = True
afterImports
statements. - Be advised that warnings and errors can be hard to understand with optimization.