import clr
#Import Revit Services
clr.AddReference ("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
#Import Revit API
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *
from Autodesk.Revit.DB.Architecture import *
clr.AddReference('RevitAPIUI')
from Autodesk.Revit.UI import *
#Import Revit Node
clr.AddReference('RevitNodes')
import Revit
clr.ImportExtensions(Revit.GeometryConversion)
clr.ImportExtensions(Revit.Elements)
#Import Proto Geometry
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *
import System
from System.Collections.Generic import *
#inputs
level = UnwrapElement(IN[0])
padType = UnwrapElement(IN[1])
curves = IN[2]
#necessary ID's
levelId = level.Id
typeId = padType.Id
#creating CurveLoop
loop = CurveLoop()
for c in curves:
loop.Append(c.ToRevitType())
#get the document
doc = DocumentManager.Instance.CurrentDBDocument
#use safe transaction with Revit
TransactionManager.Instance.EnsureInTransaction(doc)
#creating pad
loops = [loop]
pad = BuildingPad.Create(doc,typeId,levelId,loops)
#Finish transaction with task done
TransactionManager.Instance.TransactionTaskDone()
OUT = pad
3 Likes