2027 Method
Changes 0
M

FabricArea.Create

Description:
Creates a FabricArea based on a host boundary.
Overloads (2):
Create(Document,Element,XYZ,ElementId,ElementId)
public static FabricArea Create(
	Document aDoc,
	Element hostElement,
	XYZ majorDirection,
	ElementId fabricAreaTypeId,
	ElementId fabricSheetTypeId
)
  • aDoc
    The document.
  • hostElement
    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
    A vector to define the major direction of the FabricArea.
  • fabricAreaTypeId
    The id of the FabricAreaType.
  • fabricSheetTypeId
    The id of the FabricSheetType.
Return Value FabricArea The newly created FabricArea.
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;
}
  • 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.
  • A non-optional argument was null
  • majorDirection has zero length.