I am trying to create a dimension between the intersection points of detail lines in a drawing, as shown in the image.
While I managed to create a dimension using some workarounds (since I couldn’t directly reference the intersection point), the dimension is not associative. This means that when I move any of the detail lines, the dimension does not update to reflect the new intersection point—it stays in its original position.
Workaround Attempts
1. Creating Small Detail Lines at Intersection Points – Placing short detail lines at the intersection and using them as reference.


2. Using Endpoints of Detail Lines – Creating two detail lines at the intersection and using their endpoints as reference.


However, in both cases, the dimension is not associative, meaning it does not update when the detail lines move.
I also tried creating a point using the Point.Create() method, but the reference returns null.
Can someone help me resolve this issue?
Below is the code I am using.
UIDocument uiDoc = TestingUI.UIDocument;
Autodesk.Revit.DB.Document doc = uiDoc.Document;
IList<Reference> selectedRefs = uiDoc.Selection.PickObjects(
ObjectType.Element,
new DetailLineSelectionFilter(),
"Select four detail lines"
);
if (selectedRefs.Count != 4)
{
TaskDialog.Show("Error", "Please select exactly four detail lines.");
//return Result.Failed;
}
XYZ pos = TestingUI.SelectPoint();
List<Line> lines = new List<Line>();
List<Element> detailLines = new List<Element>();
foreach (Reference reference in selectedRefs)
{
DetailLine detailLine = doc.GetElement(reference) as DetailLine;
if (detailLine == null)
{
TaskDialog.Show("Error", "Selected elements must be detail lines.");
//return Result.Failed;
}
lines.Add((Line)detailLine.GeometryCurve);
detailLines.Add(detailLine);
}
// Find intersection points
List<XYZ> intersectionPoints = new List<XYZ>();
IntersectionResultArray results1;
lines[0].Intersect(lines[1], out results1);
intersectionPoints.Add(results1.get_Item(0).XYZPoint);
IntersectionResultArray results2;
lines[2].Intersect(lines[3], out results2);
intersectionPoints.Add(results2.get_Item(0).XYZPoint);
using (Transaction transaction = new Transaction(doc, "point to point"))
{
transaction.Start();
Line vline1 = Line.CreateBound(lines[0].GetEndPoint(1), intersectionPoints[0]);
DetailCurve vdetailCurve1 = doc.Create.NewDetailCurve(doc.ActiveView, vline1);
Line vline2 = Line.CreateBound(lines[1].GetEndPoint(1), intersectionPoints[0]);
DetailCurve vdetailCurve2 = doc.Create.NewDetailCurve(doc.ActiveView, vline2);
Line vline3 = Line.CreateBound(lines[2].GetEndPoint(1), intersectionPoints[1]);
DetailCurve vdetailCurve3 = doc.Create.NewDetailCurve(doc.ActiveView, vline3);
Line vline4 = Line.CreateBound(lines[3].GetEndPoint(1), intersectionPoints[1]);
DetailCurve vdetailCurve4 = doc.Create.NewDetailCurve(doc.ActiveView, vline4);
Reference vlineRef1 = vdetailCurve1.GeometryCurve.GetEndPointReference(1);
Reference vlineRef2 = vdetailCurve3.GeometryCurve.GetEndPointReference(1);
ReferenceArray referenceArray = new ReferenceArray();
referenceArray.Append(vlineRef1);
referenceArray.Append(vlineRef2);
Point point1 = Point.Create(intersectionPoints[0]);
Point point2 = Point.Create(intersectionPoints[1]);
Reference pointRef1 = point1.Reference;
Reference pointRef2 = point2.Reference;
//pointRef1 & pointRef2 references are null
Line dimensionLine = Line.CreateUnbound(pos, doc.ActiveView.RightDirection);
Dimension dimension = doc.Create.NewDimension(doc.ActiveView, dimensionLine, referenceArray);
transaction.Commit();
}