Connector Class

A connector in an Autodesk Revit MEP project document.

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


public class Connector : IConnector, IDisposable
Visual Basic
Public Class Connector _
	Implements IConnector, IDisposable
Visual C++
public ref class Connector : IConnector, 


This connector is an item that is a part of another element (duct, pipe, fitting, or equipment etc.). This connector does not represent the connector element that can be created inside a family; for that element, refer to ConnectorElement .


Copy C#
public void GetElementAtConnector(Autodesk.Revit.DB.Connector connector)
    MEPSystem mepSystem = connector.MEPSystem;
    if (null != mepSystem)
        string message = "Connector is owned by: " + connector.Owner.Name;

        if (connector.IsConnected == true)
            ConnectorSet connectorSet = connector.AllRefs;
            ConnectorSetIterator csi = connectorSet.ForwardIterator();
            while (csi.MoveNext())
                Connector connected = csi.Current as Connector;
                if (null != connected)
                    // look for physical connections
                    if (connected.ConnectorType == ConnectorType.End ||
                        connected.ConnectorType == ConnectorType.Curve ||
                        connected.ConnectorType == ConnectorType.Physical)
                        message += "\nConnector is connected to: " + connected.Owner.Name;
                        message += "\nConnection type is: " + connected.ConnectorType;
            message += "\nConnector is not connected to anything.";

        TaskDialog.Show("Revit", message);            
Public Sub GetElementAtConnector(connector As Autodesk.Revit.DB.Connector)
    Dim mepSystem As MEPSystem = connector.MEPSystem
    If mepSystem IsNot Nothing Then
        Dim message As String = "Connector is owned by: " + connector.Owner.Name

        If connector.IsConnected = True Then
            Dim connectorSet As ConnectorSet = connector.AllRefs
            Dim csi As ConnectorSetIterator = connectorSet.ForwardIterator()
            While csi.MoveNext()
                Dim connected As Connector = TryCast(csi.Current, Connector)
                If connected IsNot Nothing Then
                    ' look for physical connections
                    If connected.ConnectorType = ConnectorType.[End] OrElse connected.ConnectorType = ConnectorType.Curve OrElse connected.ConnectorType = ConnectorType.Physical Then
                        message += vbLf & "Connector is connected to: " + connected.Owner.Name
                        message += vbLf & "Connection type is: " + connected.ConnectorType
                    End If
                End If
            End While
            message += vbLf & "Connector is not connected to anything."
        End If

        TaskDialog.Show("Revit", message)
    End If
End Sub

Inheritance Hierarchy

System Object
Autodesk.Revit.DB Connector

See Also