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?
I managed to get around the .NET List casting of the curves problem but I am still getting the following warning:
“Warning: TypeError : No method matches given arguments for CreateFromCurves: (<class ‘Autodesk.Revit.DB.Document’>, <class ‘int’>, <class ‘Autodesk.Revit.DB.Structure.RebarHookType’>, <class ‘Autodesk.Revit.DB.Structure.RebarHookType’>, <class ‘Autodesk.Revit.DB.FamilyInstance’>, <class ‘Autodesk.Revit.DB.XYZ’>, <class ‘System.Collections.Generic.0, Culture=neutral, PublicKeyToken=null]]’>, <class ‘str’>, <class ‘str’>, <class ‘str’>, <class ‘bool’>, <class ‘bool’>) [’ File “”, line 40, in \n’]”
Any ideas? I know for sure that the method reads some of the objects in it since I just corrected something at the hookType stage…
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 = [curve.ToRevitType() for curve in IN[0]]
rebarStyle = IN[1]
rebarType = UnwrapElement(IN[2])
hookType = UnwrapElement(IN[3])
hookOrientation = IN[4]
host = UnwrapElement(IN[5])
vector = IN[6][0].ToXyz()
DBcurves = List[Curve](curves)
#Do some action in a Transaction
TransactionManager.Instance.EnsureInTransaction(doc)
newRebar = Rebar.CreateFromCurves(doc, RebarStyle.StirrupTie, hookType, hookType, host, vector, DBcurves, hookOrientation, hookOrientation, hookOrientation, True, True)
TransactionManager.Instance.TransactionTaskDone()
OUT = newRebar
I must have mist that throughout the times I tried to get it right. I corrected that mistake and have the twelve suiting inputs and I am still receiving the same warning:
“Warning: TypeError : No method matches given arguments for CreateFromCurves: (<class ‘Autodesk.Revit.DB.Document’>, <class ‘int’>, <class ‘Revit.Elements.ElementType’>, <class ‘Autodesk.Revit.DB.Structure.RebarHookType’>, <class ‘Autodesk.Revit.DB.Structure.RebarHookType’>, <class ‘Autodesk.Revit.DB.FamilyInstance’>, <class ‘Autodesk.Revit.DB.XYZ’>, <class ‘System.Collections.Generic.0, Culture=neutral, PublicKeyToken=null]]’>, <class ‘str’>, <class ‘str’>, <class ‘bool’>, <class ‘bool’>) [’ File “”, line 40, in \n’]”
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 = [curve.ToRevitType() for curve in IN[0][0]]
rebarStyle = UnwrapElement(IN[1])
rebarType = UnwrapElement(IN[2])
hookType = UnwrapElement(IN[3])
hookOrientation = UnwrapElement(IN[4])
host = UnwrapElement(IN[5])
vector = IN[6][0].ToXyz()
DBCurves = List[Curve](curves)
#Do some action in a Transaction
TransactionManager.Instance.EnsureInTransaction(doc)
newRebar = Rebar.CreateFromCurves(doc, RebarStyle.StirrupTie, rebarType, hookType, hookType, host, vector, DBCurves, hookOrientation, hookOrientation, True, True)
#TransactionManager.Instance.TransactionTaskDone()
OUT = newRebar
This is the first time I’m getting this error… It is happening also with the python 2 and python 3.
Is it still possible to create a rebar using the CreateFromCurves method?
If you’ll look at my code, you’ll see that in the method CreateFromCurve the input is RebarStyle.StirrupTie and its still not working… I have know idea what to do to make it work…