Most blogs only cover how to modify positioning points or pass data into an existing adaptive family. There are no articles introducing how to directly create an adaptive model in a family file, convert points to adaptive points, and connect adaptive points to form an adaptive path.

![Snipaste_2026-01-04_15-25-29.png](https://cdn.bimath.com/blog/pg/Snipaste_2026-01-04_15-25-29.png)

The code below demonstrates how to create reference points in an adaptive family file, convert them to adaptive points, connect them to form a path, and finally create a swept blend form.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
     public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
{
var uiDoc = commandData.Application.ActiveUIDocument; // UIDocument


var doc = uiDoc.Document;

// Define start and end points of the path
var pathStart = new XYZ(0, 0, 0);
var pathEnd = new XYZ(0, 0, 10);

// Define points for the first profile (bottom profile)
var bottomProfilePoints = new List<XYZ>
{
new XYZ(-2, -2, 0), // Bottom Left
new XYZ(2, -2, 0), // Bottom Right
new XYZ(2, 2, 0), // Top Right
new XYZ(-2, 2, 0) // Top Left
};

// Define points for the second profile (top profile)
var topProfilePoints = new List<XYZ>
{
new XYZ(-3, -3, 10), // Bottom Left
new XYZ(3, -3, 10), // Bottom Right
new XYZ(3, 3, 10), // Top Right
new XYZ(-3, 3, 10) // Top Left
};

// Create profile curves
var bottomProfile = CreateClosedCurveLoop(bottomProfilePoints);
var topProfile = CreateClosedCurveLoop(topProfilePoints);

// Create path
var path = Line.CreateBound(pathStart, pathEnd);

// Execute Transaction
using (Transaction transaction = new Transaction(doc, "Create Sweep Form"))
{
transaction.Start();

// Create adaptive points
var refStart = doc.FamilyCreate.NewReferencePoint(pathStart);
AdaptiveComponentFamilyUtils.MakeAdaptivePoint(doc, refStart.Id, AdaptivePointType.PlacementPoint);
var refEnd = doc.FamilyCreate.NewReferencePoint(pathEnd);
AdaptiveComponentFamilyUtils.MakeAdaptivePoint(doc, refEnd.Id, AdaptivePointType.PlacementPoint);

// Set adaptive point numbers
AdaptiveComponentFamilyUtils.SetPlacementNumber(doc, refStart.Id, 1);
AdaptiveComponentFamilyUtils.SetPlacementNumber(doc, refEnd.Id, 2);

// Create adaptive path
var refPoints = new ReferencePointArray();
refPoints.Append(refStart);
refPoints.Append(refEnd);
var refCurve = doc.FamilyCreate.NewCurveByPoints(refPoints);

// Create sketch planes
var bottomSketchPlane = SketchPlane.Create(doc, Plane.CreateByNormalAndOrigin(XYZ.BasisZ, pathStart));
var topSketchPlane = SketchPlane.Create(doc, Plane.CreateByNormalAndOrigin(XYZ.BasisZ, pathEnd));
var pathSketchPlane = SketchPlane.Create(doc, Plane.CreateByThreePoints(pathStart, pathEnd, pathStart + new XYZ(-1, 0, 0)));

// Create reference array for profiles
var refArrArray = new ReferenceArrayArray();
refArrArray.Append(CreateReferenceArrayFromCurveLoop(doc, bottomProfile, bottomSketchPlane));
refArrArray.Append(CreateReferenceArrayFromCurveLoop(doc, topProfile, topSketchPlane));

// Create reference array for path
var pathRefArray = new ReferenceArray();
var pathModelCurve = doc.FamilyCreate.NewModelCurve(path, pathSketchPlane);
pathRefArray.Append(refCurve.GeometryCurve.Reference);

// Create swept blend form
var form = doc.FamilyCreate.NewSweptBlendForm(true, pathRefArray, refArrArray);

transaction.Commit();
}

//var collector = new FilteredElementCollector(doc).OfCategory(BuiltInCategory.OST_Rooms).WhereElementIsNotElementType();

//foreach (Element ele in collector)
//{
// var comment = ele.get_Parameter(BuiltInParameter.ALL_MODEL_INSTANCE_COMMENTS);

// TaskDialog.Show("Revit", comment.AsString());
// break;
//}


//var selection = uiDoc.Selection.PickObject(ObjectType.Element);
//var ele = doc.GetElement(selection) as Wall;
//var locationCurve = ele.Location as LocationCurve;
////var point0 = (locationCurve.Curve as Edge).GetEndPoint(0);
//var point1 = (locationCurve.Curve).GetEndPoint(1);
////TaskDialog.Show("Revit", $"S: {point0.X} , {point0.Y} , E: {point1.X} , {point1.Y}");
//TaskDialog.Show("Revit", $"S: {double.MinValue}");
//var tess = (locationCurve.Curve).Tessellate();
//TaskDialog.Show("Revit", $"S: {tess[0].X} , {tess[0].Y} , E: {tess[1].X} , {tess[1].Y} , count : {tess.Count}");
//using (Transaction trans = new Transaction(doc,"create"))
//{
// trans.Start();


// ////var pipe5 = Pipe.Create(doc, new ElementId(621821), new ElementId(6323162), new ElementId(7984255), new XYZ(10, 10, 15), new XYZ(17, 10, 15));
// //var pipe5 = doc.GetElement(new ElementId(8028066)) as Pipe;
// ////var pipe5 = doc.GetElement(new ElementId(8028405)) as Duct;
// ////var pipe8 = Pipe.Create(doc, new ElementId(621821), new ElementId(6323162), new ElementId(7984255), new XYZ(18, 0, 15), new XYZ(18, 20, 15));
// //var pipe8 = doc.GetElement(new ElementId(8028069)) as Pipe;
// ////var pipe8 = doc.GetElement(new ElementId(8028423)) as Duct;


// //ConnectWithTakeoff(doc, pipe8, pipe5);

// Wall.Create(doc,CreateWallBoundaryList(),new ElementId(7301614),new ElementId(7984255),false);

// trans.Commit();
//}




return Result.Succeeded;
}


/// <summary>
/// Create a closed curve loop from a list of points
/// </summary>
/// <param name="points">List of points</param>
/// <returns>Closed CurveArray</returns>
CurveArray CreateClosedCurveLoop(List<XYZ> points)
{
var curveArray = new CurveArray();
for (int i = 0; i < points.Count; i++)
{
var startPoint = points[i];
var endPoint = points[(i + 1) % points.Count]; // Loop closure
curveArray.Append(Line.CreateBound(startPoint, endPoint));
}
return curveArray;
}

/// <summary>
/// Create a reference array from a curve loop
/// </summary>
/// <param name="doc">Current Document</param>
/// <param name="curveLoop">Curve Loop</param>
/// <param name="sketchPlane">Sketch Plane</param>
/// <returns>ReferenceArray</returns>
ReferenceArray CreateReferenceArrayFromCurveLoop(Document doc, CurveArray curveLoop, SketchPlane sketchPlane)
{
var refArray = new ReferenceArray();
foreach (Curve curve in curveLoop)
{
var modelCurve = doc.FamilyCreate.NewModelCurve(curve, sketchPlane);
refArray.Append(modelCurve.GeometryCurve.Reference);
}
return refArray;
}