Lights in Grasshopper via C#

In this post @DavidRutten shows how to control lights via C# in GH.

The script works great, but I would need an additional input which is light intensity. (so far the scripts inputs are location and colour only)

Would be great if someone skilled in C# can help me out…

Should just be adding this line.
light.Intensity = Intensity; (8.4 KB)

Works great, thank you Michael!

There is still a strange problem:

When I copy past the script into another or the same file it turns red and says:

  1. Error (CS0246): Der Typ- oder Namespacename ‘Color’ konnte nicht gefunden werden. (Fehlt eine Using-Direktive oder ein Assemblyverweis?) (line 54)

Meaning that the type or namespace for ‘Color’ couldn’t be found.

Even if I copy the other components into that file it works only until I reload the file.

This happen also to @DavidRutten original scripting component.

Any ideas?

It’s a bug in the current Grasshopper release.

You’ll have to open up the script and in the white region near line 12 type either:

Imports System.Drawing

if it’s a VB component or:

using System.Drawing;

if it’s a C# component.

Thank you for this hint!