Connector |
Create a new pipe ConnectorElement.
Namespace: Autodesk.Revit.DB
Assembly: RevitAPI (in RevitAPI.dll) Version: 25.0.0.0 (25.0.0.0)

public static ConnectorElement CreatePipeConnector(
Document document,
PipeSystemType pipeSystemType,
Reference planarFace
)
Parameters
- document Document
- The document to add the connector to.
- pipeSystemType PipeSystemType
- The PipeSystemType of the connector.
- planarFace Reference
- The planar face to place the connector on.
Return Value
ConnectorElementThe pipe ConnectorElement.

Exception | Condition |
---|---|
ArgumentException | The reference is not a planar face. -or- document is not a family document. |
ArgumentNullException | A non-optional argument was null |
ArgumentOutOfRangeException | A value passed for an enumeration argument is not a member of that enumeration |
InvalidOperationException | Connector creation is not allowed in this family. |

Regenerates the document.

public void CreatePipeConnectors(UIDocument uiDocument, Extrusion extrusion)
{
// get the faces of the extrusion
Options geoOptions = uiDocument.Document.Application.Create.NewGeometryOptions();
geoOptions.View = uiDocument.Document.ActiveView;
geoOptions.ComputeReferences = true;
List<PlanarFace> planarFaces = new List<PlanarFace>();
Autodesk.Revit.DB.GeometryElement geoElement = extrusion.get_Geometry(geoOptions);
foreach (GeometryObject geoObject in geoElement)
{
Solid geoSolid = geoObject as Solid;
if (null != geoSolid)
{
foreach (Face geoFace in geoSolid.Faces)
{
if (geoFace is PlanarFace)
{
planarFaces.Add(geoFace as PlanarFace);
}
}
}
}
if (planarFaces.Count > 1)
{
// Create the Supply Hydronic pipe connector
//PipeConnector connSupply =
// uiDocument.Document.FamilyCreate.NewPipeConnector(planarFaces[0].Reference,
// PipeSystemType.SupplyHydronic);
ConnectorElement connSupply =
ConnectorElement.CreatePipeConnector(uiDocument.Document, PipeSystemType.SupplyHydronic, planarFaces[0].Reference);
Parameter param = connSupply.get_Parameter(BuiltInParameter.CONNECTOR_RADIUS);
param.Set(1.0); // 1' radius
param = connSupply.get_Parameter(BuiltInParameter.RBS_PIPE_FLOW_DIRECTION_PARAM);
param.Set(2);
// Create the Return Hydronic pipe connector
//PipeConnector connReturn =
// uiDocument.Document.FamilyCreate.NewPipeConnector(planarFaces[1].Reference,
// PipeSystemType.ReturnHydronic);
ConnectorElement connReturn =
ConnectorElement.CreatePipeConnector(uiDocument.Document, PipeSystemType.ReturnHydronic, planarFaces[1].Reference);
param = connReturn.get_Parameter(BuiltInParameter.CONNECTOR_RADIUS);
param.Set(0.5); // 6" radius
param = connReturn.get_Parameter(BuiltInParameter.RBS_PIPE_FLOW_DIRECTION_PARAM);
param.Set(1);
}
}
