from Autodesk.Revit.DB import *
doc = __revit__.ActiveUIDocument.Document
uidoc = __revit__.ActiveUIDocument
app = __revit__.Application
lvls = FilteredElementCollector(doc).OfCategory(BuiltInCategory.OST_Levels)\
.WhereElementIsNotElementType().ToElements()
with Transaction(doc,__title__) as t:
t.Start()
wall = doc.GetElement(ElementId(346574))
wall_base = wall.get_Parameter(BuiltInParameter.WALL_BASE_CONSTRAINT)
wall_top = wall.get_Parameter(BuiltInParameter.WALL_HEIGHT_TYPE)
wall_height = wall.get_Parameter(BuiltInParameter.WALL_USER_HEIGHT_PARAM)
new_base_level = lvls[2]
new_top_level = lvls[3]
wall_base.Set(new_base_level.Id)
wall_top.Set(new_top_level.Id)
wall_top.Set(ElementId(-1))
wall_height.Set(20)
t.Commit()