Linear dimension between reference planes

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi,
Does anyone know if it's possible to make a linear dimension between two reference planes in revit API? My idea is to set this to a family parameter to make the distance between the planes adjustable in the project file.
This simply doesn't seem to work:
//CREATE PLANE 1
XYZ freeend1 = new XYZ(1, 10, 0);
XYZ bubbleend1 = new XYZ(1, -10, 0);
XYZ cutvec = new XYZ(0, 0, 1);
ReferencePlane refplane1 = document.FamilyCreate.NewReferencePlane(bubbleend1, freeend1, cutvec, document.ActiveView);
//CREATE PLANE 1 - is parallel to plane 1
XYZ freeend2 = new XYZ(5, 10, 0);
XYZ bubbleend2 = new XYZ(5, -10, 0);
//XYZ cutvec = new XYZ(0, 0, 1);
ReferencePlane refplane2 = document.FamilyCreate.NewReferencePlane(bubbleend2, freeend2, cutvec, document.ActiveView);
//CREATE DIMENSION LINE - is perpendicular to both refplane1 and refplane2
XYZ dimpt1 = new XYZ(1, 10, 0);
XYZ dimpt2 = new XYZ(5, 10, 0);
Line dimline = document.Application.Create.NewLine(dimpt1, dimpt2, true);
// CREATING LINEAR DIMENSION
ReferenceArray ra = new ReferenceArray();
ra.Append(refplane1.Reference);
ra.Append(refplane2.Reference);
Dimension dim = document.FamilyCreate.NewLinearDimension(document.ActiveView, dimline, ra);
FamilyParameter param = document.FamilyManager.AddParameter("width", BuiltInParameterGroup.PG_CONSTRAINTS, ParameterType.Length, false);
dim.Label = param;
I get the message "One of the conditions for the inputs was not satisfied. Consult the documentation for requirements for each argument"
Any ideas anyone?
Many thanks,
Emil