GetAssociatedParts Method (Document, ElementId, Boolean, Boolean)


Returns all Parts that are associated with the given element.

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

Syntax

C#
public static ICollection<ElementId> GetAssociatedParts(
	Document hostDocument,
	ElementId elementId,
	bool includePartsWithAssociatedParts,
	bool includeAllChildren
)
Visual Basic
Public Shared Function GetAssociatedParts ( _
	hostDocument As Document, _
	elementId As ElementId, _
	includePartsWithAssociatedParts As Boolean, _
	includeAllChildren As Boolean _
) As ICollection(Of ElementId)
Visual C++
public:
static ICollection<ElementId^>^ GetAssociatedParts(
	Document^ hostDocument, 
	ElementId^ elementId, 
	bool includePartsWithAssociatedParts, 
	bool includeAllChildren
)

Parameters

hostDocument
Type: Autodesk.Revit.DBDocument
The document of the element.
elementId
Type: Autodesk.Revit.DBElementId
The element to be checked for associated Parts.
includePartsWithAssociatedParts
Type: SystemBoolean
If true, include parts that have associated parts.
includeAllChildren
Type: SystemBoolean
If true, return all associated Parts recursively for all children. If false, only return immediate children.

Return Value

Parts that are associated to the element.

Exceptions

ExceptionCondition
Autodesk.Revit.ExceptionsArgumentNullException 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 →