The Revit Properties user interface does not show any particular information about curved walls such as their radius and angles. The Revit API does not provide such properties in the Wall class either.
If we’d like to retrieve the information, we have to think of a way by ourselves. Supposing there is such a wall as the following image shows, what shall we do to get those dimensions?
Some Revit API parameters are designated for this task. They are:
BuiltInParameter.CURVE_ELEM_ARC_RADIUS
BuiltInParameter.CURVE_ELEM_ARC_START_ANGLE
BuiltInParameter.CURVE_ELEM_ARC_RANGE
BuiltInParameter.CURVE_ELEM_ARC_END_ANGLE
public static void CurvedWallRadiusAngles(Element e)
{
Parameter p = e.get_Parameter(BuiltInParameter.CURVE_ELEM_ARC_RADIUS);
double radius = p.AsDouble();
p = e.get_Parameter(BuiltInParameter.CURVE_ELEM_ARC_START_ANGLE);
double startAngle = p.AsDouble();
p = e.get_Parameter(BuiltInParameter.CURVE_ELEM_ARC_RANGE);
double angleRangle = p.AsDouble();
p = e.get_Parameter(BuiltInParameter.CURVE_ELEM_ARC_END_ANGLE);
double endAngle = p.AsDouble();
MessageBox.Show(string.Format("Radius: {0}\nStart Angle: {1}\nAngle Range: {2}\nEnd Angle: {3}", radius, startAngle, angleRangle, endAngle), "Curved Wall Infomation");
}
Here is the test code:
…
Element pickedElement = cmdData.Application.ActiveUIDocument.Selection.PickObject(ObjectType.Element, "Pick a curved wall").Element;
CurvedWallRadiusAngles(pickedElement);
…
The following is the output for the same wall:
As can be seen, the radius is reported exactly as the 8 feet. Angles are apparently in radians. Let us turn them into degree values which are visual friendly:
In Degree:
Start Angle: 155.50
Angle Range: 160
End Angle: 315.50
Hey, what is going on? The angle range is correctly reported as 160 degree, but the start angle and end angle have some weird values.
It is mysterious.
Their difference is 160 degree though in this case as the angle range specifies. But wait a moment; it is not always true. May these angles depend on the north direction settings? It’s found not really so through some experiments.
RevitAddinWizard and it various coders make developers’ life much easier.
Recent Comments