Beam's wrong rebar Hook orientation

Beam's wrong rebar Hook orientation

REDO10
Collaborator Collaborator
2,165 Views
12 Replies
Message 1 of 13

Beam's wrong rebar Hook orientation

REDO10
Collaborator
Collaborator

Hi everyone,

I tried to create beam’s rebar using Revit API, but I get Hook orientation opposed only when shoosing 90° value!!?..can anyone explain me the reason for that?

Remark: I'm working with Python and Dynamo

 

Hook.png

Here my graph:

 

rebar_test.png

Check my code please:

 

 

import sys
import clr
import math
from System.Collections.Generic import IList, List

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

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

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

doc = DocumentManager.Instance.CurrentDBDocument

curve = IN[0].ToRevitType()
bar_type = UnwrapElement(IN[1])
ber_Hook_type = UnwrapElement(IN[6])
host = UnwrapElement(IN[3])
vect = IN[2].ToRevitType()
beam_width = IN[4].ToRevitType()
width = beam_width.Length
cover = IN[5]/0.3048
spacing = 0.10/0.3048

curv = List[Curve]()
curv.Add(curve)
TransactionManager.Instance.EnsureInTransaction(doc)
rebar = Rebar.CreateFromCurves(doc, RebarStyle.Standard, bar_type, ber_Hook_type, ber_Hook_type, host, vect, curv, RebarHookOrientation.Left, RebarHookOrientation.Right, True, False)
rebar.GetShapeDrivenAccessor().SetLayoutAsFixedNumber(math.ceil((width-2*cover)/spacing), width-2*cover, True, True, True)
TransactionManager.Instance.TransactionTaskDone()

OUT= rebar

 

 

Could anyone help me ?

 

Thanks.

Accepted solutions (1)
2,166 Views
12 Replies
Replies (12)
Message 2 of 13

jayhar
Advisor
Advisor

The reason why you are getting Hook orientation opposed only when choosing a 90° value is because of the way that the `RebarHookOrientation` enumeration is defined in the Revit API.

In Revit, a rebar can have hooks on both ends or on one end only. The `RebarHookOrientation` enumeration is used to specify the orientation of the hooks. For example, `RebarHookOrientation.Left` means that the hook is oriented towards the left end of the rebar, and `RebarHookOrientation.Right` means that the hook is oriented towards the right end of the rebar.

However, when using the `RebarHookOrientation.Angle` option, the hook is oriented relative to the direction of the rebar. If the angle value is less than 90 degrees, the hook is oriented towards the left end of the rebar. If the angle value is greater than 90 degrees, the hook is oriented towards the right end of the rebar.

So, if you want the hook to be oriented towards the left end of the rebar, you should use an angle value less than 90 degrees. If you want the hook to be oriented towards the right end of the rebar, you should use an angle value greater than 90 degrees.

Thanks and Regards

Jayhar M J 

Please Subscribe YouTube Channel
https://www.youtube.com/channel/UCclj8v9vHQiFa8_DriuAk3w

Please Mark the Post or Posts as Solution(s) to help others find the answer quickly.
Message 3 of 13

REDO10
Collaborator
Collaborator

Hello @jayhar ,

Thanks for your explanation!!

I understand the premis of RebarHookOrientation (left or rigth) and RebarHookOrientation.Angle and their uses in the code...speaking of your explanation is there an orientation conflicting when a 90° Hook is choosen for the two rebar ends?

 

By the way, I asked the same question here  (dynamobim forum) and this issue happens solely in my case,  so what exactely is the reason behaind this?

 

Thanks.

 

 

0 Likes
Message 4 of 13

REDO10
Collaborator
Collaborator

Hello @jayhar ,

Thanks for your explanation!!

I understand the premis of RebarHookOrientation (left or rigth) and RebarHookOrientation.Angle and their uses in the code...speaking of your explanation is there an orientation conflicting when a 90° Hook is choosen for the two rebar ends?

 

By the way, I asked the same question here  (dynamobim forum) and this issue happens solely in my case,  so what exactely is the reason behaind this?

 

Thanks.

0 Likes
Message 5 of 13

REDO10
Collaborator
Collaborator

Hello @Organon  @RPTHOMAS108 

 

Have you any idea how to fix this issue?

 

Thanks.

0 Likes
Message 6 of 13

Organon
Advisor
Advisor

@REDO10,

 

Sometimes the problem is specifically related to Revit families. Try to use the beam that I attach, it is from Revit 2021.

 

Regards,


Arquitectura | Análisis CAD & BIM | Diseño Paramétrico | Programación
BIM-METADATA | LinkedIn | YouTube
Message 7 of 13

REDO10
Collaborator
Collaborator

@Organon 

Thanks for the shared family

 

I tested it but I still have the same issue (this issue irritates me and I dont understand why it's happen solely for me 😡)...have you take a look at my thread in dynamobim forum that  I linked above ?...I’m down and I don’t know how to solve this issue!!

 

Thanks.

0 Likes
Message 8 of 13

Organon
Advisor
Advisor

@REDO10,

 

You have to set both hooks to the right.


Arquitectura | Análisis CAD & BIM | Diseño Paramétrico | Programación
BIM-METADATA | LinkedIn | YouTube
Message 9 of 13

REDO10
Collaborator
Collaborator

@Organon 

 


@Organon wrote:

You have to set both hooks to the right.


I've set both hooks to the right then to the left then I reversed between the right and the left for the Hook start and the end and nothing happens !!?? (I'm stuck in an endless loop and I'm sick off it!! ......this is not due to an issue I have in either Dynamo  or Revit settings?)

 

Thanks.

0 Likes
Message 10 of 13

REDO10
Collaborator
Collaborator

@Organon 

 

As I’m not yet mastering Revit API, and for a temporary solution, can you please   put in my script above a condititional “IF” that’s check hook direction and reverse it if it’s wrong?

 

Thanks.

0 Likes
Message 11 of 13

Organon
Advisor
Advisor

@REDO10,

 

I've created a RVT22 new project, loaded the family I attached, tested your script(booth hooks to the right) and it works fine.

 

I think your are sick of it because you're trying to do something that is too advanced to you at this point of your learning. Start with easy things first.


Arquitectura | Análisis CAD & BIM | Diseño Paramétrico | Programación
BIM-METADATA | LinkedIn | YouTube
Message 12 of 13

REDO10
Collaborator
Collaborator

@Organon 


@Organon wrote:

I think your are sick of it because you're trying to do something that is too advanced to you at this point of your learning. Start with easy things first.


I try to do things as simply as possible and I dont know where is the problem (by chance it only worked once and then it doesn’t work anymore!!??)...see what I'm doing here and judge yourself

 

Ps: when I selected the 3rd beam (rotated beam )as shown above and executed the script I get the following error (is that related to the rebar or Hook orientation?):

 

internal_error.png

 

Thanks.

0 Likes
Message 13 of 13

REDO10
Collaborator
Collaborator
Accepted solution

Hi everyone,

My issue is solved just by doing the same thing on this particular one Set rebar circular distribution path and fix wrong hook orientation 

 

beam.png

Thanks.