Layer
Inheritance Hierarchy
System.Object
Rhino.Runtime.CommonObject
Rhino.DocObjects.ModelComponent
Rhino.DocObjects.Layer
Namespace: Rhino.DocObjects
Assembly: RhinoCommon (in RhinoCommon.dll)
Syntax
[SerializableAttribute]public sealed class Layer : ModelComponent, IEquatable<Layer>
The Layer type exposes the following members.
Constructors
Name
Description
Public Method
Layer
Initializes a new instance of the Layer class
Properties
Name
Description
Public Property
Color
Gets or sets the display color for this layer.
Public Property
ComponentStatus
Gets or sets the status of the layer.
(Overrides
ModelComponent.ComponentStatus
.)Public Property
ComponentType
Returns Layer.
(Overrides
ModelComponent.ComponentType
.)Public Property
DeletedName
Gets the name of a component that is deleted.
(Inherited from ModelComponent.)
Public Property
Disposed
Indicates if this object has been disposed or the document it originally belonged to has been disposed.
(Inherited from CommonObject.)
Public Property
Code Example
FullPath
Gets the full path to this layer. The full path includes nesting information.
Public Property
HasId
Returns a value indicating whether the component has an ID.
(Inherited from ModelComponent.)
Public Property
HasIndex
Returns a value indicating whether the component has an Index.
(Inherited from ModelComponent.)
Public Property
HasName
Returns a value indicating whether the component has a Name.
(Inherited from ModelComponent.)
Public Property
HasUserData
Gets true if this class has any custom information attached to it through UserData.
(Inherited from CommonObject.)
Public Property
Id
Gets or sets the ID of this layer object. You typically do not need to assign a custom ID.
(Overrides
ModelComponent.Id
.)Public Property
IdIsLocked
Returns a value indicating whether the component ID is already locked.
(Inherited from ModelComponent.)
Public Property
IgesLevel
Gets or sets the IGES level for this layer.
Public Property
Index
Gets or sets the model component index attribute.
(Inherited from ModelComponent.)
Public Property
IndexIsLocked
Returns a value indicating whether the component Index is already locked.
(Inherited from ModelComponent.)
Public Property
InstanceDefinitionModelSerialNumber
When a component is in a model as part of the information required for a linked instance definition, this value identifies the linked instance definition reference model.
(Inherited from ModelComponent.)
Public Property
IsComponentStatusLocked
The component status itself can be locked. This returns an indication.
(Inherited from ModelComponent.)
Public Property
IsCurrent
Returns true if the layer is the current layer.
Public Property
IsDeleted
Gets a value indicating whether this layer has been deleted and is currently in the Undo buffer.
(Overrides
ModelComponent.IsDeleted
.)Public Property
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.
(Inherited from CommonObject.)
Public Property
IsExpanded
Gets or sets a value indicating whether this layer is expanded in the Rhino Layer dialog.
Public Property
Code Example
IsLocked
Gets or sets a value indicating the locked state of this layer.
Public Property
IsReference
Gets a value indicting whether this layer is a referenced layer. Referenced layers are part of referenced documents.
(Overrides
ModelComponent.IsReference
.)Public Property
IsReferenceParentLayer
Returns true if the layer is a parent layer of the layer tree from a linked instance definition or the layer tree from a worksession reference model.
Public Property
IsSystemComponent
True if this model component is a system constant.
An incomplete list of system constant model components is below:
-
ON_ModelComponent::Unset
-
ON_InstanceDefinition::Empty
-
ON_Linetype::Unset
-
ON_Linetype::Continuous
-
ON_Linetype::ByLayer
-
ON_Linetype::ByParent
-
ON_Layer::Unset
-
ON_Layer::Default
-
ON_TextStyle::Unset
-
ON_TextStyle::Default
-
ON_TextStyle::ByLayer
-
ON_TextStyle::ByParent
-
ON_DimStyle::Unset
-
ON_DimStyle::Default
-
ON_DimStyle::DefaultInchDecimal
-
ON_DimStyle::DefaultInchFractional
-
ON_DimStyle::DefaultFootInchArchitecture
-
ON_DimStyle::DefaultMillimeterSmall
-
ON_DimStyle::DefaultMillimeterLarge
-
ON_DimStyle::DefaultMillimeterArchitecture
(Inherited from ModelComponent.)
Public Property
IsValid
Tests an object to see if it is valid.
(Inherited from CommonObject.)
Public Property
IsVisible
Gets or sets the global visibility of this layer.
Public Property
IsVisibleInUserInterface
Return true if the layer is visible in user interfaces that display layers. Returns false if the layer not visible in user interfaces. This is a runtime property that does not persist in .3dm files. This property is also used by the Layers panel to filter layers.
Public Property
LinetypeIndex
Gets or sets the line-type index for this layer.
Public Property
ModelIsVisible
Gets or sets the model visiblity of this layer.
Public Property
ModelPersistentVisibility
Gets or sets the model persistent visibility of this layer. The persistent viability setting is used for layers whose visibility can be changed by a parent layer. In this case, when a parent layer is turned off, then child layers are also turned off. The persistent visibility setting determines what happens when the parent is turned on again.
Public Property
ModelSerialNumber
A value identifying the model that manages this component.
(Inherited from ModelComponent.)
Public Property
Code Example
Name
Gets or sets the name of this layer.
(Overrides
ModelComponent.Name
.)Public Property
NameIsLocked
Returns a value indicating whether the component Name is already locked.
(Inherited from ModelComponent.)
Public Property
Code Example
ParentLayerId
Gets the ID of the parent layer. Layers can be organized in a hierarchical structure, in which case this returns the parent layer ID. If the layer has no parent, Guid.Empty will be returned.
Public Property
PersistentVisibility
Gets or sets the global persistent visibility setting for this layer.
Public Property
PerViewportIsVisibleInNewDetails
Gets and sets the initial per viewport visibility of this layer in newly created detail views.
Public Property
PlotColor
Gets or sets the plot color for this layer.
Public Property
PlotWeight
Gets or sets the weight of the plotting pen in millimeters. A weight of 0.0 indicates the “default” pen weight should be used. A weight of -1.0 indicates the layer should not be printed.
Public Property
ReferenceModelSerialNumber
When a component is in a model for reference, this value identifies the reference model.
(Inherited from ModelComponent.)
Public Property
RenderMaterial
Gets or sets the RenderMaterial for objects on this layer that have MaterialSource() == MaterialFromLayer. A null result indicates that no RenderMaterial has been assigned and the material created by the default Material constructor or the
RenderMaterialIndex
should be used.Public Property
RenderMaterialIndex
Gets or sets the index of render material for objects on this layer that have MaterialSource() == MaterialFromLayer. A material index of -1 indicates no material has been assigned and the material created by the default Material constructor should be used.
Public Property
SortIndex
Runtime index used to sort layers in layer dialog.
Public Property
UserData
List of custom information that is attached to this class.
(Inherited from CommonObject.)
Public Property
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.
(Inherited from CommonObject.)
Public Property
UserStringCount
Gets the amount of user strings.
Methods
Name
Description
Public Method
ClearId
Resets the HasId property of the model component to false, if possible.
(Inherited from ModelComponent.)
Public Method
ClearIndex
Resets the HasIndex property of the model component to false, if possible.
(Inherited from ModelComponent.)
Public Method
ClearName
Resets the HasName property of the model component to false, if possible.
(Inherited from ModelComponent.)
Public Method
CopyAttributesFrom
Copy typical attributes from another layer
Public Method
DataCRC
Increments the Cyclic Redundancy Check value by this instance.
(Inherited from ModelComponent.)
Public Method
Default
Sets layer to default settings.
Public Method
DeleteAllUserStrings
Public Method
DeleteModelVisible
Remove any model visibility setting so the layer’s global setting will be used for all viewports.
Public Method
DeletePerViewportColor
Remove any per viewport layer color setting so the layer’s overall setting will be used for all viewports.
Public Method
DeletePerViewportPlotColor
Remove any per viewport layer plot color setting so the layer’s overall setting will be used for all viewports.
Public Method
DeletePerViewportPlotWeight
Remove any per viewport layer plot weight setting so the layer’s overall setting will be used for all viewports.
Public Method
DeletePerViewportSettings
Deletes per viewport layer settings.
Public Method
DeletePerViewportVisible
Remove any per viewport visibility setting so the layer’s overall setting will be used for all viewports.
Public Method
DeleteUserString
Public Method
Dispose.
Actively reclaims unmanaged resources that this instance uses.
(Inherited from CommonObject.)
Public Method
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 from CommonObject.)
Public Method
Equals(Layer)
Public Method
Equals(Object)
(Overrides Object.Equals(Object).)
Public Method
GetChildren.
Gets immediate children of this layer. Note that child layers may have their own children.
Public Method
GetChildren(Boolean)
Gets the children of this layer.
Public Method
GetCustomSectionStyle
Get an optional custom section style associated with these attributes.
Public Method
Static Member
GetDefaultLayerProperties
Constructs a layer with the current default properties. The default layer properties are:
color = Rhino.ApplicationSettings.AppearanceSettings.DefaultLayerColor
line style = Rhino.ApplicationSettings.AppearanceSettings.DefaultLayerLineStyle
material index = -1
IGES level = -1
mode = NormalLayer
name = empty
layer index = 0 (ignored by AddLayer)
Public Method
GetHashCode
(Overrides Object.GetHashCode..)
Public Method
Static Member
GetLeafName(Layer)
Get a layer name’s “leaf” level name
Public Method
Static Member
GetLeafName(String)
Get a layer name’s “leaf” level name
Public Method
GetObjectData
Populates a System.Runtime.Serialization.SerializationInfo with the data needed to serialize the target object.
(Inherited from CommonObject.)
Public Method
Static Member
GetParentName(Layer)
Get a layer’s “parent” path name
Public Method
Static Member
GetParentName(String)
Get a layer’s “parent” path name
Public Method
GetPersistentLocking
The persistent locking setting is used for layers that can be locked by a “parent” object. A common case is when a layer is a child layer (Layer.ParentI is not nil). In this case, when a parent layer is locked, then child layers are also locked. The persistent locking setting determines what happens when the parent is unlocked again.
Public Method
GetPersistentVisibility
The global persistent visibility setting is used for layers whose visibility can be changed by a “parent” object. A common case is when a layer is a child layer (ParentId is not nil). In this case, when a parent layer is turned off, then child layers are also turned off. The persistent visibility setting determines what happens when the parent is turned on again.
Public Method
GetType
Gets the Type of the current instance.
(Inherited from Object.)
Public Method
GetUserString
Gets user string from this geometry.
Public Method
GetUserStrings
Gets a copy of all (user key string, user value string) pairs attached to this geometry.
Public Method
HasPerViewportSettings
Verifies that a layer has per viewport settings.
Public Method
HasSelectedObjects
Returns true if the layer has one or more selected Rhino objects.
Public Method
IsChildOf(Guid)
Public Method
IsChildOf(Int32)
Public Method
IsChildOf(Layer)
Public Method
IsParentOf(Guid)
Public Method
IsParentOf(Int32)
Public Method
IsParentOf(Layer)
Public Method
IsValidWithLog
Determines if an object is valid. Also provides a report on errors if this object happens not to be valid.
(Inherited from CommonObject.)
Public Method
LockId
Locks the component Id property.
(Inherited from ModelComponent.)
Public Method
LockIndex
Locks the component Index property.
(Inherited from ModelComponent.)
Public Method
LockName
Locks the component Name property.
(Inherited from ModelComponent.)
Public Method
ParentLayer
Returns parent of a layer.
Public Method
PerViewportColor
Gets the display color for this layer.
Public Method
PerViewportIsVisible
Gets the per viewport visibility of this layer.
Public Method
PerViewportPersistentVisibility
Gets the per layer persistent visibility. The persistent viability setting is used for layers whose visibility can be changed by a parent layer. In this case, when a parent layer is turned off, then child layers are also turned off. The persistent visibility setting determines what happens when the parent is turned on again.
Public Method
PerViewportPlotColor
Gets the plot color for this layer.
Public Method
PerViewportPlotWeight
Gets the plot weight, in millimeters, for this layer.
Public Method
RemoveCustomSectionStyle
Public Method
SetCustomSectionStyle
Public Method
SetPersistentLocking
Set the persistent locking setting for this layer
Public Method
SetPersistentVisibility
Set the global persistent visibility setting for this layer.
Public Method
SetPerViewportColor
Sets the display color for this layer.
Public Method
SetPerViewportPersistentVisibility
Sets the per layer persistent visibility. The persistent viability setting is used for layers whose visibility can be changed by a parent layer. In this case, when a parent layer is turned off, then child layers are also turned off. The persistent visibility setting determines what happens when the parent is turned on again.
Public Method
SetPerViewportPlotColor
Sets the plot color for this layer.
Public Method
SetPerViewportPlotWeight
Sets the plot weight, in millimeters, for this layer.
Public Method
SetPerViewportVisible
Controls layer visibility in specific viewports.
Public Method
SetUserString
Attach a user string (key,value combination) to this geometry.
Public Method
ToJSON
Create a JSON string representation of this object
(Inherited from CommonObject.)
Public Method
ToString
(Overrides ModelComponent.ToString..)
Public Method
UnsetModelPersistentVisibility
Remove any model persistent visibility setting from this layer.
Public Method
UnsetPersistentLocking
Remove any explicitly persistent locking settings from this layer
Public Method
UnsetPersistentVisibility
Remove any explicit persistent visibility setting from this layer
Public Method
UnsetPerViewportPersistentVisibility
Remove any per viewport persistent visibility setting so the layer’s overall setting will be used for all viewports.
Operators
Name
Description
Public Operator
Static Member
Equality
Public Operator
Static Member
Inequality