Hey,
This works for me… There were things that were right and a few things to change, I would look at the Clockwork and Archi-lab nodes to see how they are working.
Hope that helps,
Mark
P.S. when pasting code, please use to format it
#thanks to clockwork and Archi-lab
import clr
clr.AddReference('RevitNodes')
import Revit
clr.ImportExtensions(Revit.Elements)
clr.AddReference('RevitServices')
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *
import System
doc = DocumentManager.Instance.CurrentDBDocument
baseLevel = UnwrapElement(IN[0])
topLevel = UnwrapElement(IN[1])
wallType = UnwrapElement(IN[2])
pt1 = XYZ(0, 0, 0)
pt2 = XYZ(10, 0, 0)
TransactionManager.Instance.EnsureInTransaction(doc)
line = Line.CreateBound(pt1, pt2)
wall = Wall.Create(doc, line, baseLevel.Id, False)
#we need to get an id from the type to use in setting the type, this must be an integer, to make an integer we need to convert the id to a string first
typeId = int(str(wallType.Id))
#change type, this needs an element id which is defined by the typeid
wall.ChangeTypeId(ElementId(typeId))
#to isolate the built in parameter we want, we first get all of them, then add the one which matches the name to our list.
builtInParams = System.Enum.GetValues(BuiltInParameter)
for i in builtInParams:
if i.ToString() == 'WALL_HEIGHT_TYPE':
bip = i
else:
continue
#as above we need an id from the top constraint to set the parameter value
topLevelId = int(str(topLevel.Id))
#we first get the wall parameter then we set it
wall.get_Parameter(bip).Set(ElementId(topLevelId))
TransactionManager.Instance.TransactionTaskDone()
OUT = wall,