MergeRegionsAdjacentToSegment Method


Merges the two regions which share the specified segment.

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

Syntax

C#
public int MergeRegionsAdjacentToSegment(
	int segmentId,
	int layerIdxForMergedRegion
)
Visual Basic
Public Function MergeRegionsAdjacentToSegment ( _
	segmentId As Integer, _
	layerIdxForMergedRegion As Integer _
) As Integer
Visual C++
public:
int MergeRegionsAdjacentToSegment(
	int segmentId, 
	int layerIdxForMergedRegion
)

Parameters

segmentId
Type: SystemInt32
The id of a segment in the underlying grid.
layerIdxForMergedRegion
Type: SystemInt32
The index of the layer to which the resulting region will be associated.

Return Value

The id of the resulting region. If -1 is returned, then the operation would have produced an invalid region and was not performed.

Exceptions

ExceptionCondition
Autodesk.Revit.ExceptionsArgumentOutOfRangeException The layer index is out of range.
Autodesk.Revit.ExceptionsInvalidOperationException Split and merge regions operations can be used only for vertically compound structures without variable thickness layers. -or- The segment is not shared by adjacent regions.

See Also

ArchiLabs

Stop fighting Revit automation.

Build repeatable BIM design and documentation workflows with scripts, data, and AI in one place, without wrestling brittle one-off automations.

Try ArchiLabs →