LayerTable
Inheritance Hierarchy
System.Object
Rhino.FileIO.CommonComponentTable. Layer.
Rhino.DocObjects.Tables.RhinoDocCommonTable. Layer.
Rhino.DocObjects.Tables.LayerTable
Namespace: Rhino.DocObjects.Tables
Assembly: RhinoCommon (in RhinoCommon.dll)
Syntax
public sealed class LayerTable : RhinoDocCommonTable<Layer>, ICollection<Layer>, IEnumerable<Layer>, IEnumerable
The LayerTable type exposes the following members.
Properties
Name
Description
Public Property
ActiveCount
Returns number of layers in the layer table, excluding deleted layers.
Public Property
ComponentType
(Overrides
CommonComponentTable.T..ComponentType
.)Public Property
Count
Returns number of layers in the layer table, including deleted layers.
(Overrides
CommonComponentTable.T..Count
.)Public Property
Code Example
CurrentLayer
At all times, there is a “current” layer. Unless otherwise specified, new objects are assigned to the current layer. The current layer is never locked, hidden, or deleted. Returns reference to the current layer. Note that this reference may become invalid after a call to AddLayer().
Public Property
Code Example
CurrentLayerIndex
At all times, there is a “current” layer. Unless otherwise specified, new objects are assigned to the current layer. The current layer is never locked, hidden, or deleted. Returns: Zero based layer table index of the current layer.
Public Property
Document
Document that owns this table.
Public Property
Item
Conceptually, the layer table is an array of layers. The operator[] can be used to get individual layers. A layer is either active or deleted and this state is reported by Layer.IsDeleted.
Methods
Name
Description
Public Method
Add.
Adds a new layer with default definition to the layer table.
Public Method
Code Example
Add(Layer)
Adds a new layer with specified definition to the layer table.
Public Method
Code Example
Add(String, Color)
Adds a new layer with specified definition to the layer table.
Public Method
AddPath(String)
Adds all of the layer in the specified layer path, beginning with the root. Layer paths contain one or more valid layers names, with each name separated by
NamePathSeparator
. For example, “Grandfather::Father::Son”.Public Method
AddPath(String, Color)
Adds all of the layer in the specified layer path, beginning with the root. Layer paths contain one or more valid layers names, with each name separated by
NamePathSeparator
. For example, “Grandfather::Father::Son”.Public Method
AddReferenceLayer.
Adds a new reference layer with default definition to the layer table. Reference layers are not saved in files.
Public Method
AddReferenceLayer(Layer)
Adds a new reference layer with specified definition to the layer table Reference layers are not saved in files.
Public Method
Clear
Marks all items as deleted.
(Inherited from CommonComponentTable.T..)
Public Method
CreateLayer
Basic tool used by the add layer methods.
Public Method
Delete(Layer)
Deletes layer.
(Overrides
CommonComponentTable.T..Delete(T)
.)Public Method
Delete(Guid, Boolean)
Deletes layer.
Public Method
Delete(IEnumerable.Int32., Boolean)
Deletes layers.
Public Method
Delete(Int32, Boolean)
Deletes layer.
Public Method
Delete(Layer, Boolean)
Deletes layer.
Public Method
Duplicate(IEnumerable.Int32., Boolean, Boolean)
Duplicates, or copies, one or more layers. Duplicated layers are added to the document.
Public Method
Duplicate(Int32, Boolean, Boolean)
Duplicates, or copies, a layer. Duplicated layers are added to the document.
Public Method
Equals
Determines whether the specified object is equal to the current object.
(Inherited from Object.)
Public Method
FindByFullPath
Searches for a layer using the fully qualified name, that includes ancestors.
Deleted layers have no name.
Public Method
FindId
Uses the guid to find a model component. Deleted objects cannot be found by id. The guid is the value that is stored in the .Id property. In a single document, no two active objects have the same guid. If an object is replaced with a new object, then the guid persists. For example, if the _Move command moves an object, then the moved object inherits its guid from the starting object. If the Copy command copies an object, then the copy gets a new guid. This guid persists through file saving/opening operations. This function will not find grip objects.
(Inherited from CommonComponentTable.T..)
Public Method
FindIndex
Retrieves a Layer object based on Index. This search type of search is discouraged. We are moving towards using only IDs for all tables.
Public Method
Code Example
FindName(String)
Finds the layer with a given name. If multiple layers exist that have the same name, the first match layer index will be returned.
Deleted layers have no name.
The default layer is NOT included in the search. If required, use the overload with startIndex input.
Public Method
FindName(String, Int32)
Finds the next layer that has an index equal or higher than the searched value.
Search in case-insensitive.
Public Method
FindNameHash
Finds a Layer given its name hash.
Public Method
ForceLayerVisible(Guid)
Makes a layer and all of its parent layers visible.
Public Method
ForceLayerVisible(Int32)
Makes a layer and all of its parent layers visible.
Public Method
GetEnumerator
(Overrides
CommonComponentTable.T..GetEnumerator.
.)Public Method
GetHashCode
Serves as the default hash function.
(Inherited from Object.)
Public Method
GetSelected
Returns the indices of layers that are selected on the Layer user interface.
Public Method
GetSorted
Gets an array of layer indices that are sorted by the values of
SortIndex
.Public Method
GetType
Gets the Type of the current instance.
(Inherited from Object.)
Public Method
Code Example
GetUnusedLayerName.
Gets the next unused layer name used as default when creating new layers.
Public Method
Code Example
GetUnusedLayerName(Boolean)
Obsolete.
Gets the next unused layer name used as default when creating new layers.
Public Method
Modify(Layer, Guid, Boolean)
Modifies layer settings.
Public Method
Modify(Layer, Int32, Boolean)
Modifies layer settings.
Public Method
Purge(Guid, Boolean)
Deletes a layer and all geometry objects on a layer.
Public Method
Purge(Int32, Boolean)
Deletes a layer and all geometry objects on a layer
Public Method
Select
Selects layers in the Layer user interface.
Public Method
SetCurrentLayerIndex
At all times, there is a “current” layer. Unless otherwise specified, new objects are assigned to the current layer. The current layer is never locked, hidden, or deleted.
Public Method
Sort
Updates the layer sort order
Public Method
SortByLayerName
Sort layers, in the layer table, by their name in either ascending or descending order. This function sorts layers in the same manner as Rhino’s Layers panel.
Public Method
ToString
Returns a string that represents the current object.
(Inherited from Object.)
Public Method
Undelete
Undeletes a layer that has been deleted by DeleteLayer().
Public Method
UndoModify(Guid)
Restores the layer to its previous state, if the layer has been modified and the modification can be undone.
Public Method
UndoModify(Int32)
Restores the layer to its previous state, if the layer has been modified and the modification can be undone.
Public Method
UndoModify(Guid, UInt32)
Restores the layer to its previous state, if the layer has been modified and the modification can be undone.
Public Method
UndoModify(Int32, UInt32)
Restores the layer to its previous state, if the layer has been modified and the modification can be undone.