hi awilliams, seems Python code of getting element id isn’t working, i tried newhost.ElementId too, my host is ref plane, maybe that’s the reason? but i can get Id using code block
Hi,
If you follow the link it gives a example of the exception you would get if the problem is with the host…
Exception Condition
Autodesk.Revit.Exceptions ArgumentException
When setting this property: The hostId is not a valid railing host.
I think your exception is more likely to do with list structure… it is telling you that you can’t get an Id from a list…
To check if your idea will work… Flatten the Input and Get Item At Index 0…
Good luck
Mark
Can you share the code? Sounds like you are feeding it a list and not iterating through each element for the Id.
the previous issue has been solved by Mark after i added FirstItem node, now new issue arises, seems HostId is readonly so railing.HostId = hostId won’t work, in my case it’s lighting fixture:
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
elements = UnwrapElement(IN[0])
newhost = UnwrapElement(IN[1])
hostId = newhost.Id
TransactionManager.Instance.EnsureInTransaction(doc)
for i in elements:
i.HostId = hostId
TransactionManager.Instance.TransactionTaskDone()
OUT = elements
Hey,
(we Might need this to go into a new thread)
So I tried it this way, but got stuck unfortunately… It’s telling me that the wall isn’t iterable?
I’m a bit worried that railings have the property available…
But Lights don’t…
I tried using ‘host level’, but got not iterable using a level as well…
Apologies,
Mark
Edit: SetHostV2.dyn (19.4 KB)
Yes! New thread is on now
Great, thanks
So can you help the OP?
Mark
Yep! Few minutes
Boom! You’re the man…
yes, but your graph is only half displayed
That’s very clever
Does it mean that we can’t set the host?
Thanks,
Mark
Nope! currently not possible in Revit API. Cheers!
thanks all, i assume new work plane of lighting fixture cannot be set just like new host, in fact both are the same thing, correct?
i modified a bit of Kulkul’s graph, parameter “Elevation” is level based so it’s more accurate to use Z value from GetLocation
No you can’t unforunately.
Editing work plane is different than setting the location, my above example shows you how to set the location of fixture based on plane. It’s basically changing the offset of fixture.
Yes using Z value is more accurate. I just gave you the idea, you can adjust graph as per your requirement. Don’t forget to mark the post.
Cheers!