you need to import the GeometryConversion tools (extension methods)
#----------------------------------#
# Load the Python Standard and DesignScript Libraries
import sys
#----------------------------------#
import clr
# Import Element wrapper extension methods
clr.AddReference("RevitNodes")
#----------------------------------#
import Revit
clr.ImportExtensions(Revit.Elements)
# Import DocumentManager and TransactionManager
clr.AddReference("RevitServices")
#----------------------------------#
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
# Import RevitAPI
clr.AddReference("RevitAPI")
#----------------------------------#
import Autodesk
from Autodesk.Revit.DB import *
#----------------------------------#
import System
from System.Collections.Generic import *
from System.Collections.Generic import List
#----------------------------------#
clr.AddReference("RevitNodes")
import Revit
# Import ToProtoType, ToRevitType geometry conversion extension methods
clr.ImportExtensions(Revit.GeometryConversion)
#----------------------------------#
doc = DocumentManager.Instance.CurrentDBDocument
reference = IN[0]
wallType = UnwrapElement(IN[1])
level = UnwrapElement(IN[2])
cur = IN[3]
listDBCurves = List[Curve]([i.ToRevitType() for i in cur])
TransactionManager.Instance.EnsureInTransaction(doc)
try:
new_wall = Wall.Create(doc, listDBCurves, wallType.Id, level.Id, False)
if new_wall is not None:
OUT = "Wall created successfully"
else:
OUT = "Wall.Create returned None. Check your input parameters."
except Exception as e:
OUT = f"An error occurred: {str(e)}"
TransactionManager.Instance.TransactionTaskDone()