SetLayer Method


Sets a single layer for this CompoundStructure.

Namespace: Autodesk.Revit.DB
Assembly: RevitAPI (in RevitAPI.dll) Version: 24.0.0.0 (24.0.0.0)

Syntax

C#
public void SetLayer(
	int layerIdx,
	CompoundStructureLayer layer
)
Visual Basic
Public Sub SetLayer ( _
	layerIdx As Integer, _
	layer As CompoundStructureLayer _
)
Visual C++
public:
void SetLayer(
	int layerIdx, 
	CompoundStructureLayer^ layer
)

Parameters

layerIdx
Type: SystemInt32
The index of a layer. This should range from 0 to the number of layers - 1.
layer
Type: Autodesk.Revit.DBCompoundStructureLayer
The layer to be set.

Remarks

This function does not support addition of new layers, use SetLayers() to change the number of layers.

Exceptions

ExceptionCondition
Autodesk.Revit.ExceptionsArgumentException The layer is not valid for this operation.
Autodesk.Revit.ExceptionsArgumentNullException A non-optional argument was null
Autodesk.Revit.ExceptionsArgumentOutOfRangeException The layer index is out of range.
Autodesk.Revit.ExceptionsInvalidOperationException This operation is valid only for non-vertically compound structures.

See Also

ArchiLabs Desktop

Put AI to work inside Revit.

Give Desktop your instructions and project files to build Revit families, update model elements, and create views and schedules. Works directly in Revit and AutoCAD.

Explore Desktop →