Setting rebar container dimensions in Dynamo (Dynamo for Rebar)

You can make any rebar shape you like with the Rebar.CreateFromCurves method in the API

import clr

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

clr.AddReference("System")
from System.Collections.Generic import List

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

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

doc = DocumentManager.Instance.CurrentDBDocument

def hookOrient(dir):
	if dir=="Right":
		return RebarHookOrientation.Right
	elif dir=="Left":
		return RebarHookOrientation.Left
	else: return "Wrong input"

#Converting input from Dynamo to Revit
style = RebarStyle.Standard
barType = UnwrapElement(IN[0])
startHook = IN[1]
endHook = UnwrapElement(IN[2])
host = UnwrapElement(IN[3])
norm = IN[4].ToXyz()
curves=List[Curve]([c.ToRevitType(True) for c in IN[5]])
startHookOrient = hookOrient(IN[6])
endHookOrient = hookOrient(IN[7])
useExistingShapeIfPossible = 1
createNewShape = 0

#create rebar in  transaction
TransactionManager.Instance.EnsureInTransaction(doc)

rebar = Rebar.CreateFromCurves(doc,style,barType,startHook,endHook,host,norm,curves,startHookOrient,endHookOrient,useExistingShapeIfPossible,createNewShape)
TransactionManager.Instance.TransactionTaskDone()

#Wrapping rebar object, if set to True a new rebar element will be created each time
OUT = rebar.ToDSType(False)

To answer the hook length question: You can access the hook extension multiplier like this:

or you could look at the SetHookLength method in Revit API: http://revitapisearch.com/html/d8a83bf6-d0ad-4bb2-d5b2-c7b026a4d4de.htm

1 Like