Namespace:
Autodesk.Revit.DB
AdaptiveComponentFamilyUtils
Class
Description:
An interface for Adaptive Component Instances.
An interface for Adaptive Component Instances.
Inheritance Hierarchy:
System.Object
Autodesk.Revit.DB.AdaptiveComponentFamilyUtils
System.Object
Autodesk.Revit.DB.AdaptiveComponentFamilyUtils
Syntax
public static class AdaptiveComponentFamilyUtils
Examples
private void CreateAdaptiveComponentFamily(Document document)
{
// check if this family is an Adaptive Component family
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)
// Even-numbered reference points will be Placement Points
{
AdaptiveComponentFamilyUtils.MakeAdaptivePoint(document, referencePoint.Id, AdaptivePointType.PlacementPoint);
transaction.Commit();
AdaptiveComponentFamilyUtils.SetPlacementNumber(document, referencePoint.Id, placementCtr);
placementCtr++;
}
else
// Odd-numbered points will be Shape Handle Points
{
AdaptiveComponentFamilyUtils.MakeAdaptivePoint(document, referencePoint.Id, AdaptivePointType.ShapeHandlePoint);
transaction.Commit();
}
refPointArray.Append(referencePoint);
}
// Create a curve running through all Reference Points
if (transaction.GetStatus() == TransactionStatus.Committed)
{
transaction.SetName("Curve");
transaction.Start();
CurveByPoints curve = document.FamilyCreate.NewCurveByPoints(refPointArray);
transaction.Commit();
}
}
}