Full code with, with some unrelated features removed:
import clr
clr.AddReference(‘ProtoGeometry’)
from Autodesk.DesignScript.Geometry import *
#The inputs to this node will be stored as a list in the IN variables.
dataEnteringNode = IN
#FOR XYZ CONVERSION
clr.AddReference(“RevitNodes”)
import Revit
# Import ToProtoType, ToRevitType geometry conversion extension methods
clr.ImportExtensions(Revit.GeometryConversion)
# Line, Wall, etc
clr.AddReference(‘RevitAPI’)
import Autodesk
from Autodesk.Revit.DB import *
#Document and Transaction
clr.AddReference(“RevitServices”)
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
doc = DocumentManager.Instance.CurrentDBDocument
max = 20
base_height_off = 0
join_walls = True
flip_walls = True
is_structural = False
curves = IN[0][0:max]
heights = IN[1][0:max]
levels = IN[2][0:max]
wall_ts = IN[3][0:max]
#t = Transaction(doc, ‘Add Wall DH’)
#t.Start()
#t.Commit()
created_ids = []
created_uids = []
all = (curves, heights, levels, wall_ts)
all_set = map(list, zip(*all))
t_len = [len(x) for x in all]
if len(set(t_len)) > 1:
OUT = ‘Failed. Number of items not equal’
else:
#TransactionManager.Instance.EnsureInTransaction(doc)
t = Transaction(doc, ‘Add Wall’)
t.Start()
counter = 0
for curve, height, level, wall_t in all_set:
st_pt = curve.StartPoint
end_pt = curve.EndPoint
line = Line.CreateBound(st_pt.ToXyz(), end_pt.ToXyz())
wall = Wall.Create(doc, line, ElementId(wall_t.Id), ElementId(level.Id), height, base_height_off, False, is_structural)
if not join_walls:
WallUtils.DisallowWallJoinAtEnd(wall, 0)
WallUtils.DisallowWallJoinAtEnd(wall, 1)
if flip_walls:
wall.Flip()
location = wall.get_Parameter(BuiltInParameter.WALL_KEY_REF_PARAM)
location.Set(5)
mark = wall.get_Parameter(“Mark”)
mark.Set(str(counter))
counter +=1
created_ids.append(wall.Id)
created_uids.append(wall.UniqueId)
t.Commit()
#doc.Regenerate()
#transactionManager.Instance.TransactionTaskDone()
OUT = [created_ids,created_uids]