Create Method (Document, Element, XYZ, ElementId, ElementId)


Creates a FabricArea based on a host boundary.

Namespace: Autodesk.Revit.DB.Structure
Assembly: RevitAPI (in RevitAPI.dll) Version: 17.0.0.0 (17.0.1090.0)
Since: 2015

Syntax

C#
public static FabricArea Create(
	Document aDoc,
	Element hostElement,
	XYZ majorDirection,
	ElementId fabricAreaTypeId,
	ElementId fabricSheetTypeId
)
Visual Basic
Public Shared Function Create ( _
	aDoc As Document, _
	hostElement As Element, _
	majorDirection As XYZ, _
	fabricAreaTypeId As ElementId, _
	fabricSheetTypeId As ElementId _
) As FabricArea
Visual C++
public:
static FabricArea^ Create(
	Document^ aDoc, 
	Element^ hostElement, 
	XYZ^ majorDirection, 
	ElementId^ fabricAreaTypeId, 
	ElementId^ fabricSheetTypeId
)

Parameters

aDoc
Type: Autodesk.Revit.DB Document
The document.
hostElement
Type: Autodesk.Revit.DB Element
The element that will host the FabricArea. The host can be a Structural Floor, Structural Wall, Structural Slab, or a Part created from a structural layer belonging to one of those element types.
majorDirection
Type: Autodesk.Revit.DB XYZ
A vector to define the major direction of the FabricArea.
fabricAreaTypeId
Type: Autodesk.Revit.DB ElementId
The id of the FabricAreaType.
fabricSheetTypeId
Type: Autodesk.Revit.DB ElementId
The id of the FabricSheetType.

Return Value

The newly created FabricArea.

Examples

Copy C#
private FabricArea CreateNewFabricArea(Document document, Element wall)
{
    FabricArea system = null;

    // create default types if they aren't already in the model
    ElementId fabricAreaTypeId = FabricAreaType.CreateDefaultFabricAreaType(document);
    ElementId fabricSheetTypeId = FabricSheetType.CreateDefaultFabricSheetType(document);

    system = FabricArea.Create(document, wall, new XYZ(1, 0, 0), fabricAreaTypeId, fabricSheetTypeId);
    // call regenerate to generate fabric sheets in fabric area
    document.Regenerate();

    // get the list of elementIds for the sheets automatically generated in the fabric area
    IList<ElementId> sheetIds = system.GetFabricSheetElementIds();

    TaskDialog.Show("Revit", string.Format("{0} fabric sheets created", sheetIds.Count));

    return system;
}
Copy VB.NET
Private Function CreateNewFabricArea(document As Document, wall As Element) As FabricArea
    Dim system As FabricArea = Nothing

    ' create default types if they aren't already in the model
    Dim fabricAreaTypeId As ElementId = FabricAreaType.CreateDefaultFabricAreaType(document)
    Dim fabricSheetTypeId As ElementId = FabricSheetType.CreateDefaultFabricSheetType(document)

    system = FabricArea.Create(document, wall, New XYZ(1, 0, 0), fabricAreaTypeId, fabricSheetTypeId)
    ' call regenerate to generate fabric sheets in fabric area
    document.Regenerate()

    ' get the list of elementIds for the sheets automatically generated in the fabric area
    Dim sheetIds As IList(Of ElementId) = system.GetFabricSheetElementIds()

    TaskDialog.Show("Revit", String.Format("{0} fabric sheets created", sheetIds.Count))

    Return system
End Function

Exceptions

Exception Condition
Autodesk.Revit.Exceptions ArgumentException The element hostElement was not found in the given document. -or- the host Element is not a valid host for Area Reinforcement, Path Reinforcement, Fabric Area or Fabric Sheet. -or- fabricAreaTypeId should refer to an FabricAreaType element. -or- fabricSheetTypeId should refer to an FabricSheetType element.
Autodesk.Revit.Exceptions ArgumentNullException A non-optional argument was NULL
Autodesk.Revit.Exceptions ArgumentOutOfRangeException majorDirection has zero length.
Autodesk.Revit.Exceptions DisabledDisciplineException None of the following disciplines is enabled: Structural.

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 →