Click or drag to resize

LightTableModify Method (Guid, Light)

[Missing <summary> documentation for "M:Rhino.DocObjects.Tables.LightTable.Modify(System.Guid,Rhino.Geometry.Light)"]

Namespace:  Rhino.DocObjects.Tables
Assembly:  RhinoCommon (in RhinoCommon.dll)
Since: 5.0
Syntax
public bool Modify(
	Guid id,
	Light light
)

Parameters

id
Type: SystemGuid

[Missing <param name="id"/> documentation for "M:Rhino.DocObjects.Tables.LightTable.Modify(System.Guid,Rhino.Geometry.Light)"]

light
Type: Rhino.GeometryLight

[Missing <param name="light"/> documentation for "M:Rhino.DocObjects.Tables.LightTable.Modify(System.Guid,Rhino.Geometry.Light)"]

Return Value

Type: Boolean

[Missing <returns> documentation for "M:Rhino.DocObjects.Tables.LightTable.Modify(System.Guid,Rhino.Geometry.Light)"]

Examples
using Rhino;
using Rhino.DocObjects;
using Rhino.Commands;
using Rhino.Input;
using Rhino.UI;

namespace examples_cs
{
  public class ChangeLightColorCommand : Rhino.Commands.Command
  {
    public override string EnglishName
    {
      get { return "csLightColor"; }
    }

    protected override Result RunCommand(RhinoDoc doc, RunMode mode)
    {
      ObjRef obj_ref;
      var rc = RhinoGet.GetOneObject("Select light to change color", true,
        ObjectType.Light, out obj_ref);
      if (rc != Result.Success)
        return rc;
      var light = obj_ref.Light();
      if (light == null)
        return Result.Failure;

      var diffuse_color = light.Diffuse;
      if (Dialogs.ShowColorDialog(ref diffuse_color))
      {
        light.Diffuse = diffuse_color;
      }

      doc.Lights.Modify(obj_ref.ObjectId, light);
      return Result.Success;
    }
  }
}
Python
from Rhino import *
from Rhino.DocObjects import *
from Rhino.Input import *
from Rhino.UI import *
from scriptcontext import doc

def RunCommand():
  rc, obj_ref = RhinoGet.GetOneObject(
    "Select light to change color", 
    True,
    ObjectType.Light)
  if rc != Result.Success:
    return rc
  light = obj_ref.Light()
  if light == None:
    return Result.Failure

  b, color = Dialogs.ShowColorDialog(light.Diffuse)
  if b:
    light.Diffuse = color

  doc.Lights.Modify(obj_ref.ObjectId, light)
  return Result.Success

if __name__ == "__main__":
  RunCommand()
See Also