Connects a pair of placeholders that can intersect in an Elbow connection.
Namespace: Autodesk.Revit.DB.MechanicalAssembly: RevitAPI (in RevitAPI.dll) Version: 21.0.0.0 (21.1.1.109)
Since: 2012
Syntax
C# |
---|
public static bool ConnectDuctPlaceholdersAtElbow( Document document, Connector connector1, Connector connector2 ) |
Visual Basic |
---|
Public Shared Function ConnectDuctPlaceholdersAtElbow ( _ document As Document, _ connector1 As Connector, _ connector2 As Connector _ ) As Boolean |
Visual C++ |
---|
public: static bool ConnectDuctPlaceholdersAtElbow( Document^ document, Connector^ connector1, Connector^ connector2 ) |
Parameters
- document
- Type: Autodesk.Revit.DB..::..Document
The document.
- connector1
- Type: Autodesk.Revit.DB..::..Connector
The end connector of the first placeholder.
- connector2
- Type: Autodesk.Revit.DB..::..Connector
The end connector of the second placeholder.
Return Value
True if connection succeeds, false otherwise.
Remarks
The placeholders may have a physical intersection but this is not required.
If they are not intersecting the connectors must be coplanar and able to be moved to
intersect each other.
If connection fails, the placeholders cannot be physically connected.
Examples

//Create a point to be the connection point of two ductPlaceholders XYZ connectionPoint = new XYZ(150, 0, 0); //Create two new ductPlaceholders, duct1 and duct2, each ductPlaceholder has connectionPoint as its parameter Duct duct1 = Duct.CreatePlaceholder(document, systemTypeId, ductTypeId, levelId, new XYZ(100, 0, 0), connectionPoint); Duct duct2 = Duct.CreatePlaceholder(document, systemTypeId, ductTypeId, levelId, connectionPoint, new XYZ(150, 50, 0)); //Get Connectors of duct1 and duct2's ConnectorManager and change their type to IEnumerable<Connector> //Get the first connector from the IEnumerable where the origin of the connector is almost equal to connectionPoint Connector connector1 = duct1.ConnectorManager.Connectors.Cast<Connector>().Where(c => c.Origin.IsAlmostEqualTo(connectionPoint)).First(); Connector connector2 = duct2.ConnectorManager.Connectors.Cast<Connector>().Where(c => c.Origin.IsAlmostEqualTo(connectionPoint)).First(); //Connect duct1 and duct2 with elbow fitting by their intersecting connectors(whose origin is almost equal to connectionPoint) bool connectResult = MechanicalUtils.ConnectDuctPlaceholdersAtElbow(document, connector1, connector2); //Convert duct1 and duct2 to real ducts ICollection<ElementId> convertedElementsId = MechanicalUtils.ConvertDuctPlaceholders(document, new ElementId[] { duct1.Id, duct2.Id });

'Create a point to be the connection point of two ductPlaceholders Dim connectionPoint As New XYZ(150, 0, 0) 'Create two new ductPlaceholders, duct1 and duct2, each ductPlaceholder has connectionPoint as its parameter Dim duct1 As Duct = Duct.CreatePlaceholder(document, systemTypeId, ductTypeId, levelId, New XYZ(100, 0, 0), connectionPoint) Dim duct2 As Duct = Duct.CreatePlaceholder(document, systemTypeId, ductTypeId, levelId, connectionPoint, New XYZ(150, 50, 0)) 'Get Connectors of duct1 and duct2's ConnectorManager and change their type to IEnumerable<Connector> 'Get the first connector from the IEnumerable where the origin of the connector is almost equal to connectionPoint Dim connector1 As Connector = duct1.ConnectorManager.Connectors.Cast(Of Connector)().Where(Function(c) c.Origin.IsAlmostEqualTo(connectionPoint)).First() Dim connector2 As Connector = duct2.ConnectorManager.Connectors.Cast(Of Connector)().Where(Function(c) c.Origin.IsAlmostEqualTo(connectionPoint)).First() 'Connect duct1 and duct2 with elbow fitting by their intersecting connectors(whose origin is almost equal to connectionPoint) Dim connectResult As Boolean = MechanicalUtils.ConnectDuctPlaceholdersAtElbow(document, connector1, connector2) 'Convert duct1 and duct2 to real ducts Dim convertedElementsId As ICollection(Of ElementId) = MechanicalUtils.ConvertDuctPlaceholders(document, New ElementId() {duct1.Id, duct2.Id})
Exceptions
Exception | Condition |
---|---|
Autodesk.Revit.Exceptions..::..ArgumentException | The owner of connector is not duct placeholder. -or- The owners of connectors belong to different types of system. |
Autodesk.Revit.Exceptions..::..ArgumentNullException | A non-optional argument was NULL |