2022 Method
Changes 0
M

FabricSheetType.SetLayoutAsCustomPattern

Description:
Sets the minor and major layout patterns as Custom, while specifying the needed parameters for this pattern.
Remarks:
The following properties are not used for custom fabric sheet type: - MajorDirectionWireType; - MinorDirectionWireType; - MajorSpacing; - MinorSpacing.
public void SetLayoutAsCustomPattern(
	double minorStartOverhang,
	double majorStartOverhang,
	IList<FabricWireItem> minorFabricWireItems,
	IList<FabricWireItem> majorFabricWireItems
)
  • Double
    minorStartOverhang
    The distance from the edge of the sheet to the first wire in the minor direction.
  • Double
    majorStartOverhang
    The distance from the edge of the sheet to the first wire in the major direction.
  • minorFabricWireItems
    The fabric wire items in the minor direction.
  • majorFabricWireItems
    The fabric wire items in the major direction.
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();


    AnalyticalModelSurface ams = wall.GetAnalyticalModel() as AnalyticalModelSurface;
    sheet.PlaceInHost(wall, ams.GetLocalCoordinateSystem());

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

    return sheet;
}