private RebarHookOrientation GetTopHookOrient(RebarGeometry geomInfo, TopRebarLocation location)
{
// Top center rebar doesn't need hook.
if (TopRebarLocation.Center == location)
{
throw new Exception("Center top rebar doesn't have any hook.");
}
// Get the hook direction, rebar normal and rebar line
Autodesk.Revit.DB.XYZ hookVec = m_geometry.GetDownDirection();
Autodesk.Revit.DB.XYZ normal = geomInfo.Normal;
Line rebarLine = geomInfo.Curves[0] as Line;
// get the top start hook orient
if (TopRebarLocation.Start == location)
{
Autodesk.Revit.DB.XYZ curveVec = GeomUtil.SubXYZ(rebarLine.get_EndPoint(1), rebarLine.get_EndPoint(0));
return GeomUtil.GetHookOrient(curveVec, normal, hookVec);
}
else // get the top end hook orient
{
Autodesk.Revit.DB.XYZ curveVec = GeomUtil.SubXYZ(rebarLine.get_EndPoint(0), rebarLine.get_EndPoint(1));
return GeomUtil.GetHookOrient(curveVec, normal, hookVec);
}
}