Constructors

Layer

#Since v5.0
public Layer()

Properties

Color

#Since v5.0
Gets or sets the display color for this layer.
public Color Color { get; set; }

ComponentStatus

#Since v6.0
Gets or sets the status of the layer.
public override ComponentStatus ComponentStatus { get; set; }

ComponentType

#Since v6.0
public override ModelComponentType ComponentType { get; }

DeletedName

Gets the name of a component that is deleted.
public string DeletedName { get; }
inherited fromModelComponent

Description

#Since v9.0
Gets and sets a short description of the layer.
public string Description { 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

FullPath

#ExampleSince v5.0
Gets the full path to this layer. The full path includes nesting information.
public string FullPath { get; }

HasId

Returns a value indicating whether the component has an ID.
public bool HasId { get; }
inherited fromModelComponent

HasIndex

Returns a value indicating whether the component has an Index.
public bool HasIndex { get; }
inherited fromModelComponent

HasName

Returns a value indicating whether the component has a Name.
public bool HasName { get; }
inherited fromModelComponent

HasUserData

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

Id

#Since v5.0
Gets or sets the ID of this layer object. You typically do not need to assign a custom ID.
public override Guid Id { get; set; }

IdIsLocked

Returns a value indicating whether the component ID is already locked.
public bool IdIsLocked { get; }
inherited fromModelComponent

IgesLevel

#Since v5.0
Gets or sets the IGES level for this layer.
public int IgesLevel { get; set; }

Index

Gets or sets the model component index attribute.
public virtual int Index { get; set; }
inherited fromModelComponent
InvalidOperationExceptionWhen setting the Index failed. This usually happens because the instance Index is already locked.

IndexIsLocked

Returns a value indicating whether the component Index is already locked.
public bool IndexIsLocked { get; }
inherited fromModelComponent

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.
[CLSCompliant(false)] public virtual uint InstanceDefinitionModelSerialNumber { get; }
inherited fromModelComponent
Remarks: Reference components are not saved in .3dm archives. Typically this value is set and locked by the code that adds a component to a model. This value is not saved in .3dm archives.

IsComponentStatusLocked

The component status itself can be locked. This returns an indication.
public bool IsComponentStatusLocked { get; }
inherited fromModelComponent

IsCurrent

#Since v8.0
Returns true if the layer is the current layer.
public bool IsCurrent { get; }

IsDeleted

#Since v5.0
Gets a value indicating whether this layer has been deleted and is currently in the Undo buffer.
public override bool IsDeleted { 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 virtual bool IsDocumentControlled { get; }
inherited fromCommonObject

IsExpanded

#Since v5.0
Gets or sets a value indicating whether this layer is expanded in the Rhino Layer dialog.
public bool IsExpanded { get; set; }

IsLocked

#ExampleSince v5.0
Gets or sets a value indicating the locked state of this layer.
public bool IsLocked { get; set; }

IsReference

#Since v5.0
Gets a value indicting whether this layer is a referenced layer. Referenced layers are part of referenced documents.
public override bool IsReference { get; }

IsReferenceParentLayer

#Since v8.0
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 bool IsReferenceParentLayer { get; }

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
public bool IsSystemComponent { get; }
inherited fromModelComponent

IsValid

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

IsVisible

#Since v5.0
Gets or sets the global visibility of this layer.
public bool IsVisible { get; set; }

IsVisibleInUserInterface

#Since v8.9
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 bool IsVisibleInUserInterface { get; set; }

LayerIndex

#Since v5.0
Gets or sets the index of this layer.
[EditorBrowsable(EditorBrowsableState.Never)] public int LayerIndex { get; set; }
obsoleteUse the Index property.

LinetypeIndex

#Since v5.0
Gets or sets the line-type index for this layer.
public int LinetypeIndex { get; set; }

ModelIsVisible

#Since v8.0
Gets or sets the model visiblity of this layer.
public bool ModelIsVisible { get; set; }

ModelPersistentVisibility

#Since v8.0
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 bool ModelPersistentVisibility { get; set; }

ModelSerialNumber

A value identifying the model that manages this component.
[CLSCompliant(false)] public virtual uint ModelSerialNumber { get; }
inherited fromModelComponent
Remarks: If the component is being managed by a model, this value identifies the model. In Rhino, this value is the document runtime serial number. Typically this value is set and locked by the code that adds a component to a model. This value is not saved in .3dm archives.

Name

#ExampleSince v5.0
Gets or sets the name of this layer.
public override string Name { get; set; }

NameIsLocked

Returns a value indicating whether the component Name is already locked.
public bool NameIsLocked { get; }
inherited fromModelComponent

ParentLayerId

#ExampleSince v5.0
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 Guid ParentLayerId { get; set; }

PathSeparator

#Since v6.0
The string "::" (colon,colon) is used to separate parent and child layer names.
[EditorBrowsable(EditorBrowsableState.Never)] public static string PathSeparator { get; }
obsoleteUse ModelComponent.NamePathSeparator

PersistentVisibility

#Since v8.0
Gets or sets the global persistent visibility setting for this layer.
public bool PersistentVisibility { get; set; }

PerViewportIsVisibleInNewDetails

#Since v8.0
Gets and sets the initial per viewport visibility of this layer in newly created detail views.
public bool PerViewportIsVisibleInNewDetails { get; set; }

PlotColor

#Since v5.0
Gets or sets the plot color for this layer.
public Color PlotColor { get; set; }

PlotWeight

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

ReferenceModelSerialNumber

When a component is in a model for reference, this value identifies the reference model.
[CLSCompliant(false)] public virtual uint ReferenceModelSerialNumber { get; }
inherited fromModelComponent
Remarks: Reference components are not saved in .3dm archives. Typically this value is set and locked by the code that adds a component to a model. This value is not saved in .3dm archives.

RenderMaterial

#Since v5.7
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 RenderMaterial RenderMaterial { get; set; }

RenderMaterialIndex

#Since v5.0
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 int RenderMaterialIndex { get; set; }

SectionStyleIndex

#Since v9.0
Gets or sets the section style index for this layer.
public int SectionStyleIndex { get; set; }

SortIndex

#Since v5.0
Runtime index used to sort layers in layer dialog.
public int SortIndex { get; }

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

#Since v5.0
Gets the amount of user strings.
public int UserStringCount { get; }

Methods

ClearId

Resets the HasId property of the model component to false, if possible.
public void ClearId()
inherited fromModelComponent
InvalidOperationExceptionIf the ID is locked.

ClearIndex

Resets the HasIndex property of the model component to false, if possible.
public void ClearIndex()
inherited fromModelComponent
InvalidOperationExceptionIf the index is locked.

ClearName

Resets the HasName property of the model component to false, if possible.
public void ClearName()
inherited fromModelComponent
InvalidOperationExceptionIf the name is locked.

CommitChanges

#ExampleSince v5.0 Obsolete v6.0
[EditorBrowsable(EditorBrowsableState.Never)] public bool CommitChanges()
obsoleteNo longer needed. Layer changes in the document are now immediate

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

CopyAttributesFrom

#Since v6.0
Copy typical attributes from another layer
public void CopyAttributesFrom(
otherLayer
)

DataCRC

Increments the Cyclic Redundancy Check value by this instance.
[CLSCompliant(false)] public uint DataCRC(
currentRemainder
The current remainder value.
)
inherited fromModelComponent
The updated remainder value.

Default

#Since v5.0
Sets layer to default settings.
public void Default()

DeleteAllUserStrings

#Since v8.9
public void DeleteAllUserStrings()

DeleteModelVisible

#Since v8.0
Remove any model visibility setting so the layer's global setting will be used for all viewports.
public void DeleteModelVisible()

DeletePerViewportColor

#Since v6.0
Remove any per viewport layer color setting so the layer's overall setting will be used for all viewports.
public void DeletePerViewportColor(
viewportId
If not Guid.Empty, then the setting for this viewport will be deleted. If Guid.Empty, the all per viewport layer color settings will be removed.
)

DeletePerViewportPlotColor

#Since v6.0
Remove any per viewport layer plot color setting so the layer's overall setting will be used for all viewports.
public void DeletePerViewportPlotColor(
viewportId
If not Guid.Empty, then the setting for this viewport will be deleted. If Guid.Empty, the all per viewport layer color settings will be removed.
)

DeletePerViewportPlotWeight

#Since v6.0
Remove any per viewport layer plot weight setting so the layer's overall setting will be used for all viewports.
public void DeletePerViewportPlotWeight(
viewportId
If not Guid.Empty, then the setting for this viewport will be deleted. If Guid.Empty, the all per viewport layer color settings will be removed.
)

DeletePerViewportSettings

#Since v6.0
Deletes per viewport layer settings.
public void DeletePerViewportSettings(
viewportId
If not Guid.Empty, then the settings for that viewport are deleted. If Guid.Empty, then all per viewport settings are deleted.
)

DeletePerViewportVisible

#Since v6.0
Remove any per viewport visibility setting so the layer's overall setting will be used for all viewports.
public void DeletePerViewportVisible(
viewportId
If not Guid.Empty, then the setting for this viewport will be deleted. If Guid.Empty, the all per viewport visibility settings will be removed.
)

DeletePlotColor

#Since v8.26
Removes the plot color for layer. The layer's color will be used for the plot color.
public void DeletePlotColor()

DeleteUserString

#Since v8.9
public bool DeleteUserString(
key
)

Dispose

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

Dispose

For derived class implementers.

This method is called with argument true when class user calls Dispose(), while with argument false when the Garbage Collector invokes the finalizer, or Finalize() method.

You must reclaim all used unmanaged resources in both cases, and can use this chance to call Dispose on disposable fields if the argument is true.

Also, you must call the base virtual method within your overriding method.

protected virtual void Dispose(
disposing
true if the call comes from the Dispose() method; false if it comes from the Garbage Collector finalizer.
)
inherited fromCommonObject

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

Equals

#Since v6.0
public bool Equals(
other
)

Equals

#
public override bool Equals(
obj
)
Object.Equals

GetChildren

#Since v5.0
Gets immediate children of this layer. Note that child layers may have their own children.
public Layer[] GetChildren()
Array of child layers, sorted by layer index, or null if this layer does not have any children.

GetChildren

#Since v8.0
Gets the children of this layer.
public Layer[] GetChildren(
allChildren
If false, the immediate children are returned. If true, immediate children, their children, and so on, are returned.
)
Array of child layers, sorted by layer index, or null if this layer does not have any children.

GetCustomSectionStyle

#Since v8.0
Get an optional custom section style associated with these attributes.
public SectionStyle GetCustomSectionStyle()

GetDefaultLayerProperties

#Since v5.0
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 static Layer GetDefaultLayerProperties()
A new layer instance.

GetHashCode

#
public override int GetHashCode()

GetLeafName

#Since v6.0
Get a layer name's "leaf" level name
public static string GetLeafName(
layer
)
leaf name or String.Empty if fullPath does not contain a leaf

GetLeafName

#Since v6.0
Get a layer name's "leaf" level name
public static string GetLeafName(
fullPath
)
leaf name or String.Empty if fullPath does not contain a leaf

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

GetParentName

#Since v6.0
Get a layer's "parent" path name
public static string GetParentName(
layer
)
parent name or String.Empty

GetParentName

#Since v6.0
Get a layer's "parent" path name
public static string GetParentName(
fullPath
)
parent name or String.Empty

GetPersistentLocking

#Since v5.5
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 bool GetPersistentLocking()

GetPersistentVisibility

#Since v5.5
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 bool GetPersistentVisibility()
Remarks: Returns true if this layer's visibility is controlled by a parent object and the parent is turned on (after being off), then this layer will also be turned on. Returns false if this layer's visibility is controlled by a parent object and the parent layer is turned on (after being off), then this layer will continue to be off. When the persistent viability is not explicitly set, this property returns the current value of IsVisible

GetUserString

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

GetUserStrings

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

HasPerViewportSettings

#Since v6.0
Verifies that a layer has per viewport settings.
public bool HasPerViewportSettings(
viewportId
If not Guid.Empty, then checks for settings for that specific viewport. If Guid.Empty, then checks for any viewport settings.
)
True if the layer has per viewport settings, false otherwise.

HasSelectedObjects

#Since v8.0
Returns true if the layer has one or more selected Rhino objects.
public bool HasSelectedObjects(
checkSubObjects
If true, the search will include objects that have some subset of the object selected, like some edges of a Brep. If false, objects where the entire object is not selected are ignored.
)
true if the layer has selected Rhino objects, false otherwise.

IsChildOf

#Since v6.0
public bool IsChildOf(
otherlayerId
)

IsChildOf

#Since v5.0
public bool IsChildOf(
layerIndex
)

IsChildOf

#Since v5.0
public bool IsChildOf(
otherLayer
)

IsParentOf

#Since v6.0
public bool IsParentOf(
otherLayer
)

IsParentOf

#Since v5.0
public bool IsParentOf(
layerIndex
)

IsParentOf

#Since v5.0
public bool IsParentOf(
otherLayer
)

IsValidName

#ExampleSince v5.0 Obsolete v8.0
Determines if a given string is valid for a layer name.
[EditorBrowsable(EditorBrowsableState.Never)] public static bool IsValidName(
name
A name to be validated.
)
obsoleteUse ModelComponent.IsValidComponentName
true if the name is valid for a layer name; otherwise, false.

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.

LockId

Locks the component Id property.
public void LockId()
inherited fromModelComponent

LockIndex

Locks the component Index property.
public void LockIndex()
inherited fromModelComponent

LockName

Locks the component Name property.
public void LockName()
inherited fromModelComponent

NonConstOperation

For derived classes implementers.

Defines the necessary implementation to free the instance from being constant.

protected virtual void NonConstOperation()
inherited fromCommonObject

OnSwitchToNonConst

Is called when a non-constant operation first occurs.
protected virtual void OnSwitchToNonConst()
inherited fromCommonObject

ParentLayer

#Since v8.0
Returns parent of a layer.
public Layer ParentLayer(
rootLevelParent
If true, the root level parent is returned. The root level parent never has a parent. If false, the immediate parent is returned. The immediate parent may have a parent.
)
The parent layer, or null if the layer does not have a parent.

PerViewportColor

#Since v6.0
Gets the display color for this layer.
public Color PerViewportColor(
viewportId
If not Guid.Empty, then the setting applies only to the viewport with the specified id.
)
The display color.

PerViewportIsVisible

#Since v6.0
Gets the per viewport visibility of this layer.
public bool PerViewportIsVisible(
viewportId
If not Guid.Empty, then the visibility setting for that viewport is returned. If Guid.Empty, the IsVisible property is returned.
)
Returns true if objects on layer are visible.

PerViewportPersistentVisibility

#Since v6.0
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 bool PerViewportPersistentVisibility(
viewportId
)
Return true if this layer's visibility in the specified viewport is controlled by a parent object and the parent is turned on (after being off), then this layer will also be turned on in the specified viewport. Returns false if this layer's visibility in the specified viewport is controlled by a parent object and the parent layer is turned on(after being off), then this layer will continue to be off in the specified viewport.

PerViewportPlotColor

#Since v6.0
Gets the plot color for this layer.
public Color PerViewportPlotColor(
viewportId
If not Guid.Empty, then the setting applies only to the viewport with the specified id.
)
The plot color.

PerViewportPlotWeight

#Since v6.0
Gets the plot weight, in millimeters, for this layer.
public double PerViewportPlotWeight(
viewportId
If not Guid.Empty, then the setting applies only to the viewport with the specified id.
)
The plot color.

RemoveCustomSectionStyle

#Since v8.0
public void RemoveCustomSectionStyle()

SetCustomSectionStyle

#Since v8.0
public void SetCustomSectionStyle(
sectionStyle
)

SetPersistentLocking

#Since v5.5
Set the persistent locking setting for this layer
public void SetPersistentLocking(
persistentLocking
)

SetPersistentVisibility

#Since v5.5
Set the global persistent visibility setting for this layer.
public void SetPersistentVisibility(
persistentVisibility
)

SetPerViewportColor

#Since v6.0
Sets the display color for this layer.
public void SetPerViewportColor(
viewportId,
If not Guid.Empty, then the setting applies only to the viewport with the specified id.
color
The display color.
)

SetPerViewportPersistentVisibility

#Since v6.0
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 void SetPerViewportPersistentVisibility(
viewportId,
If not Guid.Empty, then the setting applies only to the viewport with the specified id. If Guid.Empty, then the setting applies to all viewports with per viewport layer settings.
persistentVisibility
If true, this layer's visibility in the specified viewport is controlled by a parent object and the parent is turned on (after being off), then this layer will also be turned on in the specified viewport. If false, this layer's visibility in the specified viewport is controlled by a parent object and the parent layer is turned on (after being off), then this layer will continue to be off in the specified viewport.
)

SetPerViewportPlotColor

#Since v6.0
Sets the plot color for this layer.
public void SetPerViewportPlotColor(
viewportId,
If not Guid.Empty, then the setting applies only to the viewport with the specified id.
color
The plot color.
)

SetPerViewportPlotWeight

#Since v6.0
Sets the plot weight, in millimeters, for this layer.
public void SetPerViewportPlotWeight(
viewportId,
If not Guid.Empty, then the setting applies only to the viewport with the specified id.
plotWeight
The plot weight 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.
)

SetPerViewportVisible

#Since v6.0
Controls layer visibility in specific viewports.
public void SetPerViewportVisible(
viewportId,
If not Guid.Empty, then the setting applies only to the viewport with the specified id. If Guid.Empty, then the setting applies to all viewports with per viewport layer settings.
visible
true to make layer visible, false to make layer invisible.
)

SetUserString

#Since v5.0
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.
)
true on success.

ToJSON

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

ToString

#
public override string ToString()

UnsetModelPersistentVisibility

#Since v8.0
Remove any model persistent visibility setting from this layer.
public void UnsetModelPersistentVisibility()

UnsetPersistentLocking

#Since v5.5
Remove any explicitly persistent locking settings from this layer
public void UnsetPersistentLocking()

UnsetPersistentVisibility

#Since v5.5
Remove any explicit persistent visibility setting from this layer
public void UnsetPersistentVisibility()

UnsetPerViewportPersistentVisibility

#Since v6.0
Remove any per viewport persistent visibility setting so the layer's overall setting will be used for all viewports.
public void UnsetPerViewportPersistentVisibility(
viewportId
If not Guid.Empty, then the setting for this viewport will be deleted. If Guid.Empty, the all per viewport visibility settings will be removed.
)

Operators

OperationResultDescription
Layer==Layerbool
Layer!=Layerbool