Thanks for the links and replies.
The hook orientation of the selected multiple reinforcing bars is entered in the reinforcing bar hook orientation.
The value right is retrieved.
Detailed code.
foreach (Rebar item in els)
{
ElementId elid = item.GetHostId();
var rebarinstans = item.LookupParameter("a");
Element element1 = doc.GetElement(elid);
RebarShape shape = doc.GetElement(item.GetShapeId()) as RebarShape;
RebarStyle style1 = shape.RebarStyle;
int i1 = item.NumberOfBarPositions;
RebarHookType startHook = doc.GetElement(item.GetHookTypeId(0)) as RebarHookType;
RebarHookType endHook = doc.GetElement(item.GetHookTypeId(1)) as RebarHookType;
RebarBendData bendData = item.GetBendData();
RebarHookOrientation orientation1 = bendData.HookOrient0;
RebarHookOrientation orientation2 = bendData.HookOrient1;
double hookdouble = rebarinstans.AsDouble();
double barlength = hookdouble;
XYZ Vec = null;
List<Curve> curves2 = new List<Curve>();
Rebar newRebar = null;
string name = doc.GetElement(item.GetTypeId()).Name;
RebarBarType type = Cmd_CreateRebar.rebarBarType(name, doc);
if (category.Id.IntegerValue == (int)BuiltInCategory.OST_StructuralFraming)
{
LocationCurve point = element1.Location as LocationCurve;
stpoint = point.Curve.GetEndPoint(0);
enpoint = point.Curve.GetEndPoint(1);
XYZ beamVec = enpoint - stpoint;
Curve curve = point.Curve;
Line li = Line.CreateBound(stpoint, enpoint);
curves2.Add(li);
}
for (int i = 0; i < i1; i++)
{
curves = item.GetTransformedCenterlineCurves(false, true, false, MultiplanarOption.IncludeOnlyPlanarCurves, i);
foreach (Curve c in curves)
{
startpoint = c.GetEndPoint(0);
endpoint = c.GetEndPoint(1);
direction = (endpoint - startpoint).Normalize();
Vec = new XYZ(direction.Y, direction.X, 0.0);
if (category.Id.IntegerValue == (int)BuiltInCategory.OST_StructuralFraming)
{
XYZ movepoint = (startpoint - stpoint);
newRebar = Rebar.CreateFromCurvesAndShape(doc,shape,type,startHook,endHook,element1,Vec,curves2,orientation1,orientation2);
ElementTransformUtils.MoveElement(doc, newRebar.Id, movepoint);
}