GetHookOrientation how to understand left right

GetHookOrientation how to understand left right

fen_zheng684E6
Explorer Explorer
236 Views
2 Replies
Message 1 of 3

GetHookOrientation how to understand left right

fen_zheng684E6
Explorer
Explorer

Hello, 

 

I have read the doc about GetHookOrientation  https://www.revitapidocs.com/2024/d61a0219-68d9-5faf-1809-f972ef4f8363.htm

 

However, my way of understanding is not consistent with test results:

 

GetHookOrientation.png

the texts in the image indicate the result of:

rebar.GetHookOrientation(0)

rebar.GetHookOrientation(1)

 

For me the results should be: 

M01 (right, left)

M03 (left, right)

M24  (right, right)

...

 

Could anyone help me ?

 

Thanks.

 

0 Likes
Accepted solutions (1)
237 Views
2 Replies
Replies (2)
Message 2 of 3

longt61
Advocate
Advocate
Accepted solution

The document might sound confusing at first due to the "stand at the start/end of the bar". If you ignore it, everything is pretty much clear.

1. The direction of the bar is fixed, it doesn't reverse whether you are "standing" or facing at the start or end of the bar.  It is always from start point to end point. To determine the direction, you can either edit the rebar family or try to turn off the hook at start of the rebar.

2. The normal is the normal vector of the plane where you place the rebar. You can determine this by changing the distribution rule of rebar from "Single" to any other rule, and the rebar will be "copied" and "place" from the original rebar till the end of host object according to the direction of normal vector.

3. The right vector is cross product of direction and normal vector, conform to the right hand rule. Now, any hook that turns to the direction of the right vector will be considered right-sided and vice versa.

 

With the explanation above, the method return the correct answer. I guess that you were confused by the "stand at the start/end of the bar" part that you interpreted it to "face the direction of the start/ end point". Therefore, it is easy to be tricked into thinking 'if I stand at the end, the bar direction is start - end, if I stand at the start, the bar direction is end- start. " Thus, it leads to your conclusion.

 

Hope this helps.

 

Untitled.png

Message 3 of 3

qoreodlf37
Enthusiast
Enthusiast

Start hook and end hook have own hook plane normal.

for example, a rebar created by CreateFreeForm can get hook normal by this code:

RebarFreeFormAccessor accessor = newRebar.GetFreeFormAccessor();
XYZ hookNormalStart = accessor.GetHookPlaneNormalForBarIdx(0, 0);
XYZ hookNormalEnd = accessor.GetHookPlaneNormalForBarIdx(1, 0);

 

The hook orientation is defined as left or right when looking along the rebar’s direction, standing in the direction of the hook normal.

 

I couldn’t find this in the documentation, but based on my testing, this seems to be the case.