These are my code
import sys
import clr
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *
# Import Revit Services
clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *
import Autodesk.Revit.DB as DB
from Autodesk.Revit.DB import Curve as RCurve
from Autodesk.Revit.DB.Structure import *
clr.AddReference('RevitAPIUI')
from Autodesk.Revit.UI import *
clr.AddReference("RevitNodes")
import Revit
from Revit.Elements import *
clr.ImportExtensions(Revit.Elements)
clr.ImportExtensions(Revit.GeometryConversion)
import System
import System.Array
from System.Collections.Generic import *
#get the document
doc = DocumentManager.Instance.CurrentDBDocument
#Function
def str(x1, y1, b, h, cover, shape, type, host, shook2, ehook2, shook1, ehook1, orient):
nx1 = x1 - (b / 2) + cover
nx2 = x1 + (b / 2) - cover
ny1 = y1 - (h / 2) + cover
ny2 = y1 + (h / 2) - cover
nz1 = 0
count = 0
point_list = []
outLine = []
while (count < 1):
#Create Point
pt1 = XYZ(nx1, ny1, nz1).ToPoint()
pt2 = XYZ(nx2, ny1, nz1).ToPoint()
pt3 = XYZ(nx2, ny2, nz1).ToPoint()
pt4 = XYZ(nx1, ny2, nz1).ToPoint()
pt6 = XYZ(0, 0, 0)
#Create Point List
point_list.append(pt1)
point_list.append(pt2)
point_list.append(pt3)
point_list.append(pt4)
#Use Point List Create PolyCurves
polycurve1 = PolyCurve.ByPoints(point_list, True)
outLine.append(polycurve1)
#Make polycurve in form of curve
curve1 = PolyCurve.Curves(polycurve1)
#Start Transaction
TransactionManager.Instance.EnsureInTransaction(doc)
#Create Stirrup base on curves and shape
#Function : Rebar.CreateFromCurvesAndShape(Document, RebarShape, RebarBarType, RebarHookType (Start Hook), RebarHookType (End Hook), Element, XYZ (norm), IList<Curves>, RebarHookOrientation (Start), RebarHookOrientation (End))
stirrup1 = Rebar.CreateFromCurvesAndShape(doc, shape, type, shook2, ehook2, host, pt6, curve1, orient, orient)
stirrup_list.append(stirrup1)
#End
TransactionManager.Instance.TransactionTaskDone()
count = count + 1
return stirrup_list
pointx = IN[0]
pointy = IN[1]
width = IN[2]
height = IN[3]
covering = IN[4]
rebarshape = UnwrapElement(IN[5])
rebartype = UnwrapElement(IN[6])
element = UnwrapElement(IN[7])
vector = IN[8]
shooktwo = UnwrapElement(IN[9])
ehooktwo = UnwrapElement(IN[10])
shookone = UnwrapElement(IN[11])
ehookone = UnwrapElement(IN[12])
hooko = IN[13]
stirrup_list = []
result = str(pointx, pointy, width, height, covering, rebarshape, rebartype, element, shooktwo, ehooktwo, shookone, ehookone, hooko)
OUT = stirrup_list
I try to input “Hook Orientation” but get this kinda weird error say “TypeError: expected RebarHookOrientation, got RebarHookOrientation” which I dont understand since I input RebarHookOrientation already especially this parameter only accept two inputs are Right and Left but it show this error.