Namespace:
Autodesk.Revit.DB.Structure
Rebar
Class
Description:
Represents a rebar element in Autodesk Revit.
Represents a rebar element in Autodesk Revit.
Examples
private void Getinfo_Rebar(Rebar rebar)
{
string message = "Rebar: ";
//get the bar type of the rebar
message += "\nBar Type: " + (rebar.Document.GetElement(rebar.GetTypeId()) as RebarBarType).Name;
//get the curve information
IList<Curve> curves = rebar.GetCenterlineCurves(false, false, false, MultiplanarOption.IncludeOnlyPlanarCurves, 0);
message += "\n\nThe Curves property has " + curves.Count + " curves:";
foreach (Curve curve in curves)
{
// Get curve start point
message += "\nCurve start point:(" + curve.GetEndPoint(0).X + ", "
+ curve.GetEndPoint(0).Y + ", " + curve.GetEndPoint(0).Z + ")";
// Get curve end point
message += "; Curve end point:(" + curve.GetEndPoint(1).X + ", "
+ curve.GetEndPoint(1).Y + ", " + curve.GetEndPoint(1).Z + ")";
}
//get the host element of the rebar
if (null != rebar.Document.GetElement(rebar.GetHostId())) //maybe some rebars don't have host
{
message += "\n\nThe host element ID : " + rebar.GetHostId().ToString();
}
TaskDialog.Show("Revit", message);
}