Get Connectors from MEPModel objects

Get Connectors from MEPModel objects

Get Connectors from MEPModel objects

The following function retrieves connectors from FamilyInstance objects containing connectors. For example, sprinkler, AHU, wash basin, water closet, etc.

//Input MEP Element object 
//Function returns list of connectors from MEP element
public List<ConnectorGetConnectors(Element element)
{
    //1. Cast Element to FamilyInstance
    FamilyInstance inst = element as FamilyInstance;
    //2. Get MEPModel Property
    MEPModel mepModel = inst.MEPModel;
    //3. Get connector set of MEPModel
    ConnectorSet connectorSet = mepModel.ConnectorManager.Connectors;
    //4. Initialise empty list of connectors
    List<Connector> connectorList = new List<Connector>();
    //5. Loop through connector set and add to list
    foreach (Connector connector in connectorSet)
    {
        connectorList.Add(connector);
    }
    return connectorList;
}

Retrieve connectors from instance MEPCurve objects for Pipes, Ducts or Cable Trays can be found here! The source code for the full implementation above can be foundĀ HERE! Happy coding!

Leave a Reply

Close Menu