MechanicalUtilsConnectDuctPlaceholdersAtElbow(Document, Connector, Connector) Method |
Connects a pair of placeholders that can intersect in an Elbow connection.
Namespace: Autodesk.Revit.DB.MechanicalAssembly: RevitAPI (in RevitAPI.dll) Version: 25.0.0.0 (25.0.0.0)
Syntaxpublic static bool ConnectDuctPlaceholdersAtElbow(
Document document,
Connector connector1,
Connector connector2
)
Public Shared Function ConnectDuctPlaceholdersAtElbow (
document As Document,
connector1 As Connector,
connector2 As Connector
) As Boolean
public:
static bool ConnectDuctPlaceholdersAtElbow(
Document^ document,
Connector^ connector1,
Connector^ connector2
)
static member ConnectDuctPlaceholdersAtElbow :
document : Document *
connector1 : Connector *
connector2 : Connector -> bool
Parameters
- document Document
-
The document.
- connector1 Connector
-
The end connector of the first placeholder.
- connector2 Connector
-
The end connector of the second placeholder.
Return Value
Boolean
True if connection succeeds, false otherwise.
ExceptionsException | Condition |
---|
ArgumentException |
The owner of connector is not duct placeholder.
-or-
The owners of connectors belong to different types of system.
|
ArgumentNullException |
A non-optional argument was null
|
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.
Example
XYZ connectionPoint = new XYZ(150, 0, 0);
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));
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();
bool connectResult = MechanicalUtils.ConnectDuctPlaceholdersAtElbow(document, connector1, connector2);
ICollection<ElementId> convertedElementsId = MechanicalUtils.ConvertDuctPlaceholders(document, new ElementId[] { duct1.Id, duct2.Id });
Dim connectionPoint As New XYZ(150, 0, 0)
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))
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()
Dim connectResult As Boolean = MechanicalUtils.ConnectDuctPlaceholdersAtElbow(document, connector1, connector2)
Dim convertedElementsId As ICollection(Of ElementId) = MechanicalUtils.ConvertDuctPlaceholders(document, New ElementId() {duct1.Id, duct2.Id})
No code example is currently available or this language may not be supported.
No code example is currently available or this language may not be supported.
See Also