How to create a dimension between two reference plane without any other elements?

How to create a dimension between two reference plane without any other elements?

2326751326
Explorer Explorer
306 Views
2 Replies
Message 1 of 3

How to create a dimension between two reference plane without any other elements?

2326751326
Explorer
Explorer

How to solve this problem?

Hint: The two references are not geometrically aligned so the Alignment cannot be created.

 

2326751326_0-1679559231287.png

 

 

 

My code:

 


UIDocument uidoc = commandData.Application.ActiveUIDocument;
Autodesk.Revit.DB.Document doc = uidoc.Document;

Transaction transaction = new Transaction(doc, "New Dimension");
transaction.Start();

XYZ rp1point1 = new XYZ(0, 0, 0);
XYZ rp1point2 = new XYZ(0, 100, 0);
XYZ rp1point3 = new XYZ(0, 0, 10);
XYZ rp2point1 = new XYZ(50, 0, 0);
XYZ rp2point2 = new XYZ(50, 100, 0);
XYZ rp2point3 = new XYZ(50, 0, 10);
try
{

ReferencePlane referencePlane1 = doc.Create.NewReferencePlane(rp1point1, rp1point2, rp1point3, doc.ActiveView);
Autodesk.Revit.DB.Reference reference1 = referencePlane1.GetReference();
ReferencePlane referencePlane2 = doc.Create.NewReferencePlane(rp2point1, rp2point2, rp2point3, doc.ActiveView);
Autodesk.Revit.DB.Reference reference2 = referencePlane2.GetReference();

try
{

Dimension dimension = doc.Create.NewAlignment(doc.ActiveView, reference1, reference2);

}
catch
{
TaskDialog.Show("Hint", "Create Dimension Failed.");
}

}

catch
{
TaskDialog.Show("Hint", "Create Reference Planes Failed.");

}



transaction.Commit();
return Result.Succeeded;

0 Likes
307 Views
2 Replies
Replies (2)
Message 2 of 3

jeremy_tammik
Alumni
Alumni

I do not believe that Revit supports dimensioning between non-aligned geometry. Can you achieve that manually in the end user interface? If not, then you cannot do so programmatically either.

  

Jeremy Tammik Developer Advocacy and Support + The Building Coder + Autodesk Developer Network + ADN Open
Message 3 of 3

2326751326
Explorer
Explorer

Of course when we create two reference planes manually in the view, then we can create a dimension by aligned dimension tool. 

 

But why it hints the two reference planes are not geometrically aligned when we create the alignment dimension by RevitAPI?