How do I get the curve orientation of an element using REVIT API?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I have tried this code, does not seem to work... can anyone please advice on how do I go abot in finding it?
using Autodesk.Revit.DB;
using Autodesk.Revit.UI;
public class ArcOrientation
{
public void GetArcOrientation(Document doc, ElementId arcElementId)
{
// Get the element by ID
Element element = doc.GetElement(arcElementId);
if (element is CurveElement curveElement)
{
// Get the curve from the curve element
Curve curve = curveElement.GeometryCurve;
if (curve is Arc arc)
{
// Get the orientation (rotation) of the arc
XYZ orientation = arc.Normal;
// Print or use the orientation information as needed
TaskDialog.Show("Arc Orientation", $"Arc element has orientation: {orientation}");
}
else
{
TaskDialog.Show("Arc Orientation", "Selected element is not an Arc.");
}
}
else
{
TaskDialog.Show("Arc Orientation", "Selected element is not a CurveElement.");
}
}
}