An interface for Adaptive Component Instances.
Namespace: Autodesk.Revit.DB
Assembly: RevitAPI (in RevitAPI.dll) Version: 20.0.0.0 (20.0.0.377)
Since:
2012
Syntax
C# |
---|
public static class AdaptiveComponentFamilyUtils |
Visual Basic |
---|
Public NotInheritable Class AdaptiveComponentFamilyUtils |
Visual C++ |
---|
public ref class AdaptiveComponentFamilyUtils abstract sealed |
Examples
CopyC#
private void CreateAdaptiveComponentFamily(Document document)
{
if (!(AdaptiveComponentFamilyUtils.IsAdaptiveComponentFamily(document.OwnerFamily))) return;
using (Transaction transaction = new Transaction(document))
{
int placementCtr = 1;
ReferencePointArray refPointArray = new ReferencePointArray();
for (int i = 0; i < 10; i++)
{
transaction.SetName("Point" + i);
transaction.Start();
ReferencePoint referencePoint = document.FamilyCreate.NewReferencePoint(new XYZ(i, 0, 0));
if (i % 2 == 0)
{
AdaptiveComponentFamilyUtils.MakeAdaptivePoint(document, referencePoint.Id, AdaptivePointType.PlacementPoint);
transaction.Commit();
AdaptiveComponentFamilyUtils.SetPlacementNumber(document, referencePoint.Id, placementCtr);
placementCtr++;
}
else
{
AdaptiveComponentFamilyUtils.MakeAdaptivePoint(document, referencePoint.Id, AdaptivePointType.ShapeHandlePoint);
transaction.Commit();
}
refPointArray.Append(referencePoint);
}
if (transaction.GetStatus() == TransactionStatus.Committed)
{
transaction.SetName("Curve");
transaction.Start();
CurveByPoints curve = document.FamilyCreate.NewCurveByPoints(refPointArray);
transaction.Commit();
}
}
}
CopyVB.NET
Private Sub CreateAdaptiveComponentFamily(document As Document)
If Not (AdaptiveComponentFamilyUtils.IsAdaptiveComponentFamily(document.OwnerFamily)) Then
Return
End If
Using transaction As New Transaction(document)
Dim placementCtr As Integer = 1
Dim refPointArray As New ReferencePointArray()
For i As Integer = 0 To 9
transaction.SetName("Point" & i)
transaction.Start()
Dim referencePoint As ReferencePoint = document.FamilyCreate.NewReferencePoint(New XYZ(i, 0, 0))
If i Mod 2 = 0 Then
AdaptiveComponentFamilyUtils.MakeAdaptivePoint(document, referencePoint.Id, AdaptivePointType.PlacementPoint)
transaction.Commit()
AdaptiveComponentFamilyUtils.SetPlacementNumber(document, referencePoint.Id, placementCtr)
placementCtr += 1
Else
AdaptiveComponentFamilyUtils.MakeAdaptivePoint(document, referencePoint.Id, AdaptivePointType.ShapeHandlePoint)
transaction.Commit()
End If
refPointArray.Append(referencePoint)
Next
If transaction.GetStatus() = TransactionStatus.Committed Then
transaction.SetName("Curve")
transaction.Start()
Dim curve As CurveByPoints = document.FamilyCreate.NewCurveByPoints(refPointArray)
transaction.Commit()
End If
End Using
End Sub
Inheritance Hierarchy
See Also