import clr #Revit API permite usar elementos de Revit (geometría, líneas, etc)
clr.AddReference(‘RevitAPI’)
from Autodesk.Revit.DB import *
from Autodesk.Revit.DB.Structure import * #Get Revit Elements
clr.AddReference(‘RevitNodes’)
import Revit
clr.ImportExtensions(Revit.GeometryConversion)
clr.ImportExtensions(Revit.Elements)
#Access Revit Document
clr.AddReference(‘RevitServices’)
import RevitServices
from RevitServices.Persistence import DocumentManager #Transaction permite ejecutar acciones en Revit
from RevitServices.Transactions import TransactionManager
doc = DocumentManager.Instance.CurrentDBDocument
#Preparing input from dynamo to revit
Curve = (IN[0])
level = UnwrapElement(IN[1])
bool = IN[2]
refLines=
if isinstance(Curve, list):
refLines.extend(IN[0])
else:
refLines.append(IN[0])
#Do some action in a Transaction
TransactionManager.Instance.EnsureInTransaction(doc)
This is a namespace conflict. Both DesignScript (Dynamo) and the Revit API have a Curve class. Judging by what it shown in this blog post, you should be able to take your curve from Dynamo and convert it to a proper Revit object like this:
The error is telling you that you are providing a Dynamo Curve, but it expects an Autodesk.Revit.DB.Curve. It is also good practice to avoid naming variables the same as Python built-in functions or other objects. For example:
You need to convert to RevitType() as @cgartland pointed and make sure you import clr.ImportExtensions(Revit.GeometryConversion) in order to use RevitType():