Here are the relevant sections from revitapidocs:
- http://www.revitapidocs.com/2018/9351c377-8b05-503f-3cce-f60af42e9def.htm
- http://www.revitapidocs.com/2018/174346c5-e7f3-58f1-1495-3836c9f973e3.htm
If you want to add the Enumerations as string inputs you can use the Enum.Parse method.
import clr
import System
# Import Revit API
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *
from Autodesk.Revit.DB.Structure import *
# Import DocumentManager and TransactionManager
clr.AddReference('RevitServices')
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
doc = DocumentManager.Instance.CurrentDBDocument
# Input
elements = UnwrapElement(IN[0])
topZPriojection = System.Enum.Parse(clr.GetClrType(StickElementProjectionZ),IN[1])
bottomZProjection = System.Enum.Parse(clr.GetClrType(StickElementProjectionZ),IN[2])
if not isinstance(IN[0], list):
elements = [elements]
#Make changes to Revit DB in a Transaction
TransactionManager.Instance.EnsureInTransaction(doc)
for element in elements:
element.SetProjection(AnalyticalElementSelector.EndOrTop, StickElementProjectionY.LocationLine, topZPriojection)
element.SetProjection(AnalyticalElementSelector.StartOrBase, StickElementProjectionY.LocationLine, bottomZProjection)
TransactionManager.Instance.TransactionTaskDone()
OUT = 0