Hi all,
I still have some ambiguities and haven’t yet developed a consistent understanding of the RebarHookOrientation
rule. There’s something that keeps tripping me up and preventing me from fully grasping the logic behind RebarHookOrientation
.
In the example below, I tried to understand the hook orientation logic from the rebar shape “23” by exploring different cases: first, I edited the shape by reversing its direction; then I reversed its hooks; and finally, I attempted to recreate the original shape “23” by using the standard shape “00” and by applying the same parameters. However, I wasn’t able to reproduce it successfully, which has left me even more confused!?
here my used code:
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
top_bar_type = UnwrapElement(IN[0])
hook_type = UnwrapElement(IN[1])
cover = 0.05/0.3048
# Collect beams
all_beams = FilteredElementCollector(doc)\
.OfCategory(BuiltInCategory.OST_StructuralFraming)\
.WhereElementIsNotElementType()\
.ToElements()
beam = all_beams[0]
curve = beam.Location.Curve
top_curve = Line.CreateBound(curve.GetEndPoint(1), curve.GetEndPoint(0))
width = beam.Symbol.LookupParameter("b").AsDouble()
top_curve = top_curve.CreateTransformed(Transform.CreateTranslation(XYZ.BasisY.Multiply(width/2 - cover)))
with Transaction(doc, "create rebars") as t:
t.Start()
top_rebar_curv = List[Curve]()
top_rebar_curv.Add(top_curve)
top_rebar = Rebar.CreateFromCurves(
doc, RebarStyle.Standard,
top_bar_type, hook_type, hook_type,
beam, XYZ(0,-1,0), top_rebar_curv,
RebarHookOrientation.Left, RebarHookOrientation.Right,
True, True
)
top_rebar.GetShapeDrivenAccessor().SetLayoutAsFixedNumber(3, width-2*cover, True, True, True)
t.Commit()
OUT = top_rebar, top_curve.ToProtoType()
Any further details or explanations that could help solidify my understanding would be greatly appreciated.
Thanks.