AddAssociation Method (ISet(ElementId), ISet(ElementId))


Adds a new association between a group of analytical elements and a group of physical elements.

Namespace: Autodesk.Revit.DB.Structure
Assembly: RevitAPI (in RevitAPI.dll) Version: 24.0.0.0 (24.0.0.0)
Since:  2024

Syntax

C#
public void AddAssociation(
	ISet<ElementId> analyticalElementIds,
	ISet<ElementId> physicalElementIds
)
Visual Basic
Public Sub AddAssociation ( _
	analyticalElementIds As ISet(Of ElementId), _
	physicalElementIds As ISet(Of ElementId) _
)
Visual C++
public:
void AddAssociation(
	ISet<ElementId^>^ analyticalElementIds, 
	ISet<ElementId^>^ physicalElementIds
)

Parameters

analyticalElementIds
Type: System.Collections.GenericISetElementId
Ids of the analytical elements.
physicalElementIds
Type: System.Collections.GenericISetElementId
Ids of the physical elements.

Remarks

The arguments must be ids of analytical and of physical elements that don't have other associations, otherwise an exception is thrown. Physical elements can have one of these categories:
  • Columns
  • Curtain Wall Panels
  • Floors
  • Generic Models
  • Mass
  • Parts
  • Railings
  • Ramps
  • Roofs
  • Stairs
  • Structural Columns
  • Structural Foundation
  • Structural Framing
  • Structural Trusses
  • Structural Beam System
  • Walls
Analytical elements can have one of these categories:
  • Analytical Member
  • Analytical Panel

Exceptions

ExceptionCondition
Autodesk.Revit.ExceptionsArgumentException Analytical id is not valid or has already defined another association. -or- Physical id is not valid or has already defined another association.
Autodesk.Revit.ExceptionsArgumentNullException A non-optional argument was null

See Also