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

Constructors

Light

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

Light

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

Fields

ConstantAttenuationVector

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

InverseSquaredAttenuationVector

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

LinearAttenuationVector

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

Properties

Ambient

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

AttenuationType

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

AttenuationVector

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

CoordinateSystem

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

Diffuse

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

Direction

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

Disposed

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

HasBrepForm

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

HasUserData

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

HotSpot

#Since v5.0
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.
public double HotSpot { get; set; }

Id

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

Intensity

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

IsDeformable

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

IsDirectionalLight

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

IsDocumentControlled

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.
public sealed override bool IsDocumentControlled { get; }
inherited fromGeometryBase

IsEnabled

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

IsLinearLight

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

IsPointLight

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

IsRectangularLight

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

IsShallowDuplicate

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)
public bool IsShallowDuplicate { get; }
inherited fromGeometryBase

IsSpotLight

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

IsSunLight

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

IsValid

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

Length

#Since v5.0
Gets or sets the height in linear and rectangular lights.

(ignored for non-linear/rectangular lights.)

public Vector3d Length { get; set; }

LightStyle

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

Location

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

Name

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

ObjectType

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

PerpendicularDirection

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

PowerCandela

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

PowerLumens

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

PowerWatts

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

Radius

#Since v9.0
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.

public double Radius { get; set; }

ShadowIntensity

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

Specular

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

SpotAngleRadians

#Since v5.0
Gets or sets the spot angle in radians.

Ignored for non-spot lights.

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

public double SpotAngleRadians { get; set; }

SpotExponent

#Since v5.0
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.
public double SpotExponent { get; set; }

SpotLightShadowIntensity

#Since v5.0
Gets or sets the spot light shadow intensity.

(ignored for non-spot lights.)

public double SpotLightShadowIntensity { get; set; }
obsoleteUse ShadowIntensity

UserData

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

UserDictionary

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

UserStringCount

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

Width

#Since v5.0
Gets or sets the width in linear and rectangular lights.

(ignored for non-linear/rectangular lights.)

public Vector3d Width { get; set; }

Methods

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.
[ConstOperation] public ComponentIndex ComponentIndex()
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

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

CreateSunLight

#Since v5.0
Constructs a light which simulates the Sun based on a given time and location on Earth.
public static Light CreateSunLight(
northAngleDegrees,
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,
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,
The latitude, in degrees, of the location on Earth.
longitudeDegrees
The longitude, in degrees, of the location on Earth.
)
A newly constructed light object.
RdkNotLoadedExceptionIf the RDK is not loaded.

CreateSunLight

#Since v5.0
Constructs a light that represents the Sun.
public static Light CreateSunLight(
northAngleDegrees,
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,
The Azimuth angle value in degrees. Azimuth is the compass angle from North.
altitudeDegrees
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
Constructs a light which simulates a Sun.
public static Light CreateSunLight(
sun
A Sun object from the Rhino.Render namespace.
)
A light.

DataCRC

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.
[CLSCompliant(false)] public uint DataCRC(
currentRemainder
The current remainder value.
)
inherited fromGeometryBase
CRC of the information the defines the object.

DeleteAllUserStrings

public void DeleteAllUserStrings()
inherited fromGeometryBase

DeleteUserString

public bool DeleteUserString(
key
)
inherited fromGeometryBase

Dispose

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

Dispose

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

Duplicate

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

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.
public GeometryBase DuplicateShallow()
inherited fromGeometryBase
An object of the same type as this object.

This behavior is overridden by implementing classes.

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.
public void EnsurePrivateCopy()
inherited fromCommonObject

GetAttenuation

#Since v5.0
Gets the attenuation settings (ignored for "directional" and "ambient" lights).

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

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

GetBoundingBox

Bounding box solver. Gets the world axis aligned bounding box for the geometry.
[ConstOperation] public BoundingBox GetBoundingBox(
accurate
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.
)
inherited fromGeometryBase
The bounding box of the geometry in world coordinates or BoundingBox.Empty if not bounding box could be found.

GetBoundingBox

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

GetBoundingBox

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

GetBoundingBox

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

GetObjectData

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

GetSpotLightRadii

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

GetUserString

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

GetUserStrings

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

IsValidWithLog

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

MakeDeformable

If possible, converts the object into a form that can be accurately modified with "squishy" transformations like projections, shears, an non-uniform scaling.
public bool MakeDeformable()
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

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

NonConstOperation

Destroy cache handle
protected override void NonConstOperation()
inherited fromGeometryBase

OnSwitchToNonConst

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

Rotate

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

Scale

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

SetAttenuation

#Since v5.0
Sets the attenuation settings (ignored for "directional" and "ambient" lights).

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

public void SetAttenuation(
a0,
The new constant attenuation divisor term.
a1,
The new reverse linear attenuation divisor term.
a2
The new reverse quadratic attenuation divisor term.
)

SetUserString

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

ToJSON

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

Transform

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.
public bool Transform(
Transform
xform
Transformation to apply to geometry.
)
inherited fromGeometryBase
true if geometry successfully transformed.

Translate

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

Translate

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