# Setting rebars hooks orientation for beams network

**URL:** <https://forum.dynamobim.com/t/setting-rebars-hooks-orientation-for-beams-network/111130>\
**Category:** Developers\
**Tags:** revit, python\
**Created:** [July 7, 2025, 12:07am UTC](https://forum.dynamobim.com/t/setting-rebars-hooks-orientation-for-beams-network/111130 "2025-07-07T00:07:50Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![REDO10](https://avatars.discourse-cdn.com/v4/letter/r/7cd45c/32.png) [@REDO10](https://forum.dynamobim.com/u/REDO10)\
**Post date:** [July 7, 2025, 12:07am UTC](https://forum.dynamobim.com/t/setting-rebars-hooks-orientation-for-beams-network/111130/1 "2025-07-07T00:07:50Z")

</div>

Hi all, @c.poupin , @Mike.Buttery , @christian.stan

To create rebars for an orthogonal beam network where each beam spans from end to end, I need to extract the `max_edge` from each beam by retrieving the full, uncut solid. Then, I use the `FaceNormal` of the face where the `max_edge` lies to set the rebar distribution layout. I was able to achieve this in my previous question [here](https://forum.dynamobim.com/t/beams-length-from-outer-faces/110311/19).

However, and more importantly, ever since I started working with rebars in the API, I’ve consistently faced issues correctly setting the `RebarHookOrientation` for rebar ends. I’m still confused and don’t fully understand Revit’s rules for determining these orientations.

To illustrate my issue, consider the beam network example in the image below (where the first beams are parallel to the **X axis** and oriented toward **+X** , and the last four beams are parallel to the **Y axis** and oriented toward **+Y** ).

When I run the code below, I get the expected hook orientations at the rebar ends for both `top_rebar` and `btm_rebar` on all beams except for **beam4** and **beam5** , where their `FaceNormal` is on the opposite face compared to the corresponding beams in the same direction, I tried all possible possible orientatons, and I’m struggling to find a solution to this issue?

 ![beam network](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/3/e/3e4d9249f6dc9653870edf9e80be8681493c2d7e.png)

Here my code:

> **beams network**
>
> ```python
> import clr
> import sys
> import System
> from System.Collections.Generic import IList, List
> 
> clr.AddReference('ProtoGeometry')
> from Autodesk.DesignScript.Geometry import *
> 
> clr.AddReference('RevitAPI')
> from Autodesk.Revit.DB import *
> from Autodesk.Revit.DB.Structure import *
> 
> clr.AddReference('RevitNodes')
> import Revit
> clr.ImportExtensions(Revit.GeometryConversion)
> 
> clr.AddReference('RevitServices')
> from RevitServices.Persistence import DocumentManager
> from RevitServices.Transactions import TransactionManager
> 
> doc = DocumentManager.Instance.CurrentDBDocument
> 
> # Inputs from Dynamo
> top_bar_type = UnwrapElement(IN[0])
> btm_bar_type = UnwrapElement(IN[1])
> hook_type = UnwrapElement(IN[2])
> 
> def get_solid(beam):
> options = Options()
> options.IncludeNonVisibleObjects = False
> options.DetailLevel = ViewDetailLevel.Fine
> geoElement = beam.get_Geometry(options)
> return next((g for g in geoElement if isinstance(g, Solid) and g.Volume > 0), None)
> 
> def get_side_face_normal(solid, edge):
> for face in solid.Faces:
> if edge in [e for loop in face.EdgeLoops for e in loop]:
> normal = face.FaceNormal
> if not (normal.IsAlmostEqualTo(XYZ.BasisZ) or normal.IsAlmostEqualTo(-XYZ.BasisZ)):
> return normal
> return None
> 
> def curve_multiply_offset(curve, vector, distance, cover):
> curve = curve.CreateTransformed(Transform.CreateTranslation(XYZ(0, 0, -1).Multiply(cover)))
> vertical_offset = distance - 2 * cover
> 
> trans = Transform.CreateTranslation(vector.Negate().Multiply(cover))
> top_curve = curve.CreateTransformed(trans)
> bottom_trans = Transform.CreateTranslation(XYZ(0, 0, -1).Multiply(vertical_offset))        
> btm_curve = top_curve.CreateTransformed(bottom_trans)
> btm_curve = Line.CreateBound(btm_curve.GetEndPoint(1), btm_curve.GetEndPoint(0))
> return top_curve, btm_curve 
> 
> def get_intersecting_end_beams(single_beam, all_beams, tolerance=0.001):
> loc_curve = single_beam.Location.Curve
> w = single_beam.Symbol.LookupParameter("b").AsDouble()
> h = single_beam.Symbol.LookupParameter("h").AsDouble()
> start = loc_curve.GetEndPoint(0)
> end = loc_curve.GetEndPoint(1)
> 
> w_start = None
> w_end = None
> 
> for beam in all_beams:
> if beam.Id == single_beam.Id:
> continue
> other_curve = beam.Location.Curve
> b = beam.Symbol.LookupParameter("b").AsDouble()
> 
> projected_start = other_curve.Project(start)
> if projected_start and projected_start.Distance < tolerance and w_start is None:
> w_start = b / 2
> 
> projected_end = other_curve.Project(end)
> if projected_end and projected_end.Distance < tolerance and w_end is None:
> w_end = b / 2
> 
> return {
> "beam_width": w,
> "beam_height": h,
> "width_start": w_start,
> "width_end": w_end
> }
> 
> def get_corrected_beam_length(beam, all_beams):
> beam_curve = beam.Location.Curve
> direction = beam_curve.Direction
> beam_length = beam_curve.Length
> start = beam_curve.GetEndPoint(0)
> 
> cut_elems = [doc.GetElement(xId) for xId in SolidSolidCutUtils.GetCuttingSolids(beam)]
> for e in cut_elems:
> JoinGeometryUtils.SwitchJoinOrder(doc, beam, e)
> doc.Regenerate()
> 
> solid = get_solid(beam)
> if not solid:
> return None
> 
> max_edge = max(solid.Edges, key=lambda x: x.ApproximateLength)
> max_edge_curve = max_edge.AsCurve()
> max_edge_direction = max_edge_curve.Direction
> max_edge_length = max_edge_curve.Length
> face_normal = get_side_face_normal(solid, max_edge)
> if face_normal is None:
> return None
>     
> intersection_data = get_intersecting_end_beams(beam, all_beams)
> beam_width = intersection_data["beam_width"]
> beam_height = intersection_data["beam_height"]
> cover = 0.05 / 0.3048
> w_start = intersection_data["width_start"] or 0
> w_end = intersection_data["width_end"] or 0
>     
> if max_edge_length > beam_length:
> if not max_edge_direction.IsAlmostEqualTo(direction):
> max_edge_curve = Line.CreateBound(max_edge_curve.GetEndPoint(1), max_edge_curve.GetEndPoint(0))
> new_start = max_edge_curve.Evaluate(cover / max_edge_length, True)
> new_end = max_edge_curve.Evaluate(1 - (cover / max_edge_length), True)
> new_line = Line.CreateBound(new_start, new_end)
>         
>         
> else:
> total_length = beam_length + w_start + w_end - 2 * cover
> project_point = start + face_normal.Multiply(beam_width / 2)
> new_start = project_point - direction.Multiply(w_start - cover)
> new_end = new_start + direction.Multiply(total_length)
> new_line = Line.CreateBound(new_start, new_end)
>         
> 
> top_curve, btm_curve = curve_multiply_offset(new_line, face_normal, beam_height, cover)
> print(direction)
> print(top_curve.Direction)
> print(btm_curve.Direction)    
> return btm_curve, top_curve, face_normal
> 
> # Collect beams
> all_beams = FilteredElementCollector(doc)\
> .OfCategory(BuiltInCategory.OST_StructuralFraming)\
> .WhereElementIsNotElementType()\
> .ToElements()
> 
> beams = [
> b for b in all_beams
> if b.LookupParameter("Utilisation structurelle") and
> b.LookupParameter("Utilisation structurelle").AsValueString() == "Longeron"
> ]
> 
> with Transaction(doc, "create rebars") as t:
> t.Start()
> curves = []
> rebars = []
> cover = 0.05 / 0.3048
> for beam in beams:
> direction = beam.Location.Curve.Direction
> width = beam.Symbol.LookupParameter("b").AsDouble()
> result = get_corrected_beam_length(beam, beams)
> if not result:
> continue
> top_curve, btm_curve, normal_vect = result
>         
> if normal_vect.CrossProduct(direction).IsAlmostEqualTo(XYZ(0,0,-1)):
> normT = top_curve.Direction.CrossProduct(XYZ.BasisZ).Negate()
> normB = top_curve.Direction.CrossProduct(XYZ.BasisZ).Negate()
> 	        
> else:
> normT = top_curve.Direction.CrossProduct(XYZ.BasisZ)
> normB = top_curve.Direction.CrossProduct(XYZ.BasisZ)            
> top_curve_list = List[Curve]()
> btm_curve_list = List[Curve]()
> top_curve_list.Add(top_curve)
> btm_curve_list.Add(btm_curve)
>         
> top_rebar = Rebar.CreateFromCurves(
> doc, RebarStyle.Standard,
> top_bar_type, hook_type, hook_type,
> beam, normT, top_curve_list,
> RebarHookOrientation.Left, RebarHookOrientation.Left,
> True, True
> )
> top_rebar.GetShapeDrivenAccessor().SetLayoutAsFixedNumber(3, width-2*cover, True, True, True)
> btm_rebar = Rebar.CreateFromCurves(
> doc, RebarStyle.Standard,
> btm_bar_type, hook_type, hook_type,
> beam, normB, btm_curve_list,
> RebarHookOrientation.Left, RebarHookOrientation.Left,
> True, True
> )
> btm_rebar.GetShapeDrivenAccessor().SetLayoutAsFixedNumber(3, width-2*cover, True, True, True)
> 
> rebars.append([top_rebar, btm_rebar])
> curves.append([top_curve.ToProtoType(), btm_curve.ToProtoType()])
> t.Commit()
> 
> OUT = rebars
> 
> ```

Any help would be apreciated

Thanks.

---

<div class="post-metadata">

**Author:** ![REDO10](https://avatars.discourse-cdn.com/v4/letter/r/7cd45c/32.png) [@REDO10](https://forum.dynamobim.com/u/REDO10)\
**Post date:** [July 8, 2025, 7:56am UTC](https://forum.dynamobim.com/t/setting-rebars-hooks-orientation-for-beams-network/111130/2 "2025-07-08T07:56:52Z")

</div>

No one can help me?

---

<div class="post-metadata">

**Author:** ![jacob.small](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/jacob.small/32/161030_2.png) [@jacob.small](https://forum.dynamobim.com/u/jacob.small)\
**Post date:** [July 8, 2025, 8:54am UTC](https://forum.dynamobim.com/t/setting-rebars-hooks-orientation-for-beams-network/111130/3 "2025-07-08T08:54:52Z")

</div>

Do beams 4 and 5 run a different direction than the others? i.e. do most beams run southwest to northeast, but these two run the opposite direction?

---

<div class="post-metadata">

**Author:** ![REDO10](https://avatars.discourse-cdn.com/v4/letter/r/7cd45c/32.png) [@REDO10](https://forum.dynamobim.com/u/REDO10)\
**Post date:** [July 8, 2025, 9:19am UTC](https://forum.dynamobim.com/t/setting-rebars-hooks-orientation-for-beams-network/111130/4 "2025-07-08T09:19:07Z")

</div>

- beams parallel to **X axis** which are (beam1, beam2, beam3, beam4) goes from **west** to **east** (i.e their directions points to **+X** ), picked `FaceNormal` from beam1, beam2 and beam3 points toward **south** ( **-Y** ), In opposit to other beams picked `FaceNormal` from beam4 points toward **North** ( **+Y** )
- beams parallel to **Y axis** which are (beam5, beam6, beam7, beam8) goes from **south** to **north** (i.e their directions points to **+Y** ), picked `FaceNormal` from beam5 points toward **west** ( **-X** ), in opposit `FaceNormal` from other beams points toward **east** ( **+X** )

Thanks.

---

<div class="post-metadata">

**Author:** ![jacob.small](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/jacob.small/32/161030_2.png) [@jacob.small](https://forum.dynamobim.com/u/jacob.small)\
**Post date:** [July 8, 2025, 9:31am UTC](https://forum.dynamobim.com/t/setting-rebars-hooks-orientation-for-beams-network/111130/5 "2025-07-08T09:31:12Z")

</div>

So the two beams which have directions that are opposite are getting the hooks going the opposite way?

---

<div class="post-metadata">

**Author:** ![REDO10](https://avatars.discourse-cdn.com/v4/letter/r/7cd45c/32.png) [@REDO10](https://forum.dynamobim.com/u/REDO10)\
**Post date:** [July 8, 2025, 9:39am UTC](https://forum.dynamobim.com/t/setting-rebars-hooks-orientation-for-beams-network/111130/6 "2025-07-08T09:39:22Z")

</div>

> [@jacob.small](#):
>
> So the two beams which have directions that are opposite are getting the hooks going the opposite way?

Yes, that’s exactly what’s happening.

---

<div class="post-metadata">

**Author:** ![jacob.small](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/jacob.small/32/161030_2.png) [@jacob.small](https://forum.dynamobim.com/u/jacob.small)\
**Post date:** [July 8, 2025, 9:50am UTC](https://forum.dynamobim.com/t/setting-rebars-hooks-orientation-for-beams-network/111130/7 "2025-07-08T09:50:13Z")

</div>

Try reversing the curves for those two beams before you make the rebar/hooks.

---

<div class="post-metadata">

**Author:** ![REDO10](https://avatars.discourse-cdn.com/v4/letter/r/7cd45c/32.png) [@REDO10](https://forum.dynamobim.com/u/REDO10)\
**Post date:** [July 8, 2025, 7:29pm UTC](https://forum.dynamobim.com/t/setting-rebars-hooks-orientation-for-beams-network/111130/8 "2025-07-08T19:29:52Z")

</div>

@jacob.small

here the outputed curves directions for each beam and I can’t see how can I reverse curves for beams having wrong hooks without reversing their `FaceNormal`, so in this case generated rebars are outside their host?

 ![hooks](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/b/2/b200ebc9b7ab5d06a7903f025b3bb70ce89f07dc.png)

---

<div class="post-metadata">

**Author:** ![jacob.small](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/jacob.small/32/161030_2.png) [@jacob.small](https://forum.dynamobim.com/u/jacob.small)\
**Post date:** [July 8, 2025, 9:16pm UTC](https://forum.dynamobim.com/t/setting-rebars-hooks-orientation-for-beams-network/111130/9 "2025-07-08T21:16:53Z")

</div>

Hmmm… so the direction of the X beams and Y beams is consistent after all…

Can you provide a sample model and your current graph?

---

<div class="post-metadata">

**Author:** ![REDO10](https://avatars.discourse-cdn.com/v4/letter/r/7cd45c/32.png) [@REDO10](https://forum.dynamobim.com/u/REDO10)\
**Post date:** [July 8, 2025, 10:30pm UTC](https://forum.dynamobim.com/t/setting-rebars-hooks-orientation-for-beams-network/111130/10 "2025-07-08T22:30:40Z")

</div>

@jacob.small

Please check my attached model and dyn file

[beams\_network.rvt](https://forum.dynamobim.com/uploads/short-url/irrk0YQ3kdt57f3Sxgzwr3fvdID.rvt) (2.1 MB)  
[beams\_network-rebars.dyn](https://forum.dynamobim.com/uploads/short-url/yZDzGTCQzZlJxYqaG98IMQsMTlv.dyn) (16.1 KB)

**Note:** I’m using Revit 2023 and Structural Design package for rebars

Thanks.

---

<div class="post-metadata">

**Author:** ![Mike.Buttery](https://avatars.discourse-cdn.com/v4/letter/m/b19c9b/32.png) [@Mike.Buttery](https://forum.dynamobim.com/u/Mike.Buttery)\
**Post date:** [July 9, 2025, 9:54am UTC](https://forum.dynamobim.com/t/setting-rebars-hooks-orientation-for-beams-network/111130/11 "2025-07-09T09:54:33Z")

</div>

The dyn python code will not work with non-French Revit

I would suggest using language independent BuiltInParameters and Enums

```auto
# Collect beams
all_beams = (
    FilteredElementCollector(doc)
    .OfCategory(BuiltInCategory.OST_StructuralFraming)
    .WhereElementIsNotElementType()
    .ToElements()
)

bip = BuiltInParameter.INSTANCE_STRUCT_USAGE_PARAM

beams = [
    b for b in all_beams
    if b.get_Parameter(bip).AsInteger() == int(StructuralInstanceUsage.Girder)
]

```

Or more efficiently with a `ParameterFilterRuleFactory`

```auto
# Collect beams
bip = BuiltInParameter.INSTANCE_STRUCT_USAGE_PARAM

pfrf = ParameterFilterRuleFactory.CreateEqualsRule(ElementId(bip), int(StructuralInstanceUsage.Girder))

epf = ElementParameterFilter(pfrf)

beams = (
    FilteredElementCollector(doc)
    .OfCategory(BuiltInCategory.OST_StructuralFraming)
    .WherePasses(epf)
    .ToElements()
)

```

---

<div class="post-metadata">

**Author:** ![c.poupin](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/c.poupin/32/89152_2.png) [@c.poupin](https://forum.dynamobim.com/u/c.poupin)\
**Post date:** [July 9, 2025, 3:12pm UTC](https://forum.dynamobim.com/t/setting-rebars-hooks-orientation-for-beams-network/111130/12 "2025-07-09T15:12:34Z")

</div>

not easy, not being a structural engineer, but this helped a little (even if I don’t understand everything).

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/c/2/c2b244d7c34e41758c36b9136f13e6f3ab2f796f.png)

> **[Help](https://help.autodesk.com/view/RVT/2026/ENU/?guid=b020c9d5-6026-b9fa-7e23-f6a7ec2cede3)**

here’s a fix, which you’ll have to check on several projects

```python
import clr
import sys
import System
from System.Collections.Generic import IList, List

clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *

clr.AddReference('RevitAPI')
import Autodesk.Revit.DB as DB
from Autodesk.Revit.DB import *
from Autodesk.Revit.DB.Structure import *

clr.AddReference('RevitNodes')
import Revit
clr.ImportExtensions(Revit.GeometryConversion)

clr.AddReference('RevitServices')
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager

doc = DocumentManager.Instance.CurrentDBDocument

clr.AddReference("System.Core")
clr.ImportExtensions(System.Linq)

# Inputs from Dynamo
top_bar_type = UnwrapElement(IN[0])
btm_bar_type = UnwrapElement(IN[1])
hook_type = UnwrapElement(IN[2])

def get_solid(beam):
    options = Options()
    options.IncludeNonVisibleObjects = False
    options.DetailLevel = ViewDetailLevel.Fine
    geoElement = beam.get_Geometry(options)
    return next((g for g in geoElement if isinstance(g, Solid) and g.Volume > 0), None)

def get_side_face_normal(solid, edge):
    for face in solid.Faces:
        if edge in [e for loop in face.EdgeLoops for e in loop]:
            normal = face.FaceNormal
            if not (normal.IsAlmostEqualTo(XYZ.BasisZ) or normal.IsAlmostEqualTo(-XYZ.BasisZ)):
                return normal
    return None

def curve_multiply_offset(curve, vector, distance, cover):
    curve = curve.CreateTransformed(Transform.CreateTranslation(XYZ(0, 0, -1).Multiply(cover)))
    vertical_offset = distance - 2 * cover

    trans = Transform.CreateTranslation(vector.Negate().Multiply(cover))
    top_curve = curve.CreateTransformed(trans)
    bottom_trans = Transform.CreateTranslation(XYZ(0, 0, -1).Multiply(vertical_offset))        
    btm_curve = top_curve.CreateTransformed(bottom_trans)
    btm_curve = Line.CreateBound(btm_curve.GetEndPoint(1), btm_curve.GetEndPoint(0))
    return top_curve, btm_curve 

def get_intersecting_end_beams(single_beam, all_beams, tolerance=0.001):
    loc_curve = single_beam.Location.Curve
    w = single_beam.Symbol.LookupParameter("b").AsDouble()
    h = single_beam.Symbol.LookupParameter("h").AsDouble()
    start = loc_curve.GetEndPoint(0)
    end = loc_curve.GetEndPoint(1)

    w_start = None
    w_end = None

    for beam in all_beams:
        if beam.Id == single_beam.Id:
            continue
        other_curve = beam.Location.Curve
        b = beam.Symbol.LookupParameter("b").AsDouble()

        projected_start = other_curve.Project(start)
        if projected_start and projected_start.Distance < tolerance and w_start is None:
            w_start = b / 2

        projected_end = other_curve.Project(end)
        if projected_end and projected_end.Distance < tolerance and w_end is None:
            w_end = b / 2

    return {
        "beam_width": w,
        "beam_height": h,
        "width_start": w_start,
        "width_end": w_end
    }

def get_corrected_beam_length(beam, all_beams):
    beam_curve = beam.Location.Curve
    direction = beam_curve.Direction
    beam_length = beam_curve.Length
    start = beam_curve.GetEndPoint(0)

    cut_elems = [doc.GetElement(xId) for xId in SolidSolidCutUtils.GetCuttingSolids(beam)]
    for e in cut_elems:
        JoinGeometryUtils.SwitchJoinOrder(doc, beam, e)
    doc.Regenerate()

    solid = get_solid(beam)
    if not solid:
        return None

    max_edge = max(solid.Edges, key=lambda x: x.ApproximateLength)
    max_edge_curve = max_edge.AsCurve()
    max_edge_direction = max_edge_curve.Direction
    max_edge_length = max_edge_curve.Length
    face_normal = get_side_face_normal(solid, max_edge)
    if face_normal is None:
        return None
    
    intersection_data = get_intersecting_end_beams(beam, all_beams)
    beam_width = intersection_data["beam_width"]
    beam_height = intersection_data["beam_height"]
    cover = 0.05 / 0.3048
    w_start = intersection_data["width_start"] or 0
    w_end = intersection_data["width_end"] or 0
    
    if max_edge_length > beam_length:
        if not max_edge_direction.IsAlmostEqualTo(direction):
            max_edge_curve = Line.CreateBound(max_edge_curve.GetEndPoint(1), max_edge_curve.GetEndPoint(0))
        new_start = max_edge_curve.Evaluate(cover / max_edge_length, True)
        new_end = max_edge_curve.Evaluate(1 - (cover / max_edge_length), True)
        new_line = Line.CreateBound(new_start, new_end)
        
        
    else:
        total_length = beam_length + w_start + w_end - 2 * cover
        project_point = start + face_normal.Multiply(beam_width / 2)
        new_start = project_point - direction.Multiply(w_start - cover)
        new_end = new_start + direction.Multiply(total_length)
        new_line = Line.CreateBound(new_start, new_end)
        

    top_curve, btm_curve = curve_multiply_offset(new_line, face_normal, beam_height, cover)
    print("beam direction is: {}".format( direction))
    print("top curve direction is: {}".format(top_curve.Direction))
    print("bottom curve direction is: {}".format(btm_curve.Direction))   
    return btm_curve, top_curve, face_normal

# Collect beams
beams = FilteredElementCollector(doc)\
    .OfCategory(BuiltInCategory.OST_StructuralFraming)\
    .WhereElementIsNotElementType()\
    .Where(System.Func[DB.Element, System.Boolean](lambda b : b.StructuralUsage == StructuralInstanceUsage.Girder))\
    .ToList()

with Transaction(doc, "create rebars") as t:
    t.Start()
    curves = []
    rebars = []
    cover = 0.05 / 0.3048
    for beam in beams:
        direction = beam.Location.Curve.Direction
        width = beam.Symbol.LookupParameter("b").AsDouble()
        result = get_corrected_beam_length(beam, beams)
        if not result:
            continue
        top_curve, btm_curve, normal_vect = result
        
        if normal_vect.CrossProduct(direction).IsAlmostEqualTo(XYZ(0,0,-1)):
            normT = top_curve.Direction.CrossProduct(XYZ.BasisZ).Negate()
            normB = top_curve.Direction.CrossProduct(XYZ.BasisZ).Negate()
            rebarHook_orientation = RebarHookOrientation.Right
            
        else:
            normT = top_curve.Direction.CrossProduct(XYZ.BasisZ)
            normB = top_curve.Direction.CrossProduct(XYZ.BasisZ)            
            rebarHook_orientation = RebarHookOrientation.Left

        top_curve_list = List[Curve]()
        btm_curve_list = List[Curve]()
        top_curve_list.Add(top_curve)
        btm_curve_list.Add(btm_curve)
        
        top_rebar = Rebar.CreateFromCurves(
            doc, 
            RebarStyle.Standard,
            top_bar_type, 
            hook_type, 
            hook_type,
            beam, 
            normT, 
            top_curve_list,
            rebarHook_orientation, 
            rebarHook_orientation,
            True, True
        )
        top_rebar.GetShapeDrivenAccessor().SetLayoutAsFixedNumber(3, width-2*cover, True, True, True)
        btm_rebar = Rebar.CreateFromCurves(
            doc, 
            RebarStyle.Standard,
            btm_bar_type, 
            hook_type, 
            hook_type,
            beam, 
            normB,
            btm_curve_list,
            rebarHook_orientation, 
            rebarHook_orientation,
            True, True
        )
        btm_rebar.GetShapeDrivenAccessor().SetLayoutAsFixedNumber(3, width-2*cover, True, True, True)

        rebars.append([top_rebar, btm_rebar])
        curves.append([top_curve.ToProtoType(), btm_curve.ToProtoType()])
    t.Commit()

OUT = rebars

```

---

<div class="post-metadata">

**Author:** ![REDO10](https://avatars.discourse-cdn.com/v4/letter/r/7cd45c/32.png) [@REDO10](https://forum.dynamobim.com/u/REDO10)\
**Post date:** [July 10, 2025, 2:01pm UTC](https://forum.dynamobim.com/t/setting-rebars-hooks-orientation-for-beams-network/111130/13 "2025-07-10T14:01:39Z")

</div>

@c.poupin

> [@c.poupin](#):
>
> not easy, not being a structural engineer, but this helped a little (even if I don’t understand everything).
> 
> ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/c/2/c2b244d7c34e41758c36b9136f13e6f3ab2f796f.png)

From what I was able to understand, to get opposite hook orientations for `top_rebar` and `btm_rebar`, the directions of their respective curves, `top_curve` and `btm_curve`, must also be opposite. Additionally, the expected distribution layout should be _inside_ the beam.

I can follow the logic based on the bar direction (e.g., the `top_rebar` runs toward **+X** and **normal vector** points toward **-Y** that mean **XYZ(0,-1,0)**) then the orientation of the start hook (i.e., **End(0)**) will be **Right**. However, I can’t figure out why the end hook (i.e., **End(1)**) is also set to **Right**. In your code, you forced both hook orientations to **Right** , and in the opposite case, both are set to **Left**.  
Furthermore, in a similar case [here](https://forum.dynamobim.com/t/wrong-rebar-hook-orientation-revit-api/89094/31), you set the hook orientation to **Left/Right** for the same rebar. Why the difference?

Thanks.

---

<div class="post-metadata">

**Author:** ![REDO10](https://avatars.discourse-cdn.com/v4/letter/r/7cd45c/32.png) [@REDO10](https://forum.dynamobim.com/u/REDO10)\
**Post date:** [July 10, 2025, 2:53pm UTC](https://forum.dynamobim.com/t/setting-rebars-hooks-orientation-for-beams-network/111130/14 "2025-07-10T14:53:10Z")

</div>

> [@Mike.Buttery](#):
>
> The dyn python code will not work with non-French Revit
> 
> I would suggest using language independent BuiltInParameters and Enums

You’re absolutely right, I didn’t pay attention to that point

Thanks.
