I am trying to create a rebar from the revit api using RebarFromCurve method.
As I enter the RebarStyle as a StirrupTie (node from the Structural Design package) I recieve the following error: Warning: IronPythonEvaluator.EvaluateIronPythonScript operation failed.
Traceback (most recent call last):
File “”, line 40, in
TypeError: expected RebarStyle, got str
Thing is I am not entering a string…
Next I tried entering the element directly from the API - RebarStyle.StirrupTie but I still get the same warning.
import clr
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *
from Autodesk.Revit.DB.Structure import *
clr.AddReference('RevitAPIUI')
from Autodesk.Revit.UI 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
uidoc=DocumentManager.Instance.CurrentUIApplication.ActiveUIDocument
#Preparing input from dynamo to revit
curves = UnwrapElement(IN[0])
rebarStyle = UnwrapElement(IN[1])
rebarType = UnwrapElement(IN[2])
startHookType = UnwrapElement(IN[3])
endHookType = UnwrapElement(IN[3])
startHookOrientation = UnwrapElement(IN[4])
endHookOrientation = UnwrapElement(IN[4])
host = UnwrapElement(IN[5])
vector = UnwrapElement(IN[6])
#Do some action in a Transaction
TransactionManager.Instance.EnsureInTransaction(doc)
newRebar = Rebar.CreateFromCurves(doc,rebarStyle,RebarStyle.StirrupTie,startHookType,endHookType,host,vector,curves,startHookOrientation,endHookOrientation,True,True)
TransactionManager.Instance.TransactionTaskDone()
OUT = newRebar
Thanks for the reference but none of them refer to my issue. Plus, most of the examples don’t have any responses…
Btw I actually managed to get passed that, I changed the input to RebarStyle.StirrupTie and it works.
But I now have an issue that I am not managing to get passed with the following warning:
Warning: IronPythonEvaluator.EvaluateIronPythonScript operation failed.
Traceback (most recent call last):
File “”, line 40, in
TypeError: expected XYZ, got List[object]
I am changed the input to “vector = IN[6].ToXyz()” but I am still getting the message that “list object has no attribute to ToXyz”. Any reason why it would read the Vector object as a List object?
This is the message that I get when implementing this change:
Warning: AttributeError : ‘list’ object has no attribute ‘ToXyz’ [’ File “”, line 34, in \n’]
Don’t know why but it worked when I flatten the list. Weird thing is that I used the flatten list previously and it didn’t work then but now it is working…
But now pops up a different problem . I’ll just have to take care of that now.
I’ll update on further issues if I can’t solve them. Thanks!
So my next problem is with the code for the method “CreateFromCurves”, here is the warning that I get:
“Warning: TypeError : No method matches given arguments for CreateFromCurves: (<class ‘Autodesk.Revit.DB.Document’>, <class ‘int’>, <class ‘NoneType’>, <class ‘Autodesk.Revit.DB.Structure.RebarHookType’>, <class ‘Autodesk.Revit.DB.Structure.RebarHookType’>, <class ‘Autodesk.Revit.DB.FamilyInstance’>, <class ‘Autodesk.Revit.DB.XYZ’>, <class ‘str’>, <class ‘str’>, <class ‘list’>, <class ‘bool’>, <class ‘bool’>) [’ File “”, line 40, in \n’]”
Can it be that it doesn’t recognize the method or the inputs?
You forgot the list of curves in the arguments of your method. (which must be converted with “ToRevitType()” and cast it into an .Net List[Curve] Collection)
As you have changed Python engine, it would be wise to create a new topic
import clr
import sys
import System
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *
import Autodesk.DesignScript.Geometry as DS
#import Revit API
clr.AddReference('RevitAPI')
import Autodesk
from Autodesk.Revit.DB import *
import Autodesk.Revit.DB as DB
#import net library
from System.Collections.Generic import List
listDB_Curves = List[DB.Curve](myPythonlistOfCurves)