My old python script does not work anymore in the new version of dynamo where it uses Cpython.
I have a script that added a dimension to selected grids and columns.
I get an error that I have to use “Autodesk.Revit.Creation.ItemFactoryBase.NewDimension”. I first had “doc.Create.NewDimension”. After I did that it says that no method matches give argument for NewDimension. What kind of input does it want, I checked the Revit API but that one hasn’t changed.
Do some of you have the same problem?
Is there a website that says how to write code in Cpython for dynamo?
Script
First Error:
Second Error (after change)
Script:
import clr
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *
from Autodesk.Revit.DB.Structure import *
clr.AddReference('RevitServices')
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
import Autodesk
doc = DocumentManager.Instance.CurrentDBDocument
uidoc=DocumentManager.Instance.CurrentUIApplication.ActiveUIDocument
references = UnwrapElement(IN[0])
line = UnwrapElement(IN[1])
elementlist = ReferenceArray()
dimtype = UnwrapElement(IN[2])
for ref in references:
elementlist.Append(ref)
TransactionManager.Instance.EnsureInTransaction(doc)
dimension = Autodesk.Revit.Creation.ItemFactoryBase.NewDimension(doc.ActiveView,line,elementlist, dimtype[0])
TransactionManager.Instance.TransactionTaskDone()
OUT = dimension