Revit 2025 API
Fabric |
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: 25.0.0.0 (25.0.0.0)
Syntax
public void SetLayoutAsCustomPattern( double minorStartOverhang, double majorStartOverhang, IList<FabricWireItem> minorFabricWireItems, IList<FabricWireItem> majorFabricWireItems )
Public Sub SetLayoutAsCustomPattern ( minorStartOverhang As Double, majorStartOverhang As Double, minorFabricWireItems As IList(Of FabricWireItem), majorFabricWireItems As IList(Of FabricWireItem) )
public: void SetLayoutAsCustomPattern( double minorStartOverhang, double majorStartOverhang, IList<FabricWireItem^>^ minorFabricWireItems, IList<FabricWireItem^>^ majorFabricWireItems )
member SetLayoutAsCustomPattern : minorStartOverhang : float * majorStartOverhang : float * minorFabricWireItems : IList<FabricWireItem> * majorFabricWireItems : IList<FabricWireItem> -> unit
Parameters
- minorStartOverhang Double
- The distance from the edge of the sheet to the first wire in the minor direction.
- majorStartOverhang Double
- The distance from the edge of the sheet to the first wire in the major direction.
- minorFabricWireItems IListFabricWireItem
- The fabric wire items in the minor direction.
- majorFabricWireItems IListFabricWireItem
- The fabric wire items in the major direction.

Exception | Condition |
---|---|
ArgumentException | The given value for minorStartOverhang is not a number -or- The given value for majorStartOverhang is not a number |
ArgumentNullException | A non-optional argument was null |
ArgumentOutOfRangeException | 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. |

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

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; }
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
No code example is currently available or this language may not be supported.
No code example is currently available or this language may not be supported.
See Also