Hello there,
Finally got it working although not using the override method in python since for some reason it doesn’t seem to work I suspect this happens because of the last parameter in the function, the RebarFreeFormValidationResult, since that parameter should be an output, it seems the python compiler gets confused and can’t find the method signature. So the way I found around it, was to access the api call in .NET. and wrap it in a function. you can find how to develop .dlls for dynamo here: Become a Dynamo Zero Touch C# Node Developer in 75 Minutes
This is how it looks in c#:
public class Carcass
{
public static Autodesk.Revit.DB.Structure.Rebar AccessToMethodOverload(Autodesk.Revit.DB.Document doc, RebarBarType bartype, Autodesk.Revit.DB.Element host, List<CurveLoop> curves)
{
Rebar rebar = Rebar.CreateFreeForm(doc, bartype, host, (IList<CurveLoop>)curves, out RebarFreeFormValidationResult error);
return rebar;
}
}
you can call the function afterwards in IronPython: do not forget to reference your .dll file in dynamo.
The transaction management can be handled in the python script:
clr.AddReference('Carcass')
from Carcass import Carcass
doc=DocumentManager.Instance.CurrentDBDocument
TransactionManager.Instance.EnsureInTransaction(doc)
#define function args here
reb=Carcass.AccessToMethodOverload(doc,bartype,host,curves)
TransactionManager.Instance.TransactionTaskDone()
Hope this helps.