ConnectorElementCreatePipeConnector(Document, PipeSystemType, Reference) Method |
Create a new pipe ConnectorElement.
Namespace: Autodesk.Revit.DBAssembly: RevitAPI (in RevitAPI.dll) Version: 27.0.4.0 (27.0.4.0)
Syntaxpublic static ConnectorElement CreatePipeConnector(
Document document,
PipeSystemType pipeSystemType,
Reference planarFace
)
Public Shared Function CreatePipeConnector (
document As Document,
pipeSystemType As PipeSystemType,
planarFace As Reference
) As ConnectorElement
public:
static ConnectorElement^ CreatePipeConnector(
Document^ document,
PipeSystemType pipeSystemType,
Reference^ planarFace
)
static member CreatePipeConnector :
document : Document *
pipeSystemType : PipeSystemType *
planarFace : Reference -> ConnectorElement 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
ConnectorElement
The pipe ConnectorElement.
Exceptions
Remarks
Regenerates the document.
Examplepublic void CreatePipeConnectors(UIDocument uiDocument, Extrusion 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)
{
ConnectorElement connSupply =
ConnectorElement.CreatePipeConnector(uiDocument.Document, PipeSystemType.SupplyHydronic, planarFaces[0].Reference);
Parameter param = connSupply.get_Parameter(BuiltInParameter.CONNECTOR_RADIUS);
param.Set(1.0);
param = connSupply.get_Parameter(BuiltInParameter.RBS_PIPE_FLOW_DIRECTION_PARAM);
param.Set(2);
ConnectorElement connReturn =
ConnectorElement.CreatePipeConnector(uiDocument.Document, PipeSystemType.ReturnHydronic, planarFaces[1].Reference);
param = connReturn.get_Parameter(BuiltInParameter.CONNECTOR_RADIUS);
param.Set(0.5);
param = connReturn.get_Parameter(BuiltInParameter.RBS_PIPE_FLOW_DIRECTION_PARAM);
param.Set(1);
}
}
See Also