SetLayoutAsCustomPattern Method (Double, Double, IList(FabricWireItem), IList(FabricWireItem))


Sets the minor and major layout patterns as Custom, while specifying the needed parameters for this pattern.

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

Syntax

C#
public void SetLayoutAsCustomPattern(
	double minorStartOverhang,
	double majorStartOverhang,
	IList<FabricWireItem> minorFabricWireItems,
	IList<FabricWireItem> majorFabricWireItems
)
Visual Basic
Public Sub SetLayoutAsCustomPattern ( _
	minorStartOverhang As Double, _
	majorStartOverhang As Double, _
	minorFabricWireItems As IList(Of FabricWireItem), _
	majorFabricWireItems As IList(Of FabricWireItem) _
)
Visual C++
public:
void SetLayoutAsCustomPattern(
	double minorStartOverhang, 
	double majorStartOverhang, 
	IList<FabricWireItem^>^ minorFabricWireItems, 
	IList<FabricWireItem^>^ majorFabricWireItems
)

Parameters

minorStartOverhang
Type: SystemDouble
The distance from the edge of the sheet to the first wire in the minor direction.
majorStartOverhang
Type: SystemDouble
The distance from the edge of the sheet to the first wire in the major direction.
minorFabricWireItems
Type: System.Collections.GenericIListFabricWireItem
The fabric wire items in the minor direction.
majorFabricWireItems
Type: System.Collections.GenericIListFabricWireItem
The fabric wire items in the major direction.

Remarks

The following properties are not used for custom fabric sheet type: - MajorDirectionWireType; - MinorDirectionWireType; - MajorSpacing; - MinorSpacing.

Examples

CopyC#
private FabricSheet CreateCustomFabricSheet(Document document, Element wall)
{
   if (FabricSheet.IsValidHost(wall) == false)
      return null;

   // Create a new type for custom FabricSheet
   ElementId fabricSheetTypeId = FabricSheetType.CreateDefaultFabricSheetType(document);
   FabricSheetType fst = document.GetElement(fabricSheetTypeId) as FabricSheetType;

   // Create some fabric wire types
   ElementId idWireType1 = FabricWireType.CreateDefaultFabricWireType(document);
   FabricWireType wireType1 = document.GetElement(idWireType1) as FabricWireType;
   wireType1.WireDiameter = 3.5 / 12.0;

   ElementId idWireType2 = FabricWireType.CreateDefaultFabricWireType(document);
   FabricWireType wireType2 = document.GetElement(idWireType1) as FabricWireType;
   wireType2.WireDiameter = 2.0 / 12.0;

   // Create the wires for the custom pattern
   IList<FabricWireItem> majorWires = new List<FabricWireItem>();
   IList<FabricWireItem> minorWires = new List<FabricWireItem>();
   FabricWireItem item = FabricWireItem.Create(2.0 / 12.0, 1, idWireType1, .0);
   majorWires.Add(item);
   majorWires.Add(item);
   item = FabricWireItem.Create(1.5 / 12.0, 10.0 / 12.0, idWireType2, .0);
   majorWires.Add(item);

   item = FabricWireItem.Create(3.0 / 12.0, 1, idWireType2, .0);
   minorWires.Add(item);
   item = FabricWireItem.Create(3.0 / 12.0, 10.0 / 12.0, idWireType2, .0);
   minorWires.Add(item);

   fst.SetLayoutAsCustomPattern(6.0 / 12.0, 4.0 / 12.0, minorWires, majorWires);

   FabricSheet sheet = FabricSheet.Create(document, wall, fabricSheetTypeId);
   // Regeneration is required before setting any property to object that was created in the same transaction.
   document.Regenerate();

   AnalyticalElement wallElem = null;
   AnalyticalToPhysicalAssociationManager assocManager = AnalyticalToPhysicalAssociationManager.GetAnalyticalToPhysicalAssociationManager(document);
   if (assocManager != null)
   {
      ElementId associatedElementId = assocManager.GetAssociatedElementId(wall.Id);
      if (associatedElementId != ElementId.InvalidElementId)
      {
         Element associatedElem = document.GetElement(associatedElementId);
         if (associatedElem != null && associatedElem is AnalyticalElement)
         {
            wallElem = associatedElem as AnalyticalElement;
         }
      }
   }

   sheet.PlaceInHost(wall, wallElem.GetTransform());

   // Give the user some information
   TaskDialog.Show("Revit", string.Format("Flat Fabric Sheet ID='{0}' created successfully.", sheet.Id.ToString()));

   return sheet;
}
CopyVB.NET
Private Function CreateCustomFabricSheet(document As Document, wall As Element) As FabricSheet
      If FabricSheet.IsValidHost(wall) = False Then
          Return Nothing
      End If

      ' Create a new type for custom FabricSheet
      Dim fabricSheetTypeId As ElementId = FabricSheetType.CreateDefaultFabricSheetType(document)
      Dim fst As FabricSheetType = TryCast(document.GetElement(fabricSheetTypeId), FabricSheetType)

      ' Create some fabric wire types
      Dim idWireType1 As ElementId = FabricWireType.CreateDefaultFabricWireType(document)
      Dim wireType1 As FabricWireType = TryCast(document.GetElement(idWireType1), FabricWireType)
      wireType1.WireDiameter = 3.5 / 12.0

      Dim idWireType2 As ElementId = FabricWireType.CreateDefaultFabricWireType(document)
      Dim wireType2 As FabricWireType = TryCast(document.GetElement(idWireType1), FabricWireType)
      wireType2.WireDiameter = 2.0 / 12.0

      ' Create the wires for the custom pattern
      Dim majorWires As IList(Of FabricWireItem) = New List(Of FabricWireItem)()
      Dim minorWires As IList(Of FabricWireItem) = New List(Of FabricWireItem)()
      Dim item As FabricWireItem = FabricWireItem.Create(2.0 / 12.0, 1, idWireType1, .0)
      majorWires.Add(item)
      majorWires.Add(item)
      item = FabricWireItem.Create(1.5 / 12.0, 10.0 / 12.0, idWireType2, .0)
      majorWires.Add(item)

      item = FabricWireItem.Create(3.0 / 12.0, 1, idWireType2, .0)
      minorWires.Add(item)
      item = FabricWireItem.Create(3.0 / 12.0, 10.0 / 12.0, idWireType2, .0)
      minorWires.Add(item)

      fst.SetLayoutAsCustomPattern(6.0 / 12.0, 4.0 / 12.0, minorWires, majorWires)

      Dim sheet As FabricSheet = FabricSheet.Create(document, wall, fabricSheetTypeId)
      ' Regeneration is required before setting any property to object that was created in the same transaction.
      document.Regenerate()

   Dim ams As Autodesk.Revit.DB.Structure.AnalyticalElement = Nothing
   Dim relManager As Autodesk.Revit.DB.Structure.AnalyticalToPhysicalAssociationManager = Autodesk.Revit.DB.Structure.AnalyticalToPhysicalAssociationManager.GetAnalyticalToPhysicalAssociationManager(document)

   If (relManager Is Nothing) Then
      Return Nothing
   End If

   Dim counterpartId As ElementId = relManager.GetAssociatedElementId(wall.Id)
   If (counterpartId Is Nothing) Then
      Return Nothing
   End If

   ams = document.GetElement(counterpartId)

   sheet.PlaceInHost(wall, ams.GetTransform())

   ' Give the user some information
   TaskDialog.Show("Revit", String.Format("Flat Fabric Sheet ID='{0}' created successfully.", sheet.Id.ToString()))

      Return sheet
  End Function

Exceptions

ExceptionCondition
Autodesk.Revit.ExceptionsArgumentException The given value for minorStartOverhang is not a number -or- The given value for majorStartOverhang is not a number
Autodesk.Revit.ExceptionsArgumentNullException A non-optional argument was null
Autodesk.Revit.ExceptionsArgumentOutOfRangeException The given value for minorStartOverhang must be between 0 and 30000 feet. -or- The given value for majorStartOverhang must be between 0 and 30000 feet.

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 →