Skip to content

RebarContainer.Create

Public Class

Creates a new instance of a Rebar Container element within the project.

Namespace: Autodesk.Revit.DB.Structure

Assembly: RevitAPI (in RevitAPI.dll) Version: 25.0.0.0 (25.0.0.0)

Syntax

public static RebarContainer Create(
Document aDoc,
Element hostElement,
ElementId rebarContainerTypeId
)

Parameters

aDoc Document

A document.

hostElement Element

The element that will host the RebarContainer.

rebarContainerTypeId ElementId

The id of the RebarContainerType.

Return Value

RebarContainer
The newly created Rebar Container instance.

Exceptions

Exception

Condition


ArgumentException

The element hostElement was not found in the given document. -or- hostElement is not a valid rebar host. -or- the ElementId rebarContainerTypeId is either invalid or not a RebarContainerType.


ArgumentNullException

A non-optional argument was null


Remarks

Created Rebar Container starts out empty. Use appendItemFromRebar, appendItemFromCurves, appendItemFromRebarShape, appendItemFromCurvesAndShape to fill its content.

Example

RebarContainer CreateRebarContainer(Autodesk.Revit.DB.Document document, FamilyInstance beam)
{
// Create a new rebar container
ElementId defaultRebarContainerTypeId = RebarContainerType.CreateDefaultRebarContainerType(document);
RebarContainer container = RebarContainer.Create(document, beam, defaultRebarContainerTypeId);
// Any items for this container should be presented in schedules and tags as separate subelements
container.PresentItemsAsSubelements = true;
return container;
}