Pick New Host from the API?

Hello, everybody!
I looked through the API docs and I couldn’t find anything, but I might still be missing something here.
Is there an analog to Pick New Host in the API?


Did you ever find an answer to this? I’m looking for the same question’s answer.

The property HostId can be retrieved and set, so this Python script should do it:

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])

TransactionManager.Instance.EnsureInTransaction(doc)

hostId = newhost.Id
railing.HostId = hostId

TransactionManager.Instance.TransactionTaskDone()

OUT = railing
7 Likes

I totally forgot I made this topic.
I eventually found the HostId thing and it turned out to be straightforward. The thing I was working on though took another way so I never used it.
The sample script from @awilliams is working and it’s great.

1 Like

5 posts were split to a new topic: Pick new host lighting fixture

@Mark.Ackerley moved to new topic here

1 Like