AddElementsToCustomConnection Method


Modifies StructuralConnectionHandlerType of input StructuralConnectionHandler by adding representors of input elements or subelements.

Namespace: Autodesk.Revit.DB.Structure
Assembly: RevitAPI (in RevitAPI.dll) Version: 22.0.0.0 (22.1.0.0)
Since: 2017

Syntax

C#
public static void AddElementsToCustomConnection(
	StructuralConnectionHandler structuralConnectionHandler,
	IList<Reference> references
)
Visual Basic
Public Shared Sub AddElementsToCustomConnection ( _
	structuralConnectionHandler As StructuralConnectionHandler, _
	references As IList(Of Reference) _
)
Visual C++
public:
static void AddElementsToCustomConnection(
	StructuralConnectionHandler^ structuralConnectionHandler, 
	IList<Reference^>^ references
)

Parameters

structuralConnectionHandler
Type: Autodesk.Revit.DB.Structure StructuralConnectionHandler
The existing StructuralConnectionHandler having custom StructuralConnectionHandlerType which is about to be modified.
references
Type: System.Collections.Generic IList Reference
References to elements or subelements which are to be used to modify custom StructuralConnectionHandlerType by adding their representors.

Remarks

Elements or subelements added to a custom connection are deleted and transformed in subelements of the connection. They could be:
  • FamilyInstance (structural beams and columns).
  • StructuralConnectionHandler elements associated to the connection.
  • Specific steel connection elements (bolts, anchors, plates, etc). These connection elements will be of type element but with categories related to structural connections, for example:
    • OST_StructConnectionWelds
    • OST_StructConnectionHoles
    • OST_StructConnectionModifiers
    • OST_StructConnectionShearStuds
    • OST_StructConnectionBolts
    • OST_StructConnectionAnchors
    • OST_StructConnectionPlates
You cannot add: elements connected by any connection handler, generic connections, holes and modifiers that are not on the connected elements.

Examples

Copy C#
   // Select elements to add to connection.
   IList<Reference> refs = Utilities.Functions.SelectConnectionElementsCustom(activeDoc);

   if (refs.Count() <= 0)
   {
      return Result.Failed;
   }

   // Start transaction
   trans.Start();
   // Adding the elements to the custom connection, using Revit's StructuralConnectionHandlerType class
   StructuralConnectionHandlerType.AddElementsToCustomConnection(conn, refs);
   // Commit the transaction
   ts = trans.Commit();

   if (ts != TransactionStatus.Committed)
   {
      message = "Failed to commit the current transaction !";
      trans.RollBack();
      return Result.Failed;
   }              
}

Exceptions

Exception Condition
Autodesk.Revit.Exceptions ArgumentException Input StructuralConnectionHandler must have custom type. -or- All the input Elements should be of the following structural categories: framings, columns, profiles, plates, bolts, anchors, shear studs, welds or structural connections. -or- Total number of different input elements of input StructuralConnectionHandlers must be lower or equal to 3.
Autodesk.Revit.Exceptions ArgumentNullException A non-optional argument was null

See Also

ArchiLabs Desktop

Put AI to work inside Revit.

Give Desktop your instructions and project files to build Revit families, update model elements, and create views and schedules. Works directly in Revit and AutoCAD.

Explore Desktop →