Create Method


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

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

Syntax

C#
public static RebarContainer Create(
	Document aDoc,
	Element hostElement,
	ElementId rebarContainerTypeId
)
Visual Basic
Public Shared Function Create ( _
	aDoc As Document, _
	hostElement As Element, _
	rebarContainerTypeId As ElementId _
) As RebarContainer
Visual C++
public:
static RebarContainer^ Create(
	Document^ aDoc, 
	Element^ hostElement, 
	ElementId^ rebarContainerTypeId
)

Parameters

aDoc
Type: Autodesk.Revit.DBDocument
A document.
hostElement
Type: Autodesk.Revit.DBElement
The element that will host the RebarContainer.
rebarContainerTypeId
Type: Autodesk.Revit.DBElementId
The id of the RebarContainerType.

Return Value

The newly created Rebar Container instance.

Remarks

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

Examples

CopyC#
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;
}
CopyVB.NET
Private Function CreateRebarContainer(document As Autodesk.Revit.DB.Document, beam As FamilyInstance) As RebarContainer
    ' Create a new rebar container
    Dim defaultRebarContainerTypeId As ElementId = RebarContainerType.CreateDefaultRebarContainerType(document)
    Dim container As RebarContainer = 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
End Function

Exceptions

ExceptionCondition
Autodesk.Revit.ExceptionsArgumentException 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.
Autodesk.Revit.ExceptionsArgumentNullException A non-optional argument was null

See Also