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)

public void SetLayoutAsCustomPattern(
double minorStartOverhang,
double majorStartOverhang,
IList<FabricWireItem> minorFabricWireItems,
IList<FabricWireItem> majorFabricWireItems
)
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 IList FabricWireItem
- The fabric wire items in the minor direction.
- majorFabricWireItems IList FabricWireItem
- 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;
}
