Hi Everyone,
python noob here; got stuck on making this code to work on multiple selected elements, the goal from this script is to rehost selected elements with a new host element.
import clr
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *
clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
doc = DocumentManager.Instance.CurrentDBDocument
doc = DocumentManager.Instance.CurrentDBDocument
railing = UnwrapElement(IN[0])
newhost = UnwrapElement(IN[1])
elements =[]
for a in railing:
elements.append(a.Id)
TransactionManager.Instance.EnsureInTransaction(doc)
hostId = newhost.Id
railing.HostId = hostId
TransactionManager.Instance.TransactionTaskDone()
OUT = railing
OUT = 0
thanks in advance