[Serializable] public class Light : GeometryBase
Represents a light that shines in the modeling space.

Constructors

Light

#Since v5.0
public Light()
Initializes a new light.

Light

#
protected Light(SerializationInfo info, StreamingContext context)
Protected constructor used in serialization.
info (SerializationInfo)Serialization data.
context (StreamingContext)Serialization stream.

Fields

ConstantAttenuationVector

#
public static readonly Vector3d ConstantAttenuationVector
Vector denoting a constant light attenuation.

InverseSquaredAttenuationVector

#
public static readonly Vector3d InverseSquaredAttenuationVector
Vector denoting an inverse squared light attenuation.

LinearAttenuationVector

#
public static readonly Vector3d LinearAttenuationVector
Vector denoting a linear light attenuation.

Properties

Ambient

#Since v5.0
public Color Ambient { get; set; }
Gets or sets the ambient color.

AttenuationType

#Since v7.0
public Light.Attenuation AttenuationType { get; set; }
Get the type of attenuation for this light.

AttenuationVector

#Since v5.7
public Vector3d AttenuationVector { get; set; }
Gets or Sets the attenuation vector.

CoordinateSystem

#Since v5.0
public CoordinateSystem CoordinateSystem { get; }
Gets a value, determined by LightStyle, that explains whether the camera directions are relative to World or Camera spaces.

Diffuse

#ExampleSince v5.0
public Color Diffuse { get; set; }
Gets or sets the diffuse color.

Direction

#Since v5.0
public Vector3d Direction { get; set; }
Gets or sets the vector direction of the camera.

Disposed

public bool Disposed { get; }
Indicates if this object has been disposed or the document it originally belonged to has been disposed.
inherited fromCommonObject

HasBrepForm

public bool HasBrepForm { get; }
Returns true if the Brep.TryConvertBrep function will be successful for this object
inherited fromGeometryBase

HasUserData

public bool HasUserData { get; }
Gets true if this class has any custom information attached to it through UserData.
inherited fromCommonObject

HotSpot

#Since v5.0
public double HotSpot { get; set; }
The hot spot setting runs from 0.0 to 1.0 and is used to provides a linear interface for controlling the focus or concentration of a spotlight. A hot spot setting of 0.0 corresponds to a spot exponent of 128. A hot spot setting of 1.0 corresponds to a spot exponent of 0.0.

Id

#Since v6.0
public Guid Id { get; set; }
Gets the ID of this light.

Intensity

#Since v5.0
public double Intensity { get; set; }
Gets or sets the light intensity.

IsDeformable

public bool IsDeformable { get; }
true if object can be accurately modified with "squishy" transformations like projections, shears, and non-uniform scaling.
inherited fromGeometryBase

IsDirectionalLight

#Since v5.0
public bool IsDirectionalLight { get; }
Gets a value indicating whether the light style is LightStyle CameraDirectional or WorldDirectional.

IsDocumentControlled

public sealed override bool IsDocumentControlled { get; }
If true this object may not be modified. Any properties or functions that attempt to modify this object when it is set to "IsReadOnly" will throw a NotSupportedException.
inherited fromGeometryBase

IsEnabled

#Since v5.0
public bool IsEnabled { get; set; }
Gets or sets a value that defines if the light is turned on (true) or off (false).

IsLinearLight

#Since v5.0
public bool IsLinearLight { get; }
Gets a value indicating whether the light style is LightStyle WorldLinear.

IsPointLight

#Since v5.0
public bool IsPointLight { get; }
Gets a value indicating whether the light style is LightStyle CameraPoint or WorldPoint.

IsRectangularLight

#Since v5.0
public bool IsRectangularLight { get; }
Gets a value indicating whether the light style is LightStyle WorldRectangular.

IsShallowDuplicate

public bool IsShallowDuplicate { get; }
Is this instance a 'shallow copy'. Shallow copies are no different than regular instances with the exception that they will convert to complete independent 'deep' copies if a non const operation is perform on the instance (something that mutates the internal data)
inherited fromGeometryBase

IsSpotLight

#Since v5.0
public bool IsSpotLight { get; }
Gets a value indicating whether the light style is LightStyle CameraSpot or WorldSpot.

IsSunLight

#Since v5.0
public bool IsSunLight { get; }
Gets a value indicating whether this object is a Sun light.

IsValid

public virtual bool IsValid { get; }
Tests an object to see if it is valid.
inherited fromCommonObject

Length

#Since v5.0
public Vector3d Length { get; set; }
Gets or sets the height in linear and rectangular lights.

(ignored for non-linear/rectangular lights.)

LightStyle

#Since v5.0
public LightStyle LightStyle { get; set; }
Gets or sets a light style on this camera.

Location

#Since v5.0
public Point3d Location { get; set; }
Gets or sets the light or 3D position or location.

Name

#Since v5.0
public string Name { get; set; }
Gets or sets the light name.

ObjectType

[CLSCompliant(false)] public ObjectType ObjectType { get; }
Useful for switch statements that need to differentiate between basic object types like points, curves, surfaces, and so on.
inherited fromGeometryBase

PerpendicularDirection

#Since v5.0
public Vector3d PerpendicularDirection { get; }
Gets a perpendicular vector to the camera direction.

PowerCandela

#Since v5.0
public double PowerCandela { get; set; }
Gets or sets the light power in candelas (cd).

PowerLumens

#Since v5.0
public double PowerLumens { get; set; }
Gets or sets the light power in lumens (lm).

PowerWatts

#Since v5.0
public double PowerWatts { get; set; }
Gets or sets the light power in watts (W).

Radius

#Since v9.0
public double Radius { get; set; }
Gets or sets the emitter radius (of the emitting sphere, in model units) for point and spot lights.

Ignored for other light types; linear light radius is derived from Width.

ShadowIntensity

#Since v6.0
public double ShadowIntensity { get; set; }
Gets or sets the shadow intensity for the light.

Specular

#Since v5.0
public Color Specular { get; set; }
Gets or sets the specular color.

SpotAngleRadians

#Since v5.0
public double SpotAngleRadians { get; set; }
Gets or sets the spot angle in radians.

Ignored for non-spot lights.

angle = 0 to pi/2 (0 to 90 degrees).

SpotExponent

#Since v5.0
public double SpotExponent { get; set; }
The spot exponent varies from 0.0 to 128.0 and provides an exponential interface for controlling the focus or concentration of a spotlight (like the OpenGL GL_SPOT_EXPONENT parameter). The spot exponent and hot spot parameters are linked; changing one will change the other. A hot spot setting of 0.0 corresponds to a spot exponent of 128. A hot spot setting of 1.0 corresponds to a spot exponent of 0.0.

SpotLightShadowIntensity

#Since v5.0
public double SpotLightShadowIntensity { get; set; }
obsoleteUse ShadowIntensity
Gets or sets the spot light shadow intensity.

(ignored for non-spot lights.)

UserData

public UserDataList UserData { get; }
List of custom information that is attached to this class.
inherited fromCommonObject

UserDictionary

public ArchivableDictionary UserDictionary { get; }
Dictionary of custom information attached to this class. The dictionary is actually user data provided as an easy to use shareable set of information.
inherited fromCommonObject

UserStringCount

public int UserStringCount { get; }
Gets the amount of user strings.
inherited fromGeometryBase

Width

#Since v5.0
public Vector3d Width { get; set; }
Gets or sets the width in linear and rectangular lights.

(ignored for non-linear/rectangular lights.)

Methods

ComponentIndex

[ConstOperation] public ComponentIndex ComponentIndex()
If this piece of geometry is a component in something larger, like a BrepEdge in a Brep, then this function returns the component index.
inherited fromGeometryBase
This object's component index. If this object is not a sub-piece of a larger geometric entity, then the returned index has m_type = ComponentIndex.InvalidType and m_index = -1.

ConstructConstObject

protected void ConstructConstObject(object parentObject, int subobjectIndex)
Assigns a parent object and a sub-object index to this.
inherited fromCommonObject
parentObject (object)The parent object.
subobjectIndex (int)The sub-object index.

CreateSunLight

#Since v5.0
public static Light CreateSunLight(double northAngleDegrees, DateTime when, double latitudeDegrees, double longitudeDegrees)
Constructs a light which simulates the Sun based on a given time and location on Earth.
northAngleDegrees (double)The angle of North in degrees. North is the angle between positive World X axis and model North, as measured on World XY plane.
when (DateTime)The time of the measurement. The Kind property of DateTime specifies whether this is in local or universal time.

Local and Undefined date-time kinds in this argument are considered local.

latitudeDegrees (double)The latitude, in degrees, of the location on Earth.
longitudeDegrees (double)The longitude, in degrees, of the location on Earth.
A newly constructed light object.
RdkNotLoadedExceptionIf the RDK is not loaded.

CreateSunLight

#Since v5.0
public static Light CreateSunLight(double northAngleDegrees, double azimuthDegrees, double altitudeDegrees)
Constructs a light that represents the Sun.
northAngleDegrees (double)The angle of North in degrees. North is the angle between positive World X axis and model North, as measured on World XY plane.
azimuthDegrees (double)The Azimuth angle value in degrees. Azimuth is the compass angle from North.
altitudeDegrees (double)The Altitude angle in degrees. Altitude is the angle above the ground plane.
A new sun light.
RdkNotLoadedExceptionIf the RDK is not loaded.

CreateSunLight

#Since v5.0
public static Light CreateSunLight(Sun sun)
Constructs a light which simulates a Sun.
sun (Sun)A Sun object from the Rhino.Render namespace.
A light.

DataCRC

[CLSCompliant(false)] public uint DataCRC(uint currentRemainder)
Returns a CRC calculated from the information that defines the object. This CRC can be used as a quick way to see if two objects are not identical.
inherited fromGeometryBase
currentRemainder (uint)The current remainder value.
CRC of the information the defines the object.

DeleteAllUserStrings

public void DeleteAllUserStrings()
inherited fromGeometryBase

DeleteUserString

public bool DeleteUserString(string key)
inherited fromGeometryBase
key (string)

Dispose

public void Dispose()
Actively reclaims unmanaged resources that this instance uses.
inherited fromCommonObject

Dispose

protected override void Dispose(bool disposing)
Overridden in order to destroy local display cache information
inherited fromGeometryBase
disposing (bool)

Duplicate

public virtual GeometryBase Duplicate()
Constructs a deep (full) copy of this object.
inherited fromGeometryBase
An object of the same type as this, with the same properties and behavior.

DuplicateShallow

public GeometryBase DuplicateShallow()
Constructs a light copy of this object. By "light", it is meant that the same underlying data is used until something is done to attempt to change it. For example, you could have a shallow copy of a very heavy mesh object and the same underlying data will be used when doing things like inspecting the number of faces on the mesh. If you modify the location of one of the mesh vertices, the shallow copy will create a full duplicate of the underlying mesh data and the shallow copy will become a deep copy.
inherited fromGeometryBase
An object of the same type as this object.

This behavior is overridden by implementing classes.

EnsurePrivateCopy

public void EnsurePrivateCopy()
If you want to keep a copy of this class around by holding onto it in a variable after a command completes, call EnsurePrivateCopy to make sure that this class is not tied to the document. You can call this function as many times as you want.
inherited fromCommonObject

GetAttenuation

#Since v5.0
[ConstOperation] public double GetAttenuation(double d)
Gets the attenuation settings (ignored for "directional" and "ambient" lights).

attenuation = 1/(a0 + d*a1 + d^2*a2) where d = distance to light.

d (double)The distance to evaluate.
0 if a0 + d*a1 + d^2*a2 <= 0.

GetBoundingBox

[ConstOperation] public BoundingBox GetBoundingBox(bool accurate)
Bounding box solver. Gets the world axis aligned bounding box for the geometry.
inherited fromGeometryBase
accurate (bool)If true, a physically accurate bounding box will be computed. If not, a bounding box estimate will be computed. For some geometry types there is no difference between the estimate and the accurate bounding box. Estimated bounding boxes can be computed much (much) faster than accurate (or "tight") bounding boxes. Estimated bounding boxes are always similar to or larger than accurate bounding boxes.
The bounding box of the geometry in world coordinates or BoundingBox.Empty if not bounding box could be found.

GetBoundingBox

[ConstOperation] public BoundingBox GetBoundingBox(Plane plane, out Box worldBox)
Aligned Bounding box solver. Gets the plane aligned bounding box.
inherited fromGeometryBase
plane (Plane)Orientation plane for BoundingBox.
worldBox (out Box)Aligned box in World coordinates.
A BoundingBox in plane coordinates.

GetBoundingBox

[ConstOperation] public BoundingBox GetBoundingBox(Plane plane)
Aligned Bounding box solver. Gets the plane aligned bounding box.
inherited fromGeometryBase
plane (Plane)Orientation plane for BoundingBox.
A BoundingBox in plane coordinates.

GetBoundingBox

[ConstOperation] public virtual BoundingBox GetBoundingBox(Transform xform)
Aligned Bounding box solver. Gets the world axis aligned bounding box for the transformed geometry.
inherited fromGeometryBase
xform (Transform)Transformation to apply to object prior to the BoundingBox computation. The geometry itself is not modified.
The accurate bounding box of the transformed geometry in world coordinates or BoundingBox.Empty if not bounding box could be found.

GetObjectData

[SecurityPermission(SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.SerializationFormatter)] public virtual void GetObjectData(SerializationInfo info, StreamingContext context)
Populates a System.Runtime.Serialization.SerializationInfo with the data needed to serialize the target object.
inherited fromCommonObject
info (SerializationInfo)The System.Runtime.Serialization.SerializationInfo to populate with data.
context (StreamingContext)The destination (see System.Runtime.Serialization.StreamingContext) for this serialization.

GetSpotLightRadii

#Since v5.0
[ConstOperation] public bool GetSpotLightRadii(out double innerRadius, out double outerRadius)
Gets the spot light radii.
innerRadius (out double)The inner radius. This out parameter is assigned during this call.
outerRadius (out double)The outer radius. This out parameter is assigned during this call.
true if operation succeeded; otherwise, false.

GetUserString

public string GetUserString(string key)
Gets user string from this geometry.
inherited fromGeometryBase
key (string)id used to retrieve the string.
string associated with the key if successful. null if no key was found.

GetUserStrings

public NameValueCollection GetUserStrings()
Gets a copy of all (user key string, user value string) pairs attached to this geometry.
inherited fromGeometryBase
A new collection.

IsValidWithLog

public bool IsValidWithLog(out string log)
Determines if an object is valid. Also provides a report on errors if this object happens not to be valid.
inherited fromCommonObject
log (out string)A textual log. This out parameter is assigned during this call.
true if this object is valid; false otherwise.

MakeDeformable

public bool MakeDeformable()
If possible, converts the object into a form that can be accurately modified with "squishy" transformations like projections, shears, an non-uniform scaling.
inherited fromGeometryBase
false if object cannot be converted to a deformable object. true if object was already deformable or was converted into a deformable object.

MemoryEstimate

[CLSCompliant(false)] [ConstOperation] public uint MemoryEstimate()
Computes an estimate of the number of bytes that this object is using in memory.
inherited fromGeometryBase
An estimated memory footprint.

NonConstOperation

protected override void NonConstOperation()
Destroy cache handle
inherited fromGeometryBase

OnSwitchToNonConst

protected override void OnSwitchToNonConst()
Is called when a non-constant operation occurs.
inherited fromGeometryBase

Rotate

public bool Rotate(double angleRadians, Vector3d rotationAxis, Point3d rotationCenter)
Rotates the object about the specified axis. A positive rotation angle results in a counter-clockwise rotation about the axis (right hand rule).
inherited fromGeometryBase
angleRadians (double)Angle of rotation in radians.
rotationAxis (Vector3d)Direction of the axis of rotation.
rotationCenter (Point3d)Point on the axis of rotation.
true if geometry successfully rotated.

Scale

public bool Scale(double scaleFactor)
Scales the object by the specified factor. The scale is centered at the origin.
inherited fromGeometryBase
scaleFactor (double)The uniform scaling factor.
true if geometry successfully scaled.

SetAttenuation

#Since v5.0
public void SetAttenuation(double a0, double a1, double a2)
Sets the attenuation settings (ignored for "directional" and "ambient" lights).

attenuation = 1/(a0 + d*a1 + d^2*a2) where d = distance to light.

a0 (double)The new constant attenuation divisor term.
a1 (double)The new reverse linear attenuation divisor term.
a2 (double)The new reverse quadratic attenuation divisor term.

SetUserString

public bool SetUserString(string key, string value)
Attach a user string (key,value combination) to this geometry.
inherited fromGeometryBase
key (string)id used to retrieve this string.
value (string)string associated with key.
true on success.

ToJSON

public string ToJSON(SerializationOptions options)
Create a JSON string representation of this object
inherited fromCommonObject
options (SerializationOptions)

Transform

public bool Transform(Transform xform)
Transforms the geometry. If the input Transform has a SimilarityType of OrientationReversing, you may want to consider flipping the transformed geometry after calling this function when it makes sense. For example, you may want to call Flip() on a Brep after transforming it.
inherited fromGeometryBase
xform (Transform)Transformation to apply to geometry.
true if geometry successfully transformed.

Translate

public bool Translate(double x, double y, double z)
Translates the object along the specified vector.
inherited fromGeometryBase
x (double)The X component.
y (double)The Y component.
z (double)The Z component.
true if geometry successfully translated.

Translate

public bool Translate(Vector3d translationVector)
Translates the object along the specified vector.
inherited fromGeometryBase
translationVector (Vector3d)A moving vector.
true if geometry successfully translated.